/* ==========================================================================
   MadaPower - Authentication Pages CSS
   أنماط صفحات المصادقة (تسجيل الدخول)
   ========================================================================== */

/* ===== Auth Page ===== */
.auth-page {
    min-height: calc(100vh - var(--header-height) - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(30, 58, 138, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.2) 0%, transparent 50%);
}

/* ===== Auth Card ===== */
.auth-card {
    background: var(--neu-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-neu);
    padding: 48px 44px;
    max-width: 480px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: auth-card-in 0.5s var(--transition-slow) both;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Auth Header ===== */
.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 22px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 32px -8px rgba(30, 58, 138, 0.45);
    animation: auth-icon-in 0.6s var(--transition-slow) 0.1s both;
}

@keyframes auth-icon-in {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-12deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.auth-icon .material-symbols-rounded {
    font-size: 42px;
    color: white;
}

/* Success icon (green) */
.auth-icon-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.4);
}

.auth-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--color-text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* ===== Auth Form ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.auth-form .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* ===== Auth Form Labels ===== */
.auth-form .form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.auth-form .form-label::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: var(--gradient-primary);
}

/* ===== Auth Form Inputs =====
   Specific overrides for the login form.
   These are larger, more readable, and more comfortable
   than the generic .form-input style used elsewhere.
   Both username and password inputs share identical sizing
   for visual consistency. */
.auth-form .form-input {
    width: 100%;
    height: 54px;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.4;
    border: none;
    border-radius: var(--radius-md);
    background: var(--neu-bg);
    color: var(--color-text);
    transition: box-shadow var(--transition-fast),
                transform var(--transition-fast);
    box-shadow: var(--shadow-neu-inset);
    box-sizing: border-box;
}

.auth-form .form-input::placeholder {
    color: var(--color-text-muted);
    font-weight: 400;
    opacity: 0.85;
}

.auth-form .form-input:focus {
    outline: none;
    box-shadow: var(--shadow-neu-inset),
                0 0 0 4px var(--color-primary-bg);
}

.auth-form .form-input:-webkit-autofill,
.auth-form .form-input:-webkit-autofill:hover,
.auth-form .form-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text);
    -webkit-box-shadow: var(--shadow-neu-inset),
                        0 0 0 4px var(--color-primary-bg);
    caret-color: var(--color-text);
    transition: background-color 5000s ease-in-out 0s;
}

/* Password input wrapper */
.password-wrapper {
    position: relative;
}

/* Password input: reserve room for the eye toggle button.
   The input width stays 100% (because box-sizing: border-box
   and the padding-inline-end is internal), so the username
   and password fields remain identical in outer width. */
.password-wrapper .form-input {
    padding-inline-end: 50px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 8px;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast),
                background var(--transition-fast);
}

.password-toggle:hover {
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.password-toggle .material-symbols-rounded {
    font-size: 22px;
}

/* ===== Auth Error ===== */
.auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 0.9rem;
}

.auth-error .material-symbols-rounded {
    font-size: 20px;
    flex-shrink: 0;
}

/* ===== Auth Submit ===== */
.auth-submit {
    margin-top: 12px;
    height: 54px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    gap: 8px;
}

.auth-submit .material-symbols-rounded {
    font-size: 22px;
}

/* ===== Auth Info ===== */
.auth-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 24px;
    padding: 16px;
    background: var(--color-primary-bg);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.auth-info .material-symbols-rounded {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-info p {
    margin: 0;
}

/* ===== Auth Footer ===== */
.auth-footer {
    margin-top: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .auth-page {
        padding: 32px 0;
    }

    .auth-card {
        padding: 36px 24px;
        margin: 0 12px;
        border-radius: var(--radius-lg);
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.9rem;
    }

    .auth-icon {
        width: 68px;
        height: 68px;
        margin-bottom: 18px;
    }

    .auth-icon .material-symbols-rounded {
        font-size: 34px;
    }

    /* Slightly shorter inputs on very small screens,
       but keep them tall enough for comfortable typing */
    .auth-form .form-input,
    .auth-submit {
        height: 50px;
        font-size: 1rem;
    }

    .auth-form {
        gap: 18px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 28px 18px;
        margin: 0 8px;
    }

    .auth-form .form-input {
        padding-inline-start: 14px;
        padding-inline-end: 14px;
    }

    .password-wrapper .form-input {
        padding-inline-end: 46px;
    }
}

/* ===== Logged Out Message ===== */
.logged-out-banner {
    background: var(--color-success);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logged-out-banner .material-symbols-rounded {
    font-size: 24px;
}

/* ===== Access Denied Page ===== */
.access-denied {
    text-align: center;
    padding: 80px 24px;
}

.access-denied .material-symbols-rounded {
    font-size: 80px;
    color: var(--color-warning);
    margin-bottom: 20px;
}

.access-denied h2 {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.access-denied p {
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    max-width: 500px;
    margin-inline: auto;
}

/* ===== Mail badge (different color from cart) ===== */
.badge-mail {
    background: var(--color-energy) !important;
}

/* ===== Logout Form (POST required by Django 5.0+) ===== */
.logout-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.nav-mobile-logout-form {
    display: block;
    margin: 0;
    padding: 0;
}

.nav-mobile-logout-form button {
    width: 100%;
    text-align: start;
    cursor: pointer;
}

/* ===== Admin Actions (Edit/Delete buttons) ===== */
.admin-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

/* ===== Error Button ===== */
.btn-error {
    background: var(--color-error);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-error:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* ===== User Name in Header ===== */
.user-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .user-name {
        display: none;
    }
}

/* ===== Disabled nav link ===== */
.nav-mobile-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Login/Logout mobile styles ===== */
.nav-mobile-login {
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: 700;
}

.nav-mobile-logout {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    font-weight: 700;
}

/* ===== Three columns form row ===== */
.form-row.three-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-direction: column;
    }

    .admin-actions .btn {
        width: 100%;
    }
}
