* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Enhanced touch optimization */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Hide scrollbars while keeping scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
*::-webkit-scrollbar {
    display: none;
}

/* Specific targeting for common scrollable elements */
body,
html,
.container,
.form-container,
.modal,
.modal-content,
textarea {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

body::-webkit-scrollbar,
html::-webkit-scrollbar,
.container::-webkit-scrollbar,
.form-container::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    display: none;
}

/* Allow text selection for input fields */
input, textarea, select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html {
    /* Smooth scrolling for all devices */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 30%, #16213e 60%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    /* Enhanced mobile scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Prevent bounce effect on iOS */
    -webkit-scroll-behavior: smooth;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 150, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 200, 255, 0.08) 0%, transparent 50%);
    animation: backgroundPulse 15s ease-in-out infinite alternate;
    /* Hardware acceleration */
    will-change: opacity, transform;
    transform: translateZ(0);
}

@keyframes backgroundPulse {
    0% { opacity: 0.5; transform: scale(1) translateZ(0); }
    100% { opacity: 0.8; transform: scale(1.05) translateZ(0); }
}

.container {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 520px;
    max-width: 95vw;
    position: relative;
    z-index: 10;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: containerGlow 4s ease-in-out infinite alternate;
    /* Hardware acceleration */
    will-change: box-shadow;
    transform: translateZ(0);
}

@keyframes containerGlow {
    0% { box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
    100% { box-shadow: 0 25px 50px rgba(0, 100, 200, 0.2), 0 0 0 1px rgba(0, 150, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
}

.form-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    border-radius: 20px 20px 0 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 20px rgba(0, 212, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    /* Hardware acceleration */
    will-change: transform;
    transform: translateZ(0);
}

.toggle-btn {
    flex: 1;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
    font-size: 15px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.toggle-btn.active {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.form-container {
    padding: 30px;
    height: auto;
    overflow: visible;
}

.form {
    display: none;
}

.form.active {
    display: block;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(15px) scale(0.98) translateZ(0); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1) translateZ(0); 
    }
}

.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    z-index: 10;
    pointer-events: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px 12px 45px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Mobile optimization */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Touch optimization */
    touch-action: manipulation;
    /* iOS zoom prevention */
    font-size: 16px;
}

/* Custom select styling for all devices */
.form-group select {
    padding-left: 45px;
    background-color: rgba(0, 0, 0, 0.2);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    cursor: pointer;
    /* Ensure consistent styling across devices */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Remove default arrow on IE */
    &::-ms-expand {
        display: none;
    }
}

/* Enhanced select option styling */
.form-group select option {
    background-color: #1a1a2e;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 12px 16px;
    font-size: 14px;
    border: none;
    /* Remove default option styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Force consistent select styling on mobile */
@supports (-webkit-touch-callout: none) {
    .form-group select {
        background-color: rgba(0, 0, 0, 0.3) !important;
        color: white !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
    }
    
    .form-group select option {
        background-color: #1a1a2e !important;
        color: white !important;
    }
}

/* Android Chrome specific fixes */
.form-group select:focus {
    background-color: rgba(0, 0, 0, 0.3) !important;
    color: white !important;
}

.form-group textarea {
    padding-left: 45px;
    padding-top: 12px;
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-group select::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00d4ff;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 
        0 0 0 3px rgba(0, 212, 255, 0.1),
        0 8px 25px rgba(0, 212, 255, 0.15);
    transform: translateY(-1px) translateZ(0);
    /* Hardware acceleration */
    will-change: transform;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
    /* Smooth scrolling for textarea */
    -webkit-overflow-scrolling: touch;
}

.form-row {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.form-row.two-cols {
    grid-template-columns: 1fr 1fr;
}

.form-row .form-group {
    margin-bottom: 0;
}

.captcha-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 15px;
}

.captcha-image {
    flex: 1;
    text-align: center;
}

.captcha-text {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #00d4ff;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    background: linear-gradient(45deg, #00d4ff, #0099cc, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.captcha-refresh {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 8px;
    color: #00d4ff;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.captcha-refresh:hover,
.captcha-refresh:active {
    background: rgba(0, 212, 255, 0.3);
    transform: rotate(180deg) translateZ(0);
}

.captcha-group input {
    padding-left: 16px;
}

.remember-forgot {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 0;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.remember-me input[type="checkbox"] {
    width: auto;
    accent-color: #00d4ff;
    /* Touch optimization */
    touch-action: manipulation;
}

.forgot-link {
    color: #00d4ff;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Minimum touch target size */
    min-height: 44px;
    display: flex;
    align-items: center;
}

.forgot-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #00d4ff;
    transition: width 0.3s ease;
}

.forgot-link:hover,
.forgot-link:active {
    color: #00b4ff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.forgot-link:hover::after,
.forgot-link:active::after {
    width: 100%;
}

.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Minimum touch target size */
    min-height: 48px;
    /* Hardware acceleration */
    will-change: transform;
    transform: translateZ(0);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-text {
    transition: opacity 0.3s ease;
}

.btn-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.btn.loading .btn-text {
    opacity: 0;
}

.btn.loading .btn-loader {
    opacity: 1;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg) translateZ(0); }
    100% { transform: rotate(360deg) translateZ(0); }
}

.btn::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:hover::before,
.btn:active::before {
    left: 100%;
}

.btn:hover:not(:disabled),
.btn:active:not(:disabled) {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
    background: linear-gradient(135deg, #00b4ff 0%, #0088bb 100%);
}

.btn:active:not(:disabled) {
    transform: translateY(0) translateZ(0);
}

.error {
    background: rgba(220, 53, 69, 0.15);
    color: #ff6b7a;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid rgba(220, 53, 69, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.1);
}

.success {
    background: rgba(40, 167, 69, 0.15);
    color: #4ade80;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid rgba(40, 167, 69, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.1);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Smooth scrolling for modal */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10% auto;
    padding: 30px;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    /* Hardware acceleration */
    transform: translateZ(0);
}

.modal-content h2 {
    color: white;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 20px;
}

.close {
    color: rgba(255, 255, 255, 0.6);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Minimum touch target size */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover,
.close:active {
    color: #00d4ff;
}

.modal-step {
    display: none;
}

.modal-step.active {
    display: block;
}

.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 50%;
    animation: float 20s infinite linear;
    /* Hardware acceleration */
    will-change: transform, opacity;
    transform: translateZ(0);
}

.particle:nth-child(1) {
    width: 4px;
    height: 4px;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 6px;
    height: 6px;
    left: 70%;
    animation-delay: 7s;
}

.particle:nth-child(3) {
    width: 3px;
    height: 3px;
    left: 40%;
    animation-delay: 15s;
}

.particle:nth-child(4) {
    width: 5px;
    height: 5px;
    left: 90%;
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg) translateZ(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg) translateZ(0);
        opacity: 0;
    }
}

/* Enhanced mobile responsive design */
@media (max-width: 600px) {
    body {
        padding: 10px;
        /* Better mobile scrolling */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
    
    .form-row.two-cols {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 16px;
    }
    
    .container {
        margin: 10px 0;
        width: calc(100vw - 20px);
        /* Ensure container doesn't cause horizontal scroll */
        max-width: calc(100vw - 20px);
    }
    
    .form-container {
        padding: 24px;
    }

    .remember-forgot {
        flex-direction: column;
        gap: 12px;
    }
    
    .captcha-container {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    /* Better mobile input handling */
    .form-group input,
    .form-group select,
    .form-group textarea {
        /* Prevent zoom on iOS */
        font-size: 16px;
        /* Better touch targets */
        min-height: 48px;
        /*padding: 16px 16px 16px 45px;*/
    }
    
    /* Enhanced mobile select styling */
    .form-group select {
        background-color: rgba(0, 0, 0, 0.3) !important;
        color: white !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        /* Force appearance */
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
    
    .form-group select option {
        background-color: #1a1a2e !important;
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
        color: white !important;
        padding: 16px !important;
        font-size: 16px;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
    }
    
    /* Better button touch targets */
    .btn {
        min-height: 52px;
        padding: 16px;
        font-size: 16px;
    }
    
    .toggle-btn {
        min-height: 48px;
        padding: 16px;
    }
}

/* Tablet optimization */
@media (max-width: 1024px) and (min-width: 601px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .form-row {
        margin-bottom: 0px;
    }
    
    /* Optimize select for tablets */
    .form-group select {
        background-color: rgba(0, 0, 0, 0.2) !important;
        color: white !important;
    }
    
    .form-group select option {
        background-color: #1a1a2e !important;
        color: white !important;
    }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .captcha-text {
        /* Sharper text on retina displays */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Landscape mobile optimization */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 10px;
        align-items: flex-start;
        justify-content: center;
        padding-top: 20px;
    }
    
    .container {
        margin: 0;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .form-container {
        padding: 20px;
    }
    
    .modal-content {
        margin: 2% auto;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark mode preference support */
@media (prefers-color-scheme: dark) {
    .form-group select {
        color-scheme: dark;
    }
    
    .form-group select option {
        background-color: #1a1a2e !important;
        color: white !important;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle {
        animation: none;
    }
    
    body::before {
        animation: none;
    }
}

/* Force hardware acceleration on key elements */
.container,
.toggle-indicator,
.btn,
.particle,
body::before {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix viewport height on iOS */
    body {
        min-height: -webkit-fill-available;
    }
    
    /* Fix select appearance on iOS */
    .form-group select {
        background-color: rgba(0, 0, 0, 0.3) !important;
        color: white !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
    }
    
    .form-group select option {
        background-color: #000 !important;
        color: white !important;
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .form-group select {
        background-color: rgba(0, 0, 0, 0.3) !important;
        color: white !important;
    }
}

/* Focus states for accessibility and better UX */
.btn:focus-visible,
.toggle-btn:focus-visible,
.forgot-link:focus-visible,
.close:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(0, 212, 255, 0.3),
        0 8px 25px rgba(0, 212, 255, 0.15);
}