/* ==========================================================================
   GymSaaS Dark Login Styling - Matches Visual Reference
   ========================================================================== */

:root {
    --bg-main: #070a13;
    --card-bg: #111726;
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: #182030;
    --input-border: #232e42;
    --input-focus: #22c55e;
    --text-primary: #ffffff;
    --text-secondary: #8896ab;
    --text-muted: #4e5d78;
    --accent-green: #22c55e;
    --accent-green-hover: #16a34a;
    --accent-glow: rgba(34, 197, 94, 0.35);
    --error-bg: rgba(239, 68, 68, 0.12);
    --error-border: rgba(239, 68, 68, 0.35);
    --error-text: #fca5a5;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body.app-body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(140px);
}

.glow-top-left {
    top: -120px;
    left: -100px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
}

.glow-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.07) 0%, rgba(30, 58, 138, 0.06) 50%, transparent 70%);
}

/* Page Layout Wrapper */
.login-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px 36px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-green);
    color: #070a13;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Header Actions / Pills */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #101625;
    border: 1px solid var(--card-border);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 9999px;
    cursor: default;
    transition: all 0.2s ease;
}

.lang-btn {
    cursor: pointer;
}

.lang-btn:hover {
    background: #172033;
    border-color: rgba(255, 255, 255, 0.15);
}

.lang-flag {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
}

.version-pill {
    color: #64748b;
}

/* Main Content Area */
.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
}

/* Login Card */
.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 40px 34px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7),
                0 0 60px -20px rgba(16, 185, 129, 0.08);
}

.card-header {
    text-align: center;
    margin-bottom: 28px;
}

.card-title {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Form Groups & Inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 7px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}

.char-counter {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.input-wrapper.has-error {
    border-color: #ef4444;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.form-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: var(--font-sans);
    padding: 13px 14px 13px 44px;
}

.form-input::placeholder {
    color: #475569;
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.toggle-password-btn:hover {
    color: #cbd5e1;
}

.field-error {
    display: block;
    font-size: 0.76rem;
    color: #f87171;
    margin-top: 5px;
}

/* Options Row */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    margin-bottom: 24px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

.checkbox-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.forgot-link {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--accent-green);
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.forgot-link:hover {
    color: #4ade80;
    text-decoration: underline;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: var(--accent-green);
    color: #042f1a;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
}

.submit-btn:hover {
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.45);
    transform: translateY(-1px);
}

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

/* Alert Error Banner */
.alert-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--error-text);
    font-size: 0.85rem;
    margin-bottom: 20px;
    animation: fadeIn 0.25s ease-in-out;
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Spinner / Loading state */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(4, 47, 26, 0.3);
    border-top-color: #042f1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.htmx-request .spinner {
    display: inline-block;
}

.htmx-request .btn-text {
    opacity: 0.8;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Footer */
.app-footer {
    text-align: center;
    padding-top: 20px;
}

.app-footer p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .login-wrapper {
        padding: 16px 20px;
    }
    .login-card {
        padding: 30px 22px;
        border-radius: 16px;
    }
    .brand-subtitle {
        display: none;
    }
}
