/* ============================================
   Admin Login Page Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Vazir';
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); /* Darker background for Admin */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* ============================================
   Animated Background Shapes
   ============================================ */
body::before,
body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.05;
    animation: float 20s infinite ease-in-out;
}

body::before {
    width: 600px;
    height: 600px;
    background: white;
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

body::after {
    width: 400px;
    height: 400px;
    background: white;
    bottom: -100px;
    left: -100px;
    animation-delay: 5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-50px) rotate(180deg); }
}

/* ============================================
   Login Container
   ============================================ */
.login-container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px var(--shadow-lg);
    max-width: 450px;
    width: 100%;
    padding: 32px 28px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
    max-height: 90vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Logo Section
   ============================================ */
.logo-section {
    text-align: center;
    margin-bottom: 24px;
}

.logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
    font-weight: bold;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-section h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 6px;
    font-weight: 700;
}

.logo-section p {
    color: var(--gray);
    font-size: 13px;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--dark);
    font-weight: 600;
    font-size: 13px;
}

.captcha-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.captcha-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-control {
    width: 100%;
    padding: 10px 44px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--light);
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-control:focus + .input-icon {
    color: var(--primary);
}

.password-toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary);
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.form-check input {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check label {
    font-size: 13px;
    color: var(--gray);
    cursor: pointer;
    user-select: none;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    gap: 12px;
}

/* ============================================
   Divider
   ============================================ */
.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider span {
    background: white;
    padding: 0 16px;
    color: var(--gray);
    font-size: 14px;
    position: relative;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* ============================================
   Footer Links
   ============================================ */
.footer-links {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   Loading State
   ============================================ */
.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
}

@keyframes spin {
    to { transform: translate(50%, -50%) rotate(360deg); }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 480px) {
    body::before,
    body::after {
        display: none;
    }

    .login-container {
        padding: 24px 18px;
        border-radius: 20px;
        max-width: 94vw;
    }

    .logo {
        width: 56px;
        height: 56px;
        font-size: 26px;
    }

    .logo-section h1 {
        font-size: 22px;
    }

    .input-icon {
        right: 10px;
        font-size: 14px;
    }

    .password-toggle {
        left: 10px;
        font-size: 14px;
    }

    .form-control {
        padding: 12px 40px 12px 10px;
        font-size: 13px;
    }

    .captcha-header {
        margin-bottom: 6px;
    }
    .captcha-wrapper {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .captcha-wrapper img {
        max-height: 34px;
    }

    .captcha-wrapper .material-icons {
        font-size: 16px !important;
    }

    .footer-links {
        margin-top: 12px;
        padding-top: 12px;
    }
}

@media (max-width: 768px) {
    .login-container {
        padding: 28px 22px;
        max-width: 420px;
    }

    .logo {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .logo-section h1 {
        font-size: 23px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .form-control {
        padding: 12px 44px 12px 12px;
    }

    .captcha-wrapper img {
        max-height: 42px;
    }
}

@media (max-width: 360px) {
    .logo {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }

    .logo-section h1 {
        font-size: 20px;
    }

    .form-control {
        padding: 10px 36px 10px 10px;
        font-size: 12.5px;
    }

    .input-icon,
    .password-toggle {
        font-size: 13px;
    }

    .btn-primary {
        padding: 10px;
        font-size: 14px;
    }
}
