/* ===== Design Tokens ===== */
:root {
    --bg-primary: #1d2d67;
    --bg-deep: #15214d;
    --gold: #d4ac51;
    --gold-soft: rgba(212, 172, 81, 0.15);
    --gold-bright: #e8c878;
    --text-light: #f5f7ff;
    --text-muted: #a8b1d6;
    --white: #ffffff;
    --error: #ff6b6b;
    --radius: 14px;
    --shadow-premium: 0 20px 60px rgba(0, 0, 0, 0.45);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(212, 172, 81, 0.08), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(212, 172, 81, 0.06), transparent 45%),
        linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-deep) 100%);
    background-attachment: fixed;
}

/* ===== Layout ===== */
.login-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid var(--gold);
    border-radius: var(--radius);
    padding: 44px 36px 36px;
    box-shadow: var(--shadow-premium);
    position: relative;
}

/* Subtle gold top sheen */
.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}

/* ===== Logo ===== */
.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 50%;         /* circle */
    padding: 12px;
    background: #ffffff;        /* white fill behind the logo */
    border: 2px solid var(--gold);
    box-shadow: 0 0 30px rgba(212, 172, 81, 0.25);
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 45px rgba(212, 172, 81, 0.45);
}

/* ===== Headings ===== */
.login-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--white);
    letter-spacing: 0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 6px;
    margin-bottom: 30px;
}

/* ===== Form ===== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gold-bright);
    margin-bottom: 8px;
    letter-spacing: 0.4px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--gold);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(212, 172, 81, 0.4);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.input-wrapper input:focus {
    border-color: var(--gold);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--gold-bright);
}

/* Password toggle */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gold);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: var(--transition);
}

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

.toggle-password svg {
    width: 18px;
    height: 18px;
}

/* Error states */
.error-msg {
    font-size: 0.78rem;
    color: var(--error);
    margin-top: 6px;
    min-height: 16px;
    opacity: 0;
    transition: var(--transition);
}

.form-group.invalid .error-msg {
    opacity: 1;
}

.form-group.invalid .input-wrapper input {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}

/* ===== Options ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.remember input {
    accent-color: var(--gold);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== Submit Button ===== */
.btn-login {
    position: relative;
    width: 100%;
    padding: 15px;
    margin-top: 6px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-bright) 100%);
    color: var(--bg-deep);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    text-transform: uppercase;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(212, 172, 81, 0.35);
}

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

.btn-login:disabled {
    cursor: not-allowed;
    opacity: 0.75;
    transform: none;
}

.btn-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(29, 45, 103, 0.3);
    border-top-color: var(--bg-deep);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-spinner {
    display: block;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== Help Section ===== */
.help-section {
    margin-top: 26px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(212, 172, 81, 0.2);
}

.help-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.help-text a {
    color: var(--gold-bright);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.help-text a:hover {
    border-bottom-color: var(--gold-bright);
}

/* ===== Footer ===== */
.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    opacity: 0.7;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: var(--bg-deep);
    border: 1.5px solid var(--gold);
    color: var(--text-light);
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-premium);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-width: 90%;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: var(--error);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px 28px;
    }

    .logo {
        width: 120px;
        height: 120px;
        padding: 10px;
    }

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

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}
