/* =========================================
   MudyHub Authentication Stylesheet (auth.css)
   Shared styles for Login, Signup, Reset,
   Admin Login, and Logout pages.
   ========================================= */

:root {
    --auth-bg: #0a0a0c;
    --auth-card-bg: #141418;
    --auth-border: #222228;
    --auth-accent: #ffd700;
    --auth-accent-dark: #e6c200;
    --auth-text-muted: #888888;
    --auth-text-light: #ededed;
    --auth-error: #ff4d4d;
    --auth-success: #00c853;
    --auth-warn: #ffb020;
}

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

body.auth-page {
    background-color: var(--auth-bg);
    color: var(--auth-text-light);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
}

/* --- Auth Card --- */
.auth-card {
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
    position: relative;
}

.auth-card.signup-card {
    max-width: 480px;
    padding: 32px 28px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
.auth-header {
    text-align: center;
    margin-bottom: 26px;
}
.auth-header h2 {
    color: #ffffff;
    font-size: 23px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.auth-header p {
    color: var(--auth-text-muted);
    font-size: 13.5px;
}

/* --- Form Inputs --- */
.input-group {
    margin-bottom: 18px;
}
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-muted);
}
.input-group input,
.input-group select {
    width: 100%;
    padding: 13px 16px;
    background: #1a1a1f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.input-group input::placeholder {
    color: #555;
}
.input-group input:focus,
.input-group select:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

/* Input wrapper (for valid icon and password toggle) */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper input {
    padding-right: 44px;
}
.input-wrapper .input-icon {
    position: absolute;
    right: 14px;
    font-size: 14px;
    color: var(--auth-success);
    pointer-events: none;
}
.input-wrapper .input-icon.hidden { display: none; }

.password-toggle {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.15s;
    line-height: 1;
}
.password-toggle:hover { color: var(--auth-accent); }

/* Inline hints (below fields) */
.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--auth-text-muted);
    line-height: 1.4;
    min-height: 15px;
}
.input-hint.error { color: var(--auth-error); }
.input-hint.success { color: var(--auth-success); }

/* Phone input group */
.phone-input-group {
    display: flex;
    gap: 8px;
}
.phone-input-group select {
    width: 130px;
    flex-shrink: 0;
}
.phone-input-group input {
    flex: 1;
}

/* --- Password strength meter --- */
.strength-meter {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.strength-bar {
    flex: 1;
    height: 4px;
    background: #262626;
    border-radius: 2px;
    overflow: hidden;
}
.strength-fill {
    height: 100%;
    width: 0%;
    background: var(--auth-error);
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
}
.strength-fill.weak { width: 25%; background: var(--auth-error); }
.strength-fill.fair { width: 50%; background: var(--auth-warn); }
.strength-fill.good { width: 75%; background: #4ade80; }
.strength-fill.strong { width: 100%; background: var(--auth-success); }

.strength-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--auth-text-muted);
    min-width: 70px;
    text-align: right;
}

/* Password rules checklist */
.password-rules {
    list-style: none;
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}
.password-rules li {
    font-size: 11px;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
    line-height: 1.6;
}
.password-rules li.met {
    color: var(--auth-success);
}
.password-rules li .rule-dot {
    display: inline-block;
    width: 14px;
    text-align: center;
    font-size: 10px;
}
.password-rules li.met .rule-dot {
    content: "●";
}

/* --- Buttons --- */
.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, opacity 0.2s;
    text-decoration: none;
}
.btn-gold {
    background-color: var(--auth-accent);
    color: #0a0a0c;
}
.btn-gold:hover:not(:disabled) {
    background-color: var(--auth-accent-dark);
}
.btn-gold:active:not(:disabled) {
    transform: scale(0.98);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--auth-text-light);
    border: 1px solid var(--auth-border);
}
.btn-ghost:hover:not(:disabled) {
    border-color: var(--auth-accent);
    color: var(--auth-accent);
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.button-row .btn { flex: 1; }
.button-row .btn-ghost { flex: 0 0 auto; padding: 14px 20px; }

/* --- Loading Spinner --- */
.loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #0a0a0c;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 0.8s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
}
.alert.hidden { display: none; }
.alert.error {
    display: block;
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--auth-error);
}
.alert.success {
    display: block;
    background: rgba(0, 200, 83, 0.1);
    border: 1px solid rgba(0, 200, 83, 0.3);
    color: var(--auth-success);
}
.alert.info {
    display: block;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    color: var(--auth-accent);
}

/* --- Footer Links --- */
.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--auth-text-muted);
    margin-top: 20px;
}
.auth-footer a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 500;
}
.auth-footer a:hover {
    text-decoration: underline;
}

/* --- Logout Specific --- */
.logout-container {
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}
.logout-container .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.1);
    border-top-color: var(--auth-accent);
    border-radius: 50%;
    animation: rotation 0.8s linear infinite;
    margin: 0 auto 20px;
}
.logout-container h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.logout-container p {
    font-size: 0.9rem;
    color: var(--auth-text-muted);
}

/* =========================================
   SIGNUP PROGRESS INDICATOR
   ========================================= */
.signup-progress {
    margin-bottom: 28px;
}
.progress-bar-track {
    height: 3px;
    background: #262626;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 16px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--auth-accent), var(--auth-accent-dark));
    border-radius: 2px;
    transition: width 0.4s ease;
}
.progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    transition: opacity 0.3s;
    opacity: 0.5;
}
.progress-step.active {
    opacity: 1;
}
.progress-step .step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #262626;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.3s, color 0.3s;
}
.progress-step.active .step-num {
    background: var(--auth-accent);
    color: #0a0a0c;
}
.progress-step.completed .step-num {
    background: var(--auth-success);
    color: #0a0a0c;
}
.progress-step .step-label {
    font-size: 11px;
    color: var(--auth-text-muted);
    font-weight: 600;
    letter-spacing: 0.2px;
}
.progress-step.active .step-label {
    color: var(--auth-accent);
}

/* =========================================
   MULTI-STEP FORMS
   ========================================= */
.signup-step {
    display: none;
    animation: fadeIn 0.3s ease-out;
}
.signup-step.active {
    display: block;
}

/* =========================================
   TRUST PANEL
   ========================================= */
.trust-panel {
    margin-top: 22px;
    padding: 16px;
    background: rgba(255, 215, 0, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.trust-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--auth-text-muted);
    line-height: 1.5;
}
.trust-item strong {
    color: var(--auth-text-light);
    font-weight: 600;
}
.trust-icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1.4;
}

/* =========================================
   EMAIL VERIFICATION SCREEN
   ========================================= */
.verify-wrap {
    text-align: center;
    padding: 10px 0;
}
.verify-icon {
    font-size: 64px;
    margin-bottom: 16px;
    line-height: 1;
}
.verify-wrap h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
}
.verify-sub {
    color: var(--auth-text-muted);
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 24px;
}
.verify-sub strong {
    color: var(--auth-accent);
    font-weight: 600;
    word-break: break-all;
}

.verify-instructions {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}
.verify-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--auth-text-muted);
    line-height: 1.5;
}
.verify-tip strong { color: var(--auth-text-light); }
.tip-num {
    width: 22px;
    height: 22px;
    background: rgba(255, 215, 0, 0.15);
    color: var(--auth-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.verify-help {
    margin-top: 18px;
    font-size: 11.5px;
    color: var(--auth-text-muted);
    line-height: 1.5;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 480px) {
    body.auth-page { padding: 12px; }
    .auth-card { padding: 28px 22px; }
    .auth-card.signup-card { padding: 24px 20px; }
    .auth-header h2 { font-size: 20px; }
    .progress-step .step-label { font-size: 10px; }
    .password-rules { gap: 2px 8px; }
    .button-row .btn-ghost { padding: 14px 14px; font-size: 13px; }
}

/* Accessibility refinements shared by authentication pages. */
.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page input:focus-visible,
.auth-page select:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .auth-card, .logout-container, .loader, .logout-container .spinner {
        animation: none !important;
        transition: none !important;
    }
}
