/* ============================================================
   Auth Pages Stylesheet — Login / Register
   AgencySync Design System
   ============================================================ */

@import url('variables.css');

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

/* Fix: CSS class rules override the native [hidden] attribute.
   This ensures hidden elements are ALWAYS hidden regardless of
   whatever display: flex/grid/etc a class assigns. */
[hidden] {
    display: none !important;
}

body, html {
    height: 100%;
}

.auth-body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Container ── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-8);
    box-shadow: var(--shadow-lg);
}

/* ── Header ── */
.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-logo {
    display: inline-flex;
    margin-bottom: var(--space-3);
}

.auth-brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.auth-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.5px;
    margin-bottom: var(--space-1);
}

.auth-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    padding-left: var(--space-1);
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--fill-quaternary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    -webkit-appearance: none;
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:hover {
    background: var(--fill-tertiary);
}

.form-input:focus {
    border-color: var(--brand-primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.form-input.error {
    border-color: var(--color-red);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

/* ── Error Display ── */
.form-error {
    font-size: var(--text-sm);
    color: var(--color-red);
    min-height: 0;
    overflow: hidden;
    transition: min-height var(--transition-fast);
}

.form-error:not(:empty) {
    min-height: 20px;
    padding: var(--space-1) 0;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: 0 var(--space-6);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--btn-bg, var(--brand-primary));
    color: var(--text-on-brand);
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    filter: brightness(0.95);
    transform: translateY(0);
}

.btn-full {
    width: 100%;
}

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

.btn-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: inherit;
    border-radius: inherit;
}

/* ── Spinner ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── Alert ── */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.alert-error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--color-red);
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-green);
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.auth-footer p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.auth-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: var(--weight-semibold);
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-link-subtle {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
}

.auth-link-subtle:hover {
    color: var(--brand-primary);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .auth-card {
        padding: var(--space-8) var(--space-5);
        border-radius: var(--radius-lg);
        box-shadow: none;
        background: transparent;
    }

    .auth-title {
        font-size: var(--text-xl);
    }
}
