/* ==========================================================================
   FERRETERÍA ALVARADO - Página de inicio de sesión
   ========================================================================== */

:root {
    --a-primary: #f97316;
    --a-primary-600: #ea580c;
    --a-primary-700: #c2410c;
    --a-primary-800: #9a3412;
    --a-primary-light: #ffedd5;
    --a-dark: #111827;
    --a-text: #374151;
    --a-muted: #6b7280;
    --a-border: #e5e7eb;
    --a-bg: #f9fafb;
    --a-danger: #dc2626;
    --a-success: #16a34a;
    --a-radius: 12px;
    --a-shadow: 0 20px 45px -20px rgba(249, 115, 22, 0.45), 0 10px 25px -12px rgba(0, 0, 0, 0.2);
    --a-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

.auth-body {
    font-family: var(--a-font);
    background: var(--a-bg);
    color: var(--a-text);
    min-height: 100vh;
}

/* ---------------- Contenedor general ---------------- */
.auth-container {
    display: flex;
    min-height: 100vh;
}

/* ---------------- Panel de marca (izquierda) ---------------- */
.auth-brand-panel {
    position: relative;
    flex: 1 1 46%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem 2.5rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.14), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.1), transparent 45%),
        linear-gradient(150deg, var(--a-primary-600) 0%, var(--a-primary-700) 55%, var(--a-primary-800) 100%);
    color: #fff;
    overflow: hidden;
}

.auth-brand-panel::before {
    content: '';
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    top: -120px;
    right: -120px;
}

.auth-brand-panel::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    bottom: -80px;
    left: -60px;
}

.auth-brand-content { position: relative; z-index: 1; }

.auth-logo {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.auth-logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}

.auth-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--a-primary-600);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.auth-logo-fallback svg { width: 34px; height: 34px; }

.auth-brand-content h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.auth-brand-tagline {
    font-size: 1.02rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.88);
    max-width: 38ch;
    margin-bottom: 2.25rem;
}

.auth-features {
    list-style: none;
    display: grid;
    gap: 0.9rem;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
}

.auth-features svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.75);
}

.auth-brand-footer {
    position: relative;
    z-index: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ---------------- Panel del formulario (derecha) ---------------- */
.auth-form-panel {
    flex: 1 1 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
}

.auth-mobile-brand {
    display: none;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-mobile-brand .auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}

.auth-mobile-brand h1 {
    font-size: 1.3rem;
    color: var(--a-dark);
    font-weight: 800;
}

.auth-form-head { margin-bottom: 1.75rem; }

.auth-form-head h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--a-dark);
    letter-spacing: -0.3px;
}

.auth-form-head p {
    font-size: 0.95rem;
    color: var(--a-muted);
    margin-top: 0.35rem;
}

/* ---------------- Alertas ---------------- */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--a-danger);
    color: #991b1b;
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.4rem;
    line-height: 1.45;
}

.auth-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: var(--a-success);
    color: #166534;
}

/* ---------------- Formulario ---------------- */
.auth-field { margin-bottom: 1.25rem; }

.auth-field label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--a-dark);
    margin-bottom: 0.45rem;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.auth-input-wrap > svg {
    position: absolute;
    left: 0.95rem;
    width: 18px;
    height: 18px;
    color: var(--a-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.auth-input-wrap .form-control {
    width: 100%;
    padding: 0.8rem 0.95rem 0.8rem 2.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--a-dark);
    background: #fff;
    border: 1px solid var(--a-border);
    border-radius: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input-wrap .form-control::placeholder { color: #9ca3af; }

.auth-input-wrap .form-control:hover { border-color: #d1d5db; }

.auth-input-wrap .form-control:focus {
    outline: none;
    border-color: var(--a-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

.auth-input-wrap:focus-within > svg { color: var(--a-primary); }

.auth-toggle-pass {
    position: absolute;
    right: 0.55rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--a-muted);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

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

.auth-toggle-pass:hover { color: var(--a-primary); background: var(--a-primary-light); }

.auth-toggle-pass.hidden svg { display: block; }
.auth-toggle-pass.hidden svg.off { display: none; }

/* ---------------- Botón submit ---------------- */
.auth-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(90deg, var(--a-primary), var(--a-primary-600));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 8px 18px -8px rgba(249, 115, 22, 0.7);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
    margin-top: 0.5rem;
}

.auth-submit svg { width: 18px; height: 18px; transition: transform 0.2s ease; }

.auth-submit:hover {
    filter: brightness(1.05);
    box-shadow: 0 10px 22px -8px rgba(249, 115, 22, 0.8);
    transform: translateY(-1px);
}

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

.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.3);
}

.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ---------------- Pie ---------------- */
.auth-help {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--a-muted);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    .auth-brand-panel { display: none; }

    .auth-form-panel {
        flex: 1 1 100%;
        padding: 2rem 1.25rem;
    }

    .auth-mobile-brand { display: block; }

    .auth-form-head h2 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Selección de sucursal
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--a-primary-light), var(--a-bg));
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: var(--a-radius);
    box-shadow: 0 20px 45px -20px rgba(249, 115, 22, 0.4), 0 10px 25px -12px rgba(0, 0, 0, 0.15);
    padding: 2.25rem;
}

.auth-card .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--a-primary-600);
    font-weight: 700;
    margin-bottom: 1rem;
}

.auth-card .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--a-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo-fallback {
    font-weight: 800;
    color: var(--a-primary-700);
    font-size: 1rem;
    line-height: 1;
}

.sucursal-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sucursal-option {
    position: relative;
    cursor: pointer;
    display: block;
}

.sucursal-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sucursal-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 2px solid var(--a-border);
    border-radius: 12px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sucursal-card:hover { border-color: #d1d5db; }

.sucursal-option input:checked + .sucursal-card {
    border-color: var(--a-primary);
    background: var(--a-primary-light);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}

.sucursal-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--a-primary-light);
    color: var(--a-primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sucursal-icon svg { width: 20px; height: 20px; }

.sucursal-option input:checked + .sucursal-card .sucursal-icon {
    background: var(--a-primary);
    color: #fff;
}

.sucursal-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sucursal-name {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--a-dark);
}

.sucursal-address {
    font-size: 0.82rem;
    color: var(--a-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(90deg, var(--a-primary), var(--a-primary-600));
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(249, 115, 22, 0.7);
}

.btn-primary:hover { filter: brightness(1.05); color: #fff; }

.btn-outline {
    background: transparent;
    border-color: var(--a-border);
    color: var(--a-text);
}

.btn-outline:hover { background: var(--a-bg); color: var(--a-dark); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1.5rem; }

.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #dc2626;
}