/* ============================================
   Auth Pages - Login & Register
   Glassmorphism Premium Design
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px 16px;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.auth-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(13, 59, 46, 0.85) 0%,
        rgba(13, 59, 46, 0.7) 50%,
        rgba(201, 162, 39, 0.35) 100%
    );
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
}

.auth-container.register-wide {
    max-width: 420px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: authFadeIn 0.7s ease;
}

.auth-card-modern {
    padding: 32px 28px 28px;
}

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

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo img,
.auth-logo-img {
    width: min(260px, 85%);
    height: auto;
    max-width: 280px;
    border-radius: 16px;
    border: none;
    object-fit: contain;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 14px;
}

.auth-logo h1 {
    color: var(--white);
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.auth-logo h1 span { color: var(--gold-light); }

.auth-logo p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 10px 0 0;
}

.auth-submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    font-size: 1rem;
    padding: 15px 24px;
    letter-spacing: 0.2px;
}

.auth-card .form-group-premium label {
    color: rgba(255, 255, 255, 0.9);
}

.auth-card .form-group-premium .form-control {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.auth-card .form-group-premium .form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.auth-card .form-group-premium .form-control:focus {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--gold);
    color: var(--white);
}

.password-toggle-wrap {
    position: relative;
}

.password-toggle-wrap .form-control {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--gold-light);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-options .form-check-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.auth-options .form-check-input {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-options .form-check-input:checked {
    background-color: var(--gold);
    border-color: var(--gold);
}

.auth-options a {
    color: var(--gold-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-options a:hover {
    color: var(--gold);
    text-decoration: underline;
}

.auth-card .btn-premium {
    width: 100%;
    justify-content: center;
    padding: 15px 32px;
    font-size: 1.05rem;
}

.auth-footer-link {
    text-align: center;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.auth-footer-link a {
    color: var(--gold-light);
    font-weight: 600;
}

.auth-footer-link a:hover {
    color: var(--gold);
    text-decoration: underline;
}

.auth-back-home {
    text-align: center;
    margin-top: 20px;
}

.auth-back-home a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-back-home a:hover {
    color: var(--gold-light);
}

.field-error {
    color: #ff8a8a;
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
}

.field-error.show {
    display: block;
}

.form-control.is-invalid {
    border-color: #ff6b6b !important;
}

.form-control.is-valid {
    border-color: #4ade80 !important;
}

/* Success Animation */
.success-animation {
    text-align: center;
    padding: 40px 20px;
    display: none;
}

.success-animation.show {
    display: block;
    animation: authFadeIn 0.5s ease;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--gold), var(--gold-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--green-dark);
    animation: scaleIn 0.5s ease;
    box-shadow: 0 0 40px rgba(201, 162, 39, 0.5);
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.success-animation h3 {
    color: var(--white);
    margin-bottom: 8px;
}

.success-animation p {
    color: rgba(255, 255, 255, 0.75);
}

#authAlert {
    display: none;
    margin-bottom: 20px;
}

#authAlert.show {
    display: block;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========== MODERN AUTH POPUP ========== */
.auth-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-popup.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: flex !important;
}

.auth-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 31, 24, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-popup-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    max-height: min(92svh, 92vh);
    overflow-y: auto;
    background: linear-gradient(160deg, #ffffff 0%, #f7faf7 55%, #fef9e7 100%);
    border-radius: clamp(16px, 4vw, 24px);
    padding: clamp(20px, 5vw, 36px) clamp(14px, 4vw, 28px) clamp(18px, 4vw, 28px);
    text-align: center;
    margin: auto;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(201, 162, 39, 0.25);
    transform: translateY(28px) scale(0.92);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-popup.show .auth-popup-card {
    transform: translateY(0) scale(1);
}

.auth-popup-icon {
    width: clamp(56px, 14vw, 76px);
    height: clamp(56px, 14vw, 76px);
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.4rem, 4vw, 2rem);
    color: #0d3b2e;
    background: linear-gradient(145deg, #e8c547, #c9a227);
    box-shadow: 0 10px 30px rgba(201, 162, 39, 0.45);
    animation: popupPulse 1.6s ease-in-out infinite;
}

.auth-popup-icon.welcome {
    background: linear-gradient(145deg, #2d8a68, #0d3b2e);
    color: #e8c547;
}

@keyframes popupPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(201, 162, 39, 0.45); }
    50% { transform: scale(1.06); box-shadow: 0 14px 40px rgba(201, 162, 39, 0.6); }
}

.auth-popup-logo {
    width: min(200px, 72%);
    height: auto;
    margin: 0 auto 14px;
    display: block;
    border-radius: 12px;
    background: #fff;
    padding: 6px 10px;
    box-shadow: 0 6px 18px rgba(13, 59, 46, 0.12);
}

.auth-popup-title {
    font-family: 'Playfair Display', Georgia, serif;
    color: #0d3b2e;
    font-size: clamp(1.2rem, 4.5vw, 1.55rem);
    margin: 0 0 10px;
    padding: 0 4px;
}

.auth-popup-text {
    color: #3d524a;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.6;
    margin: 0 0 14px;
    padding: 0 2px;
    word-break: break-word;
}

.auth-popup-text strong {
    color: #0d3b2e;
    font-weight: 700;
}

.auth-popup-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0d3b2e, #1a5c45);
    color: #e8c547;
    font-size: clamp(0.75rem, 3vw, 0.85rem);
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 50px;
    margin-bottom: 12px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    max-width: 100%;
    flex-wrap: wrap;
}

.auth-popup-note {
    margin: 0 0 16px;
    color: #7a8f86;
    font-size: clamp(0.8rem, 3vw, 0.88rem);
}

.auth-popup-note::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: #c9a227;
    animation: popupDot 1s ease-in-out infinite;
    vertical-align: middle;
}

.auth-popup-close-btn {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
    font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
    padding: 12px 18px !important;
}

@keyframes popupDot {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 24px 16px;
        border-radius: 18px;
    }

    .auth-row {
        grid-template-columns: 1fr;
    }

    .auth-page {
        background-attachment: scroll;
        padding: 20px 10px;
        min-height: 100svh;
    }

    .auth-logo-img {
        width: min(200px, 88%);
        padding: 6px 10px;
    }

    .auth-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-submit-btn {
        font-size: 0.92rem !important;
        padding: 13px 16px !important;
        white-space: normal;
        line-height: 1.3;
    }

    .auth-popup {
        padding: 10px;
        align-items: flex-end;
    }

    .auth-popup-card {
        width: 100%;
        border-radius: 20px 20px 16px 16px;
        padding: 22px 16px 18px;
        max-height: 88svh;
    }

    .auth-popup-logo {
        width: min(170px, 65%);
    }
}

@media (max-width: 380px) {
    .auth-popup-title {
        font-size: 1.1rem;
    }

    .auth-popup-text {
        font-size: 0.88rem;
    }

    .auth-popup-badge {
        font-size: 0.72rem;
        padding: 7px 10px;
    }

    .auth-logo-img {
        width: min(170px, 90%);
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .auth-popup {
        align-items: flex-start;
        padding: 8px;
    }

    .auth-popup-card {
        padding: 14px 16px;
        max-height: 96vh;
    }

    .auth-popup-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .auth-popup-logo {
        width: min(140px, 40%);
        margin-bottom: 8px;
    }

    .auth-popup-title {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .auth-popup-text {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .auth-popup-note {
        margin-bottom: 10px;
    }
}
