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

:root {
    --auth-primary: #c1272d;
    --auth-primary-dark: #9b1f24;
    --auth-secondary: #4d4d4d;
    --auth-surface: #ffffff;
    --auth-text: #1a1d26;
    --auth-muted: #6b7280;
    --auth-border: #e5e7eb;
    --auth-radius: 14px;
    --auth-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f8;
    color: var(--auth-text);
    min-height: 100vh;
    line-height: 1.5;
}

.auth-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* Brand panel (left) — light surface so the dark logo reads clearly */
.auth-brand {
    background: #ffffff;
    color: var(--auth-text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--auth-border);
}

.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(193, 39, 45, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(15, 23, 42, 0.04) 0%, transparent 40%);
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 400px;
}

.brand-logo-img {
    width: 100%;
    max-width: 320px;
    height: auto;
    margin-bottom: 1.5rem;
    display: block;
    object-fit: contain;
}

.brand-tagline {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    color: var(--auth-text);
    font-weight: 500;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(0.875rem, 1.5vw, 0.95rem);
    color: var(--auth-text);
}

.brand-features i {
    color: var(--auth-primary);
    font-size: 0.95rem;
}

/* Main / form panel (right) — dark surface, white card sits on top */
.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: #0d0d0d;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(193, 39, 45, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.auth-main > * {
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-surface);
    border-radius: var(--auth-radius);
    padding: clamp(1.75rem, 4vw, 2.5rem);
    box-shadow: var(--auth-shadow);
    border: 1px solid var(--auth-border);
    animation: cardIn 0.5s ease-out;
}

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

.card-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.card-logo-mobile {
    display: none;
    width: auto;
    max-width: 200px;
    height: auto;
    max-height: 48px;
    margin: 0 auto 1rem;
    object-fit: contain;
}

.card-header h2 {
    font-size: clamp(1.35rem, 3vw, 1.6rem);
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.card-header p {
    font-size: clamp(0.875rem, 2vw, 0.95rem);
    color: var(--auth-muted);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 0.4rem;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--auth-muted);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1.5px solid var(--auth-border);
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--auth-text);
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input::placeholder {
    color: #9ca3af;
}

.form-group input:focus {
    outline: none;
    border-color: var(--auth-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(193, 39, 45, 0.15);
}

.show-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--auth-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: color 0.2s;
}

.show-password:hover {
    color: var(--auth-primary);
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(193, 39, 45, 0.35);
}

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

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

.btn-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

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

.hidden {
    display: none !important;
}

.error-message {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: #fef2f2;
    border-radius: 10px;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: #b91c1c;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.error-message i {
    flex-shrink: 0;
}

.credentials-hint {
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--auth-muted);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.credentials-hint i {
    color: var(--auth-primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.credentials-hint strong {
    color: var(--auth-text);
    font-weight: 600;
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
}

.auth-footer p { margin: 0.1rem 0; }

.auth-footer .dev-credit {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

.auth-footer .version {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Responsive */
@media (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .card-logo-mobile {
        display: flex;
    }

    .auth-main {
        min-height: 100vh;
        justify-content: center;
        background: #f8f9fc;
        color: var(--auth-text);
    }
    .auth-main::before { display: none; }
    .auth-footer { color: var(--auth-muted); }
    .auth-footer .dev-credit,
    .auth-footer .version { color: var(--auth-muted); }
}

@media (max-width: 640px) {
    .login-card {
        padding: 1.75rem 1.5rem;
        border-radius: 14px;
    }
    .auth-main {
        padding: 1rem;
    }
    .auth-footer { font-size: 0.75rem; }
    .auth-footer .version { font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.4rem 1.15rem;
        box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    }
    .auth-main {
        padding: 0.75rem;
    }
    .card-logo-mobile {
        max-height: 44px;
        width: auto;
    }
    .login-card .form-group input,
    .login-card .form-group select,
    .login-card .form-group textarea {
        font-size: 16px; /* prevents iOS auto-zoom on focus */
    }
}
