/* Login-specific Theme Variables */
:root {
    --login-primary: #1E3A8A;
    --login-secondary: #3B82F6;
    --login-accent: #F59E0B;
    --login-success: #10B981;
    --login-error: #EF4444;
    --login-warning: #F59E0B;
    
    --login-bg-primary: #F8FAFC;
    --login-bg-secondary: #FFFFFF;
    --login-bg-card: #FFFFFF;
    --login-text-primary: #1E293B;
    --login-text-secondary: #64748B;
    --login-border: #E2E8F0;
    --login-shadow: rgba(0, 0, 0, 0.1);
    
    --login-gradient-start: #667EEA;
    --login-gradient-end: #764BA2;
    
    /* Theme transition duration */
    --theme-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
    --login-bg-primary: #0F172A;
    --login-bg-secondary: #1E293B;
    --login-bg-card: #334155;
    --login-text-primary: #F1F5F9;
    --login-text-secondary: #94A3B8;
    --login-border: #475569;
    --login-shadow: rgba(0, 0, 0, 0.3);
    
    --login-gradient-start: #4C1D95;
    --login-gradient-end: #1E3A8A;
}

/* Force immediate theme application */
* {
    transition: var(--theme-transition);
}

/* Base Styles */
body {
    background: linear-gradient(135deg, var(--login-gradient-start) 0%, var(--login-gradient-end) 100%);
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    transition: var(--theme-transition);
}

.dark body {
    background: linear-gradient(135deg, #111827 0%, #1F2937 50%, #111827 100%);
}

/* Ensure immediate theme switching */
html.dark body {
    background: linear-gradient(135deg, #111827 0%, #1F2937 50%, #111827 100%) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
}

/* Animated Background */
.login-bg {
    position: relative;
    background: linear-gradient(135deg, var(--login-gradient-start) 0%, var(--login-gradient-end) 100%);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.dark .login-bg {
    background: linear-gradient(135deg, #111827 0%, #1F2937 50%, #111827 100%);
}

.login-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: float 20s infinite linear;
}

.dark .login-bg::before {
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Keyframe Animations */
@keyframes float {
    0% { transform: translateY(0px) translateX(0px); }
    33% { transform: translateY(-10px) translateX(5px); }
    66% { transform: translateY(5px) translateX(-5px); }
    100% { transform: translateY(0px) translateX(0px); }
}

@keyframes floatShapes {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
    75% { transform: translateY(-30px) rotate(270deg); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* Floating Shapes */
.shape {
    position: absolute;
    opacity: 0.1;
    animation: floatShapes 15s infinite ease-in-out;
    transition: opacity 0.3s ease;
}

.dark .shape {
    opacity: 0.05;
}

.shape:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    top: 60%;
    right: 15%;
    animation-delay: 5s;
}

.shape:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 10s;
}

/* Login Card Styles */
.login-card {
    background: var(--login-bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--login-border);
    box-shadow: 0 25px 50px -12px var(--login-shadow);
    animation: slideInUp 0.8s ease-out;
    transition: all 0.3s ease;
}

.dark .login-card {
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid rgba(75, 85, 99, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Input Styles */
.login-input {
    background: var(--login-bg-secondary);
    border: 2px solid var(--login-border);
    color: var(--login-text-primary);
    transition: all 0.3s ease;
}

.dark .login-input {
    background: rgba(55, 65, 81, 0.8);
    border: 2px solid rgba(75, 85, 99, 0.6);
    color: #F9FAFB;
}

.login-input:focus {
    border-color: var(--login-secondary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--login-bg-card);
}

.dark .login-input:focus {
    border-color: #60A5FA;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    background: rgba(75, 85, 99, 0.8);
}

.login-input::placeholder {
    color: var(--login-text-secondary);
}

.dark .login-input::placeholder {
    color: #9CA3AF;
}

/* Button Styles */
.login-btn {
    background: linear-gradient(135deg, var(--login-primary) 0%, var(--login-secondary) 100%);
    border: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dark .login-btn {
    background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(30, 58, 138, 0.3);
}

.dark .login-btn:hover {
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-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;
}

.login-btn:hover::before {
    left: 100%;
}

/* Theme Toggle Styles */
.theme-toggle {
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Error Styles */
.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--login-error);
}

.dark .login-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #FCA5A5;
}

/* Success Styles */
.login-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--login-success);
}

.dark .login-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6EE7B7;
}

/* Dark mode notification styles */
.dark .notification {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(75, 85, 99, 0.6);
    color: #F9FAFB;
}

/* Custom scrollbar for dark mode */
.dark ::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

.dark ::-webkit-scrollbar-thumb {
    background: #6B7280;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Responsive adjustments for dark mode */
@media (max-width: 640px) {
    .dark .login-card {
        background: rgba(31, 41, 55, 0.95);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .min-h-screen {
        min-height: 100vh;
        padding: 1rem !important;
    }
    
    .max-w-md {
        max-width: 100% !important;
        margin: 0 auto;
        padding: 0 !important;
    }
    
    .bg-white\/95 {
        margin: 1rem 0;
        padding: 1.5rem !important;
    }
    
    .h-24.w-24 {
        height: 4rem !important;
        width: 4rem !important;
    }
    
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .py-3 {
        padding-top: 0.875rem !important;
        padding-bottom: 0.875rem !important;
    }
    
    /* Input field optimizations for mobile */
    input[type="text"], input[type="password"] {
        font-size: 16px !important; /* Prevent zoom on iOS */
        -webkit-appearance: none;
        -webkit-border-radius: 0;
        border-radius: 0.5rem;
    }
    
    /* Button size optimization */
    button {
        min-height: 44px; /* iOS touch target minimum */
        touch-action: manipulation;
    }
    
    /* Background pattern adjustments for mobile */
    .absolute.top-10.left-10 { display: none; }
    .absolute.top-1\/4.right-20 { display: none; }
    .absolute.bottom-32.left-1\/4 { display: none; }
    .absolute.bottom-20.right-1\/3 { display: none; }
}

@media (max-width: 480px) {
    .py-12 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .space-y-8 > * + * {
        margin-top: 1rem !important;
    }
    
    .p-8 {
        padding: 1rem !important;
    }
    
    .text-sm {
        font-size: 0.75rem !important;
    }
}

/* Prevent horizontal scroll on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
}

/* Loading animation improvements */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Error message styling improvements */
.bg-red-50 {
    animation: slideInDown 0.3s ease-out;
}

.bg-green-50 {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Focus improvements for accessibility */
input:focus, button:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-white\/95 {
        background-color: white !important;
        border: 2px solid black !important;
    }
    
    .text-gray-700, .text-gray-300 {
        color: black !important;
    }
    
    .dark .text-gray-700, .dark .text-gray-300 {
        color: white !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-pulse, .animate-bounce {
        animation: none !important;
    }
}
