/* Preloader Styles */
.preloader {
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(135deg, #122C4F 0%, #002366 100%);
    display: flex; 
    justify-content: center;
    align-items: center; 
    z-index: 50;
}

.box {
    width: 12px; 
    height: 12px; 
    margin: 4px;
    background: linear-gradient(45deg, #ffffff, #f1f5f9);
    animation: bounce 0.6s infinite alternate;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(255,255,255,0.3);
}

.box:nth-child(2) { animation-delay: 0.2s; }
.box:nth-child(3) { animation-delay: 0.4s; }
.box:nth-child(4) { animation-delay: 0.6s; }

@keyframes bounce {
    to { transform: translateY(-20px); opacity: 0.7; }
}

/* Background Styles */
.gradient-bg {
    background: linear-gradient(135deg, #122C4F 0%, #002366 100%);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

.gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.2), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(18, 44, 79, 0.15), transparent 50%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Enhanced Glass Card with Better Responsive Design */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 20px;
    position: relative;
    z-index: 10;
}

/* Enhanced Input Group with Better Spacing */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.floating-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 0 8px;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    font-weight: 400;
}

.form-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
    transform: translateY(-1px);
}

.form-input:focus + .floating-label,
.form-input.has-value + .floating-label {
    top: -10px;
    font-size: 12px;
    color: #FFD700;
    font-weight: 600;
    background: white;
    padding: 0 8px;
}

/* Enhanced Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #122C4F 0%, #002366 100%);
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #FFD700 0%, #ffed4a 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.3);
    color: #122C4F;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Enhanced Google Button */
.google-btn {
    border: 2px solid #e5e7eb;
    background: white;
    padding: 14px 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    color: #374151;
    width: 100%;
    box-sizing: border-box;
}

.google-btn:hover {
    border-color: #4285f4;
    background: #f8faff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.1);
}

/* Enhanced Alert Styles */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid;
    animation: slideIn 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enhanced Close Button */
.close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 20px;
    font-weight: 300;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 50;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
    color: white;
}

/* Enhanced Floating Icons */
.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.floating-icon {
    position: absolute;
    color: rgba(255, 255, 255, 0.1);
    font-size: 20px;
    animation: floatIcon 8s linear infinite;
}

@keyframes floatIcon {
    0% { transform: translateY(100vh) rotate(0deg); }
    100% { transform: translateY(-100px) rotate(360deg); }
}

/* Enhanced Logo Container */
.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container img {
    height: 50px;
    width: auto;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.logo-container img:hover {
    transform: scale(1.05);
}

/* Enhanced reCAPTCHA Container */
.recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 10px 0;
}

.recaptcha-container .g-recaptcha {
    transform: scale(0.9);
    transform-origin: center;
}

/* Enhanced Role and Block Cards */
/* Role cards */
.role-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  background: white;
  transition: all 0.3s ease;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

.role-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.05), transparent);
  transition: left 0.5s;
}

.role-card:hover::before {
  left: 100%;
}

.role-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.role-card.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #eff6ff;
}

.role-card.active::before {
  display: none;
}

/* Block cards */
.block-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 2px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  background: white;
  transition: all 0.3s ease;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

.block-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(5, 150, 105, 0.05), transparent);
  transition: left 0.5s;
}

.block-card:hover::before {
  left: 100%;
}

.block-card:hover {
  border-color: var(--success-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.block-card.active {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
  background: #ecfdf5;
}

.block-card.active::before {
  display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Comprehensive Responsive Design */
/* Mobile First Approach */

/* Extra Small Devices (phones, 320px and up) */
@media (min-width: 320px) {
    .glass-card {
        margin: 16px;
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn-primary {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(0.75);
    }
    
    .floating-icon {
        font-size: 16px;
    }
    
    .close-btn {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .role-card {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .block-card {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .glass-card {
        margin: 24px;
        padding: 32px 28px;
    }
    
    .form-input {
        padding: 16px 18px;
        font-size: 16px;
    }
    
    .btn-primary {
        padding: 16px 22px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(0.8);
    }
    
    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .glass-card {
        margin: 32px;
        padding: 40px 36px;
        border-radius: 20px;
    }
    
    .form-input {
        padding: 18px 20px;
        font-size: 16px;
    }
    
    .btn-primary {
        padding: 18px 24px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(0.85);
    }
    
    .floating-icon {
        font-size: 18px;
    }
    
    .close-btn {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    
    .role-card {
        padding: 16px 20px;
        gap: 12px;
    }
    
    .block-card {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .glass-card {
        margin: 40px;
        padding: 48px 44px;
    }
    
    .form-input {
        padding: 20px 22px;
        font-size: 16px;
    }
    
    .btn-primary {
        padding: 20px 26px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 18px 22px;
        font-size: 15px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(0.9);
    }
    
    .floating-icon {
        font-size: 20px;
    }
    
    .close-btn {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .role-card {
        padding: 18px 22px;
        gap: 14px;
    }
    
    .block-card {
        padding: 14px 18px;
        font-size: 16px;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .glass-card {
        margin: 48px;
        padding: 56px 52px;
        max-width: 1200px;
    }
    
    .form-input {
        padding: 22px 24px;
        font-size: 16px;
    }
    
    .btn-primary {
        padding: 22px 28px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 20px 24px;
        font-size: 15px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(0.95);
    }
    
    .floating-icon {
        font-size: 22px;
    }
    
    .close-btn {
        width: 52px;
        height: 52px;
        font-size: 26px;
    }
    
    .role-card {
        padding: 20px 24px;
        gap: 16px;
    }
    
    .block-card {
        padding: 16px 20px;
        font-size: 16px;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .glass-card {
        margin: 56px;
        padding: 64px 60px;
        max-width: 1400px;
    }
    
    .form-input {
        padding: 24px 26px;
        font-size: 16px;
    }
    
    .btn-primary {
        padding: 24px 30px;
        font-size: 16px;
    }
    
    .google-btn {
        padding: 22px 26px;
        font-size: 15px;
    }
    
    .recaptcha-container .g-recaptcha {
        transform: scale(1);
    }
    
    .floating-icon {
        font-size: 24px;
    }
    
    .close-btn {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .role-card {
        padding: 22px 26px;
        gap: 18px;
    }
    
    .block-card {
        padding: 18px 22px;
        font-size: 16px;
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .glass-card {
        margin: 16px;
        padding: 24px 20px;
    }
    
    .input-group {
        margin-bottom: 1rem;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .logo-container img {
        height: 40px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .form-input {
        border-width: 1px;
    }
    
    .btn-primary {
        border-width: 1px;
    }
    
    .google-btn {
        border-width: 1px;
    }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    .floating-icon {
        animation: none;
    }
    
    .btn-primary::before {
        animation: none;
    }
    
    .form-input:focus {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
    
    .google-btn:hover {
        transform: none;
    }
    
    .role-card:hover {
        transform: none;
    }
    
    .block-card:hover {
        transform: none;
    }
    
    .logo-container img:hover {
        transform: none;
    }
}