/* ============================================
   Admin Login Page - Modern Design
   Crown Tournament Series
   ============================================ */

/* Admin Body */
.admin-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

/* Animated Background */
.admin-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(234, 3, 9, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(234, 3, 9, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse 40% 30% at 50% 50%, rgba(234, 3, 9, 0.05) 0%, transparent 50%);
    animation: backgroundPulse 8s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Grid Pattern */
.admin-body::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
    pointer-events: none;
}

/* Theme Toggle Bubble */
.theme-bubble {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 100;
}

.theme-toggle-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

.theme-toggle-btn .theme-icon-dark,
.theme-toggle-btn .theme-icon-light {
    font-size: 1.2rem;
    transition: var(--transition);
}

/* Dark mode: show sun (to switch to light), hide moon */
[data-theme="dark"] .theme-toggle-btn .theme-icon-dark {
    display: none;
}
[data-theme="dark"] .theme-toggle-btn .theme-icon-light {
    display: block;
    color: #fbbf24;
}

/* Light mode: show moon (to switch to dark), hide sun */
[data-theme="light"] .theme-toggle-btn .theme-icon-light {
    display: none;
}
[data-theme="light"] .theme-toggle-btn .theme-icon-dark {
    display: block;
    color: #6366f1;
}

.theme-toggle-btn.theme-toggle-active {
    animation: togglePulse 0.4s ease;
}

@keyframes togglePulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.9) rotate(15deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.theme-bubble-tooltip {
    display: none;
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 500px;
    padding: var(--space-8);
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

/* Login Card */
.login-card {
    background: rgba(15, 15, 18, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-12);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 60px rgba(234, 3, 9, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Top Gradient Bar */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary) 30%, 
        var(--primary-light) 50%, 
        var(--primary) 70%, 
        transparent 100%);
}

/* Corner Glow */
.login-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(234, 3, 9, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
    position: relative;
    z-index: 1;
}

.login-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto var(--space-5);
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary);
    box-shadow: 
        0 0 30px rgba(234, 3, 9, 0.3),
        0 0 60px rgba(234, 3, 9, 0.15);
    object-fit: cover;
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% { 
        box-shadow: 0 0 30px rgba(234, 3, 9, 0.3), 0 0 60px rgba(234, 3, 9, 0.15);
    }
    50% { 
        box-shadow: 0 0 40px rgba(234, 3, 9, 0.4), 0 0 80px rgba(234, 3, 9, 0.2);
    }
}

.login-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.login-header p {
    color: var(--primary-light);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
}

/* Login Form */
.login-form {
    position: relative;
    z-index: 1;
}

/* Alert */
.login-form .alert {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    animation: shake 0.4s ease-in-out;
}

.login-form .alert.show {
    display: flex;
}

.login-form .alert-icon {
    color: var(--error);
    font-size: 1rem;
}

.login-form .alert-text {
    color: var(--error);
    font-size: 0.875rem;
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Form Group */
.login-form .form-group {
    margin-bottom: var(--space-5);
}

.login-form .form-group label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.login-form .form-group label .label-icon {
    display: none;
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-form .input-icon,
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: var(--transition);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.login-form .input-with-icon,
.input-with-icon {
    width: 100%;
    padding: 16px 56px 16px 46px !important;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
    text-indent: 0;
}

.input-with-icon:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 3, 9, 0.15);
    background: var(--bg-tertiary);
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary-light);
}

.input-with-icon::placeholder {
    color: var(--text-muted);
}

/* Password Toggle */
.toggle-password {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    padding: var(--space-2);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.toggle-password:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.toggle-password .eye-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.checkbox-group label {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    cursor: pointer;
    margin: 0;
}

/* Submit Button */
.login-form .btn {
    width: 100%;
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-6);
    font-size: 1rem;
    gap: var(--space-3);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 20px rgba(234, 3, 9, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.login-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(234, 3, 9, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-form .btn:active {
    transform: translateY(0);
}

.login-form .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-form .btn .btn-icon {
    font-size: 1.125rem;
    color: currentColor !important;
    opacity: 1 !important;
    -webkit-text-fill-color: currentColor;
}

/* Ensure flaticon arrow/check icons are not gray */
.login-form .btn .fi-sr-arrow-right,
.login-form .btn .fi-sr-check-circle {
    color: currentColor !important;
    opacity: 1 !important;
}

/* Button Variants */
.btn-secondary {
    background: transparent !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
    margin-top: var(--space-3) !important;
}

.btn-secondary:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgba(234, 3, 9, 0.05) !important;
    box-shadow: 0 4px 12px rgba(234, 3, 9, 0.1) !important;
}

/* Logged In Notice */
.logged-in-notice {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    color: #22c55e;
    font-size: 0.875rem;
    animation: slideInDown 0.4s ease-out;
}

.logged-in-notice.show,
.logged-in-notice:not(.hidden) {
    display: flex;
}

.logged-in-notice i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.logged-in-notice strong {
    color: #10b981;
    font-weight: 600;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Features Section */
.features {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.feature i {
    font-size: 1.5rem;
    color: var(--primary-light);
    margin-bottom: var(--space-1);
}

/* Login Footer */
.login-footer {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    z-index: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary-light);
}

/* Floating Particles */
.login-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: floatParticle 15s linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Loading State */
.login-form .btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.login-form .btn.loading .btn-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success State */
.login-success {
    text-align: center;
    padding: var(--space-8) 0;
}

.login-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 2rem;
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.login-success h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.login-success p {
    color: var(--text-muted);
    margin: 0;
}

/* Responsive - Desktop First */
@media (min-width: 769px) {
    .login-container {
        max-width: 500px;
        padding: var(--space-8);
    }
    
    .login-card {
        padding: var(--space-12);
    }
    
    .login-logo {
        width: 100px;
        height: 100px;
    }
    
    .login-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .login-container {
        max-width: 440px;
        padding: var(--space-6);
    }
    
    .login-card {
        padding: var(--space-8);
    }
    
    .login-logo {
        width: 88px;
        height: 88px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: var(--space-4);
        max-width: 100%;
    }
    
    .login-card {
        padding: var(--space-6);
    }
    
    .login-logo {
        width: 72px;
        height: 72px;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .theme-bubble {
        top: var(--space-4);
        right: var(--space-4);
    }
    
    .theme-toggle-btn {
        width: 44px;
        height: 44px;
    }
}

/* Dark Theme Adjustments */
[data-theme="light"] .admin-body {
    background: #f8f9fa;
}

[data-theme="light"] .admin-body::before {
    background: 
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(234, 3, 9, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(234, 3, 9, 0.04) 0%, transparent 40%);
}

[data-theme="light"] .admin-body::after {
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-header h1 {
    color: #1a1a1d;
}

[data-theme="light"] .login-header p {
    color: #71717a;
}

[data-theme="light"] .login-form .form-group label {
    color: #52525b;
}

[data-theme="light"] .login-form .input-with-icon,
[data-theme="light"] .input-with-icon {
    background: #f4f4f5;
    border-color: #e4e4e7;
    color: #1a1a1d;
}

[data-theme="light"] .login-form .input-with-icon:focus,
[data-theme="light"] .input-with-icon:focus {
    background: #ffffff;
    border-color: #ea0309;
    box-shadow: 0 0 0 3px rgba(234, 3, 9, 0.1);
}

[data-theme="light"] .login-form .input-with-icon::placeholder,
[data-theme="light"] .input-with-icon::placeholder {
    color: #a1a1aa;
}

[data-theme="light"] .login-form .input-icon,
[data-theme="light"] .input-icon {
    color: #71717a;
}

[data-theme="light"] .input-wrapper:focus-within .input-icon {
    color: #ea0309;
}

[data-theme="light"] .toggle-password {
    color: #71717a;
}

[data-theme="light"] .toggle-password:hover {
    color: #1a1a1d;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .checkbox-group label {
    color: #52525b;
}

[data-theme="light"] .checkbox-group input[type="checkbox"] {
    accent-color: #ea0309;
}

[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #ea0309, #c70207);
    color: white;
}

[data-theme="light"] .btn-primary:hover {
    background: linear-gradient(135deg, #ff2a30, #ea0309);
}

[data-theme="light"] .login-footer .back-link {
    color: #71717a;
}

[data-theme="light"] .login-footer .back-link:hover {
    color: #ea0309;
}

[data-theme="light"] .theme-toggle-btn {
    background: #ffffff;
    border-color: #e4e4e7;
    color: #52525b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .theme-toggle-btn:hover {
    background: #f4f4f5;
    border-color: #ea0309;
    color: #ea0309;
}

[data-theme="light"] .alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}
