@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Roboto:ital,wght@0,100..900;1,100..900&family=Orbitron:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg: #0a0f1f; /* Dark blue space background */
    --panel: #111827;
    --accent: #00e5ff; /* Bright cyan accent */
    --muted: rgba(255, 255, 255, 0.6);
    --panel-glow: rgba(0, 229, 255, 0.1);
    --card-border: rgba(0, 229, 255, 0.2);
    --text-primary: #eef2ff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --gradient-primary: linear-gradient(135deg, var(--accent), #0099cc);
    --gradient-secondary: linear-gradient(135deg, var(--panel), var(--bg));
    --shadow-glow: 0 0 20px rgba(0, 229, 255, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --border-radius: 15px;
    --input-bg: var(--panel);
    --input-border: var(--card-border);
    --danger-color: #e53935;
    --success-color: #43a047;
    --white: #fff;
    /* Mobile viewport height variable */
    --vh: 1vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* App Environment Detection Classes */
.mobile-app-body {
    /* Base mobile app styles */
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Standalone mode (installed as PWA) */
.mobile-app-body.standalone {
    /* Full screen app experience */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Browser mode */
.mobile-app-body.browser {
    /* Standard browser experience */
}

/* App Environment Indicator */
.app-environment-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent);
    text-align: center;
    padding: 4px 8px;
    font-size: 0.7rem;
    z-index: 10001;
    border-bottom: 1px solid var(--card-border);
}

.app-environment-indicator.standalone {
    display: none; /* Hide in standalone mode */
}

/* App Splash Screen */
.app-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0, 229, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 229, 255, 0.05) 0%, transparent 50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    visibility: visible;
}

.app-splash.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    color: var(--text-primary);
}

.splash-logo {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.splash-logo i {
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
}

.splash-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.splash-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.splash-loader {
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 229, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 20% 80%, rgba(0, 229, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 229, 255, 0.05) 0%, transparent 50%),
        url('https://www.transparenttextures.com/patterns/stardust.png');
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    min-height: calc(var(--vh, 1vh) * 100); /* Fallback for older browsers */
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    /* Prevent text size adjustment on iOS */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Better touch scrolling */
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    width: 100%;
    /* App-like fixed positioning */
    position: relative;
    box-sizing: border-box;
}

/* Standalone mode adjustments */
body.standalone {
    padding-top: max(env(safe-area-inset-top), 0px);
    padding-bottom: max(env(safe-area-inset-bottom), 0px);
}

body.standalone .container {
    border-radius: 0;
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Mobile app wrapper */
.mobile-app-wrapper {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center vertically */
    align-items: center; /* Center horizontally */
    padding: 1rem;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Ensure proper centering */
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 700px;
    background: var(--gradient-secondary);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    /* Mobile app-like container */
    margin: auto;
    /* Better mobile scrolling */
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    max-height: 100vh;
    max-height: 100dvh;
    /* Ensure container is centered */
    align-self: center;
    /* Prevent container from stretching */
    flex-shrink: 0;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--panel-glow);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.container:hover::before {
    opacity: 1;
}

h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    position: relative;
    z-index: 2;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

input, textarea, .styled-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    /* Mobile app-like input */
    -webkit-appearance: none;
    appearance: none;
    /* Prevent zoom on iOS when focusing inputs */
    font-size: 16px;
    /* Better touch targets */
    min-height: 44px;
    /* Prevent text selection on mobile */
    -webkit-user-select: text;
    user-select: text;
    /* Ensure consistent line height */
    line-height: 1.5;
    vertical-align: middle;
}

input:focus, textarea:focus, .styled-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

/* Ensure mobile prefix elements align properly on focus */
.mobile-prefix input:focus {
    border-left: none; /* Keep connected with span */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.mobile-prefix:focus-within span {
    border-color: var(--accent); /* Highlight span when input is focused */
}

/* Ensure perfect alignment - remove any vertical offset */
.mobile-prefix span,
.mobile-prefix input {
    vertical-align: top;
    margin-top: 0;
    margin-bottom: 0;
    box-sizing: border-box;
}

/* Force same baseline alignment */
.mobile-prefix {
    line-height: 0;
}

.mobile-prefix span,
.mobile-prefix input {
    line-height: normal;
}

/* Ensure span and input are perfectly aligned on same row */
.mobile-prefix span {
    display: inline-flex;
    align-items: center;
}

.mobile-prefix input {
    display: block;
}

.mobile-prefix {
    display: flex;
    align-items: stretch; /* Stretch to same height */
    flex-wrap: wrap; /* Allow button to wrap on mobile */
    gap: 0; /* No gap between elements */
    width: 100%;
}

/* Desktop: horizontal layout with button on same row */
@media (min-width: 769px) {
    .mobile-prefix {
        flex-wrap: nowrap; /* Keep all on same row */
    }
    
    .mobile-prefix span {
        width: auto;
        flex-shrink: 0;
        border-right: none;
        border-radius: var(--border-radius) 0 0 var(--border-radius);
    }
    
    .mobile-prefix input {
        flex: 1;
        border-left: none;
        border-radius: 0;
    }
    
    .mobile-prefix .btn {
        width: auto;
        min-width: 100px;
        margin-left: 10px;
        margin-top: 0;
        border-radius: 0 var(--border-radius) var(--border-radius) 0;
        order: 0; /* Reset order */
    }
}

.mobile-prefix span {
    background: var(--panel);
    padding: 12px 16px;
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
    border: 1px solid var(--input-border);
    border-right: none;
    color: var(--text-secondary);
    font-weight: 500;
    display: inline-flex;
    align-items: center; /* Center text vertically */
    justify-content: center;
    white-space: nowrap; /* Prevent wrapping */
    flex-shrink: 0; /* Don't shrink */
    /* Match input height exactly */
    line-height: 1;
    box-sizing: border-box;
    vertical-align: top;
    height: auto;
    min-height: 44px;
}

.mobile-prefix input {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none; /* Remove left border to connect with span */
    flex: 1; /* Take remaining space */
    min-width: 0; /* Allow shrinking */
    /* Match span height exactly */
    box-sizing: border-box;
    vertical-align: top;
    height: auto;
    min-height: 44px;
    margin: 0;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-option {
    flex: 1;
    padding: 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-option.active,
.btn-option:hover {
    background: var(--gradient-primary);
    color: var(--white);
    font-weight: 600;
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-glow);
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
    /* Mobile app-like button */
    -webkit-tap-highlight-color: transparent;
    /* Better touch targets - minimum 44x44px for mobile */
    min-height: 44px;
    min-width: 44px;
    /* Prevent text selection on tap */
    -webkit-user-select: none;
    user-select: none;
    /* Better touch feedback */
    touch-action: manipulation;
    /* Remove default button styling on mobile */
    -webkit-appearance: none;
    appearance: none;
}

.btn.accent {
    background: linear-gradient(135deg, #ff9800, #ff5722);
}

.btn:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 31, 0.9);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--panel);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    width: 90vw;
    max-width: 500px;
    animation: fadeIn 0.3s;
}

.modal-header {
    background: var(--panel);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--input-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--accent);
    font-weight: 600;
    font-family: 'Orbitron', sans-serif;
}

.close-btn {
    color: var(--accent);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--danger-color);
    text-decoration: none;
}

.modal-body p {
    margin: 0.5rem 0;
}

.modal-body .preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
}

/* Image Preview */
.preview {
    display: block;
    max-width: 200px;
    max-height: 200px;
    margin-top: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    object-fit: contain;
}

/* Message Bubbles */
.bubble {
    display: none;
    padding: 12px 16px;
    margin-top: 10px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--card-border);
}

.bubble.success {
    background: var(--success-color);
    color: var(--white);
}

.bubble.error {
    background: var(--danger-color);
    color: var(--white);
}

.bubble.info {
    background: var(--panel);
    color: var(--text-secondary);
    border-color: var(--accent);
}

/* Countdown Timer */
#timer {
    text-align: center;
    font-size: 1em;
    color: var(--accent);
    margin-top: 10px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        align-items: center; /* Center vertically */
        justify-content: center; /* Center horizontally */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* App-like full screen */
        position: fixed;
        width: 100%;
        height: 100%;
        height: 100vh;
        height: 100dvh;
        height: calc(var(--vh, 1vh) * 100);
    }
    
    /* Standalone mode - full screen app */
    body.standalone {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-app-wrapper {
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh;
        justify-content: flex-start;
    }
    
    .container {
        padding: 1.5rem;
        padding-top: max(1.5rem, env(safe-area-inset-top));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
        max-width: 100%;
        border-radius: var(--border-radius);
        margin: auto; /* Center the container */
        /* Don't force full height - let content determine height */
        min-height: auto;
        max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
        box-shadow: var(--shadow-card);
        border: 1px solid var(--card-border);
        /* App-like scrolling */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Full width on mobile but centered */
        width: calc(100% - 2rem);
        width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 2rem);
        /* Ensure proper centering */
        align-self: center;
        flex-shrink: 0;
    }
    
    /* Standalone mode container */
    body.standalone .container {
        padding-top: max(1.5rem, env(safe-area-inset-top));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
        max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
    }
    
    h2 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    
    input, textarea, .styled-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 48px; /* Better touch target */
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 48px; /* Better touch target */
        width: 100%; /* Full width on mobile */
        margin-top: 0.5rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-option {
        min-height: 48px; /* Better touch target */
        padding: 16px;
        font-size: 1rem;
    }
    
    .modal-content {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }
    
    /* Better mobile form spacing */
    form {
        gap: 1.25rem;
    }
    
    label {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    /* Mobile-friendly pin inputs */
    .pin-input {
        width: 50px;
        height: 56px;
        font-size: 1.5rem;
        min-height: 56px;
    }
    
    .pin-container {
        gap: 12px;
        justify-content: center;
    }
    
    /* Mobile-friendly mobile prefix - span and input on same row */
    .mobile-prefix {
        flex-direction: row; /* Keep span and input on same row */
        align-items: stretch;
        width: 100%;
        gap: 0;
        flex-wrap: wrap; /* Allow button to wrap below */
    }
    
    .mobile-prefix span {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        border-radius: var(--border-radius) 0 0 var(--border-radius);
        border: 1px solid var(--input-border);
        border-right: none;
        background: var(--panel);
        color: var(--text-secondary);
        font-weight: 500;
    }
    
    .mobile-prefix input {
        flex: 1;
        min-width: 0;
        padding: 14px 16px;
        min-height: 48px;
        border-radius: 0 var(--border-radius) var(--border-radius) 0;
        border: 1px solid var(--input-border);
        border-left: none;
        margin: 0;
        line-height: 1.5;
    }
    
    .mobile-prefix .btn {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
        min-height: 48px;
        border-radius: var(--border-radius);
        order: 3; /* Move button to bottom */
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }
    
    .container {
        padding: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        width: calc(100% - 1rem);
        width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 1rem);
        margin: auto;
        align-self: center;
    }
    
    .mobile-app-wrapper {
        padding: 0.5rem;
        padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
    }
    
    .btn {
        padding: 14px 18px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    form {
        gap: 1.25rem;
    }
    
    .pin-container {
        justify-content: center;
        gap: 8px;
    }
    
    .pin-input {
        width: 48px;
        height: 56px;
    }
    
    .field {
        margin-bottom: 1rem;
    }
    
    .mobile-prefix {
        flex-wrap: nowrap;
        align-items: stretch;
        width: 100%;
    }
    
    .mobile-prefix span,
    .mobile-prefix input {
        min-height: 48px;
        vertical-align: top;
    }
}

/* Very small mobile devices (320px - 375px) */
@media (max-width: 375px) {
    h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .container {
        padding: 0.75rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        width: calc(100% - 0.5rem);
        width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 0.5rem);
    }
    
    .mobile-app-wrapper {
        padding: 0.25rem;
        padding: max(0.25rem, env(safe-area-inset-top)) max(0.25rem, env(safe-area-inset-right)) max(0.25rem, env(safe-area-inset-bottom)) max(0.25rem, env(safe-area-inset-left));
    }
    
    .logo {
        font-size: 1.1rem;
        padding: 0.4rem 0;
    }
    
    .logo i {
        font-size: 1.3rem;
    }
    
    label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    input, textarea, .styled-input {
        padding: 12px 14px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
        min-height: 44px;
        width: 100%;
    }
    
    form {
        gap: 1rem;
    }
    
    .field {
        margin-bottom: 0.875rem;
    }
    
    .mobile-prefix span {
        padding: 12px 14px;
        min-height: 44px;
        font-size: 0.95rem;
    }
    
    .mobile-prefix input {
        padding: 12px 14px;
        min-height: 44px;
        font-size: 16px;
    }
    
    .mobile-prefix .btn {
        min-height: 44px;
        font-size: 0.95rem;
    }
    
    .pin-container {
        gap: 6px;
    }
    
    .pin-input {
        width: 44px;
        height: 52px;
        font-size: 1.3rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-option {
        min-height: 44px;
        padding: 14px;
        font-size: 0.95rem;
    }
    
    .modal-content {
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .bubble {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .otp-section {
        margin-top: 10px;
    }
    
    .otp-section input {
        font-size: 1.1rem;
        padding: 12px;
    }
    
    .datetime-picker-content {
        padding: 0.75rem;
    }
    
    .calendar-day {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .date-nav {
        width: 40px;
        height: 40px;
        min-height: 40px;
    }
    
    .month-selector, .year-selector {
        min-height: 40px;
        padding: 0.4rem;
        font-size: 0.85rem;
    }
    
    .time-select {
        min-height: 40px;
        padding: 0.6rem;
    }
    
    .datetime-picker-footer {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .datetime-picker-footer .btn {
        width: 100%;
        min-height: 44px;
    }
    
    .success-content h2 {
        font-size: 1.8em;
    }
    
    .success-content p {
        font-size: 0.95em;
        padding: 0 0.75rem;
    }
    
    .success-checkmark {
        width: 70px;
        height: 70px;
    }
    
    #rememberMobile + label,
    #rememberMe + label {
        min-height: 44px;
        padding-left: 40px;
        font-size: 0.9rem;
    }
    
    #rememberMobile + label::before,
    #rememberMe + label::before {
        width: 24px;
        height: 24px;
        left: 8px;
    }
    
    #rememberMobile + label::after,
    #rememberMe + label::after {
        left: 16px;
    }
    
    #clearMobile,
    #forgotPin {
        font-size: 0.75rem;
    }
    
    #timer {
        font-size: 0.9rem;
    }
    
    .registration-header p {
        font-size: 0.95rem;
    }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
    h2 {
        font-size: 1.2rem;
        margin-bottom: 0.875rem;
    }
    
    .container {
        padding: 0.5rem;
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        width: calc(100% - 0.25rem);
        width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 0.25rem);
    }
    
    .mobile-app-wrapper {
        padding: 0.125rem;
        padding: max(0.125rem, env(safe-area-inset-top)) max(0.125rem, env(safe-area-inset-right)) max(0.125rem, env(safe-area-inset-bottom)) max(0.125rem, env(safe-area-inset-left));
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .logo i {
        font-size: 1.2rem;
    }
    
    label {
        font-size: 0.85rem;
    }
    
    input, textarea, .styled-input {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 42px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
        min-height: 42px;
    }
    
    form {
        gap: 0.875rem;
    }
    
    .field {
        margin-bottom: 0.75rem;
    }
    
    .mobile-prefix span {
        padding: 10px 12px;
        min-height: 42px;
        font-size: 0.9rem;
    }
    
    .mobile-prefix input {
        padding: 10px 12px;
        min-height: 42px;
        font-size: 16px;
    }
    
    .mobile-prefix .btn {
        min-height: 42px;
        font-size: 0.9rem;
    }
    
    .pin-input {
        width: 40px;
        height: 48px;
        font-size: 1.2rem;
    }
    
    .pin-container {
        gap: 4px;
    }
    
    .btn-option {
        min-height: 42px;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .bubble {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .modal-content {
        padding: 10px;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .calendar-day {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .date-nav {
        width: 36px;
        height: 36px;
        min-height: 36px;
    }
    
    .month-selector, .year-selector {
        min-height: 36px;
        padding: 0.3rem;
        font-size: 0.8rem;
    }
    
    .time-select {
        min-height: 36px;
        padding: 0.5rem;
    }
    
    .success-content h2 {
        font-size: 1.6em;
    }
    
    .success-content p {
        font-size: 0.9em;
    }
    
    .success-checkmark {
        width: 60px;
        height: 60px;
    }
    
    #rememberMobile + label,
    #rememberMe + label {
        min-height: 42px;
        padding-left: 36px;
        font-size: 0.85rem;
    }
    
    #rememberMobile + label::before,
    #rememberMe + label::before {
        width: 22px;
        height: 22px;
        left: 6px;
    }
    
    #rememberMobile + label::after,
    #rememberMe + label::after {
        left: 14px;
    }
    
    #clearMobile,
    #forgotPin {
        font-size: 0.7rem;
    }
    
    #timer {
        font-size: 0.85rem;
    }
    
    .registration-header p {
        font-size: 0.9rem;
    }
}
    
    /* Ensure span and input stay connected on mobile */
    @media (max-width: 768px) {
        .mobile-prefix {
            flex-wrap: wrap;
        }
        
        .mobile-prefix span {
            border-radius: var(--border-radius) 0 0 var(--border-radius);
            border-right: none;
        }
        
        .mobile-prefix input {
            border-radius: 0 var(--border-radius) var(--border-radius) 0;
            border-left: none;
        }
        
        .mobile-prefix .btn {
            width: 100%;
            margin-top: 12px;
            border-radius: var(--border-radius);
        }
    }
    
    /* Button adjustments for very small screens */
    @media (max-width: 375px) {
        .mobile-prefix span,
        .mobile-prefix input {
            min-height: 44px;
            padding: 12px 14px;
        }
        
        .mobile-prefix .btn {
            margin-top: 10px;
            min-height: 44px;
        }
    }
    
    @media (max-width: 320px) {
        .mobile-prefix span,
        .mobile-prefix input {
            min-height: 42px;
            padding: 10px 12px;
        }
        
        .mobile-prefix .btn {
            margin-top: 8px;
            min-height: 42px;
        }
    }
    
    /* Better modal on small screens */
    .modal {
        padding: 0;
    }
    
    .modal-content {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Animated Messages */
.bubble.info.animated-message {
    color: var(--white);
    font-weight: 600;
    border: none;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-glow);
    padding: 12px 15px;
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated-message {
    display: block !important;
    animation: fadeInSlideUp 0.6s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fading-out {
    animation: fadeOut 0.5s ease-in forwards;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Full-screen success overlay */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 15, 31, 0.95);
    display: flex !important;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    backdrop-filter: blur(15px);
    animation: overlayFadeIn 0.5s ease-in-out forwards;
    pointer-events: auto;
    /* Mobile optimization: Enable hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: opacity, transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.success-overlay:not(.hidden),
.success-overlay.show {
    opacity: 1;
    display: flex !important;
    visibility: visible;
}

.success-overlay.hidden {
    display: none !important;
    opacity: 0;
    visibility: hidden;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(15px);
    }
}

.success-content {
    text-align: center;
    color: var(--white);
    transform: scale(0.7);
    opacity: 0;
    animation: zoomInBounce 0.8s 0.2s forwards;
    /* Mobile optimization: Enable hardware acceleration */
    -webkit-transform: translateZ(0) scale(0.7);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.success-icon-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.success-checkmark {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: var(--accent);
    stroke-miterlimit: 10;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
    animation: scaleIn 0.5s 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    transform: scale(0);
    /* Mobile optimization: Enable hardware acceleration */
    -webkit-transform: translateZ(0) scale(0);
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.success-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: var(--accent);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}

.success-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.9s forwards;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.success-content h2 {
    font-size: 3em;
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
    animation: pulseGlow 2s ease-in-out infinite;
}

.success-content p {
    font-size: 1.2em;
    margin-top: 10px;
    color: var(--text-secondary);
    animation: fadeInUp 0.6s 1s forwards;
    opacity: 0;
    /* Mobile optimization: Enable hardware acceleration */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

@keyframes zoomInBounce {
    0% {
        transform: scale(0.3) translateY(50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) translateY(-10px);
        opacity: 0.9;
    }
    70% {
        transform: scale(0.95) translateY(5px);
        opacity: 1;
    }
    85% {
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes pulseGlow {
    0%, 100% {
        text-shadow: 0 0 30px rgba(0, 229, 255, 0.4), 0 0 60px rgba(0, 229, 255, 0.3), 0 0 90px rgba(0, 229, 255, 0.2);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 50px rgba(0, 229, 255, 0.7), 0 0 100px rgba(0, 229, 255, 0.5), 0 0 150px rgba(0, 229, 255, 0.3);
        transform: scale(1.03);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shake animation for error */
@keyframes shake-horizontal {
    2%, 6% { transform: translateX(2px); }
    4%, 8% { transform: translateX(-2px); }
    10% { transform: translateX(0); }
}

#otpMessage.bubble.error:not(.hidden) {
    color: var(--white);
    font-weight: 600;
    border: none;
    background: linear-gradient(45deg, #d32f2f, #ff6b6b);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
    animation: shake-horizontal 0.5s ease-out;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .success-overlay {
        /* Ensure animations complete on mobile */
        animation-duration: 0.5s !important;
        animation-fill-mode: forwards !important;
    }
    
    .success-content {
        animation-duration: 0.8s !important;
        animation-delay: 0.2s !important;
        animation-fill-mode: forwards !important;
    }
    
    .success-content p {
        animation-duration: 0.6s !important;
        animation-delay: 1s !important;
        animation-fill-mode: forwards !important;
    }
    
    .success-checkmark {
        animation-duration: 0.5s !important;
        animation-delay: 0.3s !important;
        animation-fill-mode: forwards !important;
    }
    
    .success-checkmark-circle {
        animation-duration: 0.6s !important;
        animation-delay: 0.4s !important;
        animation-fill-mode: forwards !important;
    }
    
    .success-checkmark-check {
        animation-duration: 0.3s !important;
        animation-delay: 0.9s !important;
        animation-fill-mode: forwards !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    /* Exception: Keep success animations for better UX */
    .success-overlay,
    .success-content,
    .success-content p,
    .success-checkmark,
    .success-checkmark-circle,
    .success-checkmark-check {
        animation-duration: inherit !important;
    }
}

button:focus,
a:focus,
input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-brand {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    gap: 0.5rem;
    text-decoration: none;
    color: var(--accent);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--accent);
    text-align: center;
    width: 100%; /* Ensure logo takes full width */
}

.logo i {
    font-size: 1.8rem;
    animation: pulse 2s infinite;
    text-align: center;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);

}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

input#mobile::placeholder {
    opacity: 0.3;
}

.pin-container {
    display: flex;
    gap: 10px; /* Adjusted for smaller screens in media query */
}

.pin-input {
    width: 45px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    caret-color: var(--accent);
}

.pin-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}


#loginPinMessage.error:not(.hidden) {
    display: block;
    background-color: var(--danger-color);
    color: var(--white);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}

/* Remember Mobile Checkbox and Clear Link Styling */
/* Modern Custom Checkbox Design - Best Practices from Internet */
.checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    padding: 4px 0;
    position: relative;
}

/* Hide native checkbox */
.checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

/* Custom checkbox box */
.checkbox-wrapper::before {
    content: '';
    display: inline-block;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    border: 2px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Checkmark icon */
.checkbox-wrapper::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg) scale(0);
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

/* Checked state */
.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-wrapper::before,
.checkbox-wrapper input[type="checkbox"]:checked + span + .checkbox-wrapper::before {
    background: var(--gradient-primary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2), 0 2px 8px rgba(0, 229, 255, 0.3);
    transform: scale(1.05);
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-wrapper::after,
.checkbox-wrapper input[type="checkbox"]:checked + span + .checkbox-wrapper::after {
    transform: translateY(-50%) rotate(45deg) scale(1);
    opacity: 1;
}

/* Simplified checked state */
.checkbox-wrapper:has(input[type="checkbox"]:checked)::before {
    background: var(--gradient-primary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2), 0 2px 8px rgba(0, 229, 255, 0.3);
    transform: scale(1.05);
}

.checkbox-wrapper:has(input[type="checkbox"]:checked)::after {
    transform: translateY(-50%) rotate(45deg) scale(1);
    opacity: 1;
}

/* Hover state */
.checkbox-wrapper:hover::before {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.1);
}

/* Focus state for accessibility */
.checkbox-wrapper input[type="checkbox"]:focus + span,
.checkbox-wrapper input[type="checkbox"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.checkbox-wrapper:has(input[type="checkbox"]:focus)::before {
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.15);
}

/* Active/pressed state */
.checkbox-wrapper:active::before {
    transform: scale(0.95);
}

/* Label/span text styling */
.checkbox-wrapper span {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
}

/* Modern Premium Checkbox Design - 2024 Best Practices */
#rememberMobile,
#rememberMe {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

#rememberMobile + label,
#rememberMe + label {
    margin-left: 0;
    margin-bottom: 0;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
    padding-left: 48px;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 12px;
    background: transparent;
    /* Better touch target */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Modern checkbox box with gradient border */
#rememberMobile + label::before,
#rememberMe + label::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border: 2.5px solid var(--input-border);
    border-radius: 8px;
    background: var(--panel);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    z-index: 1;
}

/* Animated checkmark with bounce effect */
#rememberMobile + label::after,
#rememberMe + label::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg) scale(0);
    width: 7px;
    height: 12px;
    border: solid var(--white);
    border-width: 0 3px 3px 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Checked state with premium animation */
#rememberMobile:checked + label::before,
#rememberMe:checked + label::before {
    background: linear-gradient(135deg, #00e5ff 0%, #0099cc 100%);
    border-color: #00e5ff;
    box-shadow: 
        0 0 0 4px rgba(0, 229, 255, 0.2),
        0 4px 16px rgba(0, 229, 255, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
    animation: checkboxPulse 0.6s ease-out;
}

#rememberMobile:checked + label::after,
#rememberMe:checked + label::after {
    transform: translateY(-50%) rotate(45deg) scale(1);
    opacity: 1;
    animation: checkmarkBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

/* Hover state with glow effect */
#rememberMobile:hover + label,
#rememberMe:hover + label {
    background: rgba(0, 229, 255, 0.05);
    color: var(--accent);
}

#rememberMobile:hover + label::before,
#rememberMe:hover + label::before {
    border-color: var(--accent);
    box-shadow: 
        0 0 0 3px rgba(0, 229, 255, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transform: translateY(-50%) scale(1.05);
}

/* Focus state for accessibility */
#rememberMobile:focus + label,
#rememberMe:focus + label {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 12px;
}

#rememberMobile:focus + label::before,
#rememberMe:focus + label::before {
    box-shadow: 
        0 0 0 6px rgba(0, 229, 255, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

/* Active/pressed state */
#rememberMobile:active + label::before,
#rememberMe:active + label::before {
    transform: translateY(-50%) scale(0.95);
    transition: transform 0.1s ease;
}

/* Animations */
@keyframes checkboxPulse {
    0% {
        transform: translateY(-50%) scale(1);
        box-shadow: 
            0 0 0 0 rgba(0, 229, 255, 0.4),
            0 4px 16px rgba(0, 229, 255, 0.4);
    }
    50% {
        transform: translateY(-50%) scale(1.15);
        box-shadow: 
            0 0 0 8px rgba(0, 229, 255, 0),
            0 4px 16px rgba(0, 229, 255, 0.6);
    }
    100% {
        transform: translateY(-50%) scale(1.1);
        box-shadow: 
            0 0 0 4px rgba(0, 229, 255, 0.2),
            0 4px 16px rgba(0, 229, 255, 0.4);
    }
}

@keyframes checkmarkBounce {
    0% {
        transform: translateY(-50%) rotate(45deg) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateY(-50%) rotate(45deg) scale(1.3);
    }
    100% {
        transform: translateY(-50%) rotate(45deg) scale(1);
        opacity: 1;
    }
}

#clearMobile {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 15px;
    transition: color 0.3s ease;
    cursor: pointer;
}

#clearMobile:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Checkbox improvements for mobile */
@media (max-width: 768px) {
    #rememberMobile + label,
    #rememberMe + label {
        min-height: 48px;
        padding: 8px 10px;
        padding-left: 44px;
        font-size: 0.95rem;
        gap: 10px;
    }
    
    #rememberMobile + label::before,
    #rememberMe + label::before {
        width: 26px;
        height: 26px;
        min-width: 26px;
        min-height: 26px;
        left: 10px;
        border-width: 2.5px;
    }
    
    #rememberMobile + label::after,
    #rememberMe + label::after {
        left: 18px;
        width: 8px;
        height: 13px;
        border-width: 0 3px 3px 0;
    }
    
    #rememberMobile:checked + label::after,
    #rememberMe:checked + label::after {
        left: 18px;
    }
}

@media (max-width: 375px) {
    #rememberMobile + label,
    #rememberMe + label {
        min-height: 44px;
        padding: 6px 8px;
        padding-left: 40px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    #rememberMobile + label::before,
    #rememberMe + label::before {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        left: 8px;
        border-width: 2.5px;
    }
    
    #rememberMobile + label::after,
    #rememberMe + label::after {
        left: 16px;
        width: 7px;
        height: 12px;
        border-width: 0 3px 3px 0;
    }
    
    #rememberMobile:checked + label::after,
    #rememberMe:checked + label::after {
        left: 16px;
    }
}

@media (max-width: 320px) {
    #rememberMobile + label,
    #rememberMe + label {
        min-height: 42px;
        padding: 5px 6px;
        padding-left: 36px;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    #rememberMobile + label::before,
    #rememberMe + label::before {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        left: 6px;
        border-width: 2px;
        border-radius: 6px;
    }
    
    #rememberMobile + label::after,
    #rememberMe + label::after {
        left: 14px;
        width: 6px;
        height: 10px;
        border-width: 0 2.5px 2.5px 0;
    }
    
    #rememberMobile:checked + label::after,
    #rememberMe:checked + label::after {
        left: 14px;
    }
}

/* Custom Date/Time Picker Panel */
.datetime-picker-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--panel-glow);
    z-index: 2000;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.datetime-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent);
}

.datetime-picker-header h3 {
    margin: 0;
    color: var(--accent);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.datetime-picker-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.datetime-picker-close:hover {
    background: var(--panel-glow);
    color: var(--text);
}

.datetime-picker-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.date-section, .time-section {
    margin-bottom: 1.5rem;
}

.date-section h4, .time-section h4 {
    margin: 0 0 1rem 0;
    color: var(--accent);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.date-nav {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-nav:hover {
    background: var(--accent);
    color: var(--panel);
    border-color: var(--accent);
}

.month-year-selectors {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.month-selector, .year-selector {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.25rem 0.5rem;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.month-selector:focus, .year-selector:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 10px var(--panel-glow);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.weekdays span {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.calendar-day {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: var(--panel-glow);
    border-color: var(--accent);
}

.calendar-day.selected {
    background: var(--accent);
    color: var(--panel);
    border-color: var(--accent);
    font-weight: 600;
}

.calendar-day.disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.calendar-day.disabled:hover {
    background: transparent;
    border-color: transparent;
}

.calendar-day.today {
    border-color: var(--accent);
    font-weight: 600;
}

.time-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.time-input-group label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
}

.time-select {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 10px var(--panel-glow);
}

.time-separator {
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 600;
    align-self: center;
}

.time-display {
    text-align: center;
    padding: 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.datetime-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent);
}

.btn-secondary {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--muted);
}

.btn-secondary:hover {
    background: var(--panel-glow);
    color: var(--text);
    border-color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: var(--panel);
    border: 1px solid var(--accent);
}

.btn-primary:hover {
    background: var(--text);
    color: var(--panel);
    box-shadow: 0 0 15px var(--accent);
}

/* Blinking apply button */
@keyframes blink-glow {
    0%, 100% { box-shadow: 0 0 15px var(--accent); }
    50% { box-shadow: 0 0 25px var(--accent), 0 0 10px #fff; }
}

.btn-primary.btn-blink {
    animation: blink-glow 1.5s infinite;
}

/* Mobile responsiveness for date/time picker */
@media (max-width: 480px) {
    .datetime-picker-panel {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .datetime-picker-content {
        padding: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .calendar-grid {
        gap: 0.25rem;
    }

    .calendar-day {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        min-height: 44px; /* Better touch target */
    }

    .time-picker {
        flex-direction: row;
        gap: 0.5rem;
        justify-content: center;
    }

    .time-separator {
        display: block;
    }

    .datetime-picker-footer {
        flex-direction: row;
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .datetime-picker-footer .btn {
        flex: 1;
        min-height: 48px;
    }

    .nav-container {
        padding: 0 1rem;
    }

    /* Success overlay mobile responsiveness */
    .success-checkmark {
        width: 80px;
        height: 80px;
    }

    .success-content h2 {
        font-size: 2em;
    }

    .success-content p {
        font-size: 1em;
        padding: 0 1rem;
    }
    
    /* Better touch targets for date picker controls */
    .date-nav {
        width: 44px;
        height: 44px;
        min-height: 44px;
    }
    
    .month-selector, .year-selector {
        min-height: 44px;
        padding: 0.5rem;
    }
    
    .time-select {
        min-height: 44px;
        padding: 0.75rem;
    }
}

/* Forgot PIN Modal */
#forgotPinModal .modal-content {
    max-width: 400px;
}

#forgotPinModal .modal-header h3 {
    font-size: 1.2rem;
}

#forgotPinModal .modal-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#forgotPinModal .field {
    margin-bottom: 1rem;
}

/* Additional mobile app-like features */
* {
    /* Better touch scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Prevent text selection on interactive elements */
button, .btn, .btn-option, .pin-input, .date-nav, .calendar-day {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 229, 255, 0.2);
}

/* Better focus states for mobile */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2);
}

/* Prevent double-tap zoom on buttons */
button, .btn, a.btn {
    touch-action: manipulation;
}

/* Better mobile scrolling container */
.container {
    scroll-behavior: smooth;
}

/* Hide scrollbar on mobile for cleaner look */
@media (max-width: 768px) {
    .container::-webkit-scrollbar {
        width: 0;
        background: transparent;
    }
    
    body::-webkit-scrollbar {
        width: 0;
        background: transparent;
    }
}

/* Better mobile keyboard handling */
@media (max-width: 768px) {
    /* Ensure inputs don't get cut off when keyboard appears */
    input:focus, textarea:focus {
        scroll-margin-top: 100px;
    }
}

/* Mobile app-like transitions */
@media (max-width: 768px) {
    .container, .modal-content, .datetime-picker-panel {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
}

/* Better mobile logo */
@media (max-width: 768px) {
    .logo {
        font-size: 1.3rem;
        padding: 0.5rem 0;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
}

/* App-like status bar spacing for standalone mode */
body.standalone .container {
    padding-top: calc(env(safe-area-inset-top) + 1rem);
}

/* Prevent address bar from affecting layout */
@media (max-width: 768px) {
    .mobile-app-wrapper {
        min-height: -webkit-fill-available;
        min-height: 100dvh;
    }
}

/* Better app-like transitions */
@media (max-width: 768px) {
    .container, .modal-content, .datetime-picker-panel {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* App-like page transitions */
    .container {
        animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Environment-specific styles */
body.standalone .mobile-app-wrapper {
    /* Full screen in standalone */
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    justify-content: center;
    align-items: center;
}

body.browser .mobile-app-wrapper {
    /* Standard browser with some padding */
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    justify-content: center;
    align-items: center;
}

/* Ensure container is always centered */
#main-container.container {
    margin: auto;
    align-self: center;
    justify-self: center;
}