/* ============================================
   LOGIN PAGE - Diseño Moderno
   Usa variables de theme-variables.css
   ============================================ */

/* ---- Reset y base ---- */
.login-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* ---- Layout principal: dos paneles ---- */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ============================================
   PANEL IZQUIERDO - Hero con imagen
   ============================================ */
.login-hero {
    flex: 1 1 55%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 20s ease;
}

.login-hero:hover .login-hero-bg {
    transform: scale(1.05);
}

.login-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(12, 184, 144, 0.45) 0%,
        rgba(10, 154, 122, 0.50) 50%,
        rgba(25, 25, 25, 0.55) 100%);
    z-index: 1;
}

.login-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 3rem;
    max-width: 480px;
    animation: heroFadeIn 0.8s ease-out;
}

.login-hero-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.5rem;
}

.login-hero-badge i {
    font-size: 2rem;
    color: #ffffff;
}

.login-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.login-hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-weight: 300;
}

.login-hero-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.login-hero-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 400;
    min-width: 220px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.login-hero-feature:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(4px);
}

.login-hero-feature i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ============================================
   PANEL DERECHO - Formulario
   ============================================ */
.login-form-panel {
    flex: 0 0 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: var(--bg-secondary);
    position: relative;
}

.login-form-container {
    width: 100%;
    max-width: 420px;
    animation: formSlideIn 0.6s ease-out;
}

/* ---- Logo ---- */
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    width: 130px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.login-logo img:hover {
    transform: scale(1.05);
}

/* ---- Encabezado ---- */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-weight: 400;
}

/* ---- Campos del formulario ---- */
.login-field {
    margin-bottom: 1.25rem;
}

.login-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    z-index: 2;
    pointer-events: none;
    transition: color 0.3s ease;
}

.login-input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 44px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(12, 184, 144, 0.15);
    background-color: var(--bg-secondary);
}

.login-input:focus ~ .login-input-icon,
.login-input:focus + .login-input-icon {
    color: var(--accent);
}

/* Focus: el icono cambia de color (selector hermano previo no existe, usamos JS o wrapper) */
.login-input-wrapper:focus-within .login-input-icon {
    color: var(--accent);
}

.login-input.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.login-input.is-invalid ~ .login-input-icon,
.login-input-wrapper:has(.is-invalid) .login-input-icon {
    color: #dc3545;
}

/* ---- Toggle contraseña ---- */
.login-toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    z-index: 2;
    transition: color 0.3s ease;
    line-height: 1;
}

.login-toggle-password:hover {
    color: var(--accent);
}

/* ---- Error de campo ---- */
.login-field-error {
    display: block;
    font-size: 0.8125rem;
    color: #dc3545;
    margin-top: 0.375rem;
    padding-left: 2px;
}

/* ---- Acciones (olvidó contraseña) ---- */
.login-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.login-forgot {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.login-forgot:hover {
    color: var(--accent-dark);
    text-decoration: none;
    opacity: 0.85;
}

.login-forgot i {
    font-size: 0.8rem;
}

/* ---- Botón submit ---- */
.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(12, 184, 144, 0.35);
}

.login-submit:hover:not(:disabled)::before {
    opacity: 1;
}

.login-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(12, 184, 144, 0.25);
}

.login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-submit.is-loading {
    pointer-events: none;
}

.login-submit-text,
.login-submit-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---- Spinner ---- */
.login-spinner {
    animation: loginSpin 0.8s linear infinite;
}

/* ---- Alerta de error ---- */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 12px;
    background-color: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.2);
    animation: alertShake 0.4s ease;
}

.login-alert-icon {
    flex-shrink: 0;
    color: #dc3545;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 1px;
}

.login-alert-content {
    flex: 1;
    min-width: 0;
}

.login-alert-content strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: 0.25rem;
}

.login-alert-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

.login-alert-message ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.login-alert-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color 0.3s ease;
    line-height: 1;
}

.login-alert-close:hover {
    color: #dc3545;
}

/* ---- Mensaje de éxito (Recuperar contraseña) ---- */
.login-success-message {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    background-color: rgba(12, 184, 144, 0.08);
    border: 1px solid rgba(12, 184, 144, 0.2);
}

.login-success-icon {
    margin-bottom: 0.75rem;
}

.login-success-icon i {
    font-size: 2.5rem;
    color: var(--accent);
}

.login-success-message p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

[data-theme="dark"] .login-success-message {
    background-color: rgba(12, 184, 144, 0.1);
    border-color: rgba(12, 184, 144, 0.25);
}

/* ---- Badge de usuario autenticado (Selección PV) ---- */
.login-user-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    margin: 0 auto 1.5rem;
    width: fit-content;
    border-radius: 50px;
    background-color: rgba(12, 184, 144, 0.08);
    border: 1px solid rgba(12, 184, 144, 0.2);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.login-user-badge i {
    color: var(--accent);
    font-size: 1.15rem;
}

[data-theme="dark"] .login-user-badge {
    background-color: rgba(12, 184, 144, 0.12);
    border-color: rgba(12, 184, 144, 0.25);
}

/* ---- Botón cerrar sesión ---- */
.login-logout-section {
    margin-top: 1.25rem;
}

.login-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 44px;
    border: 2px solid #dc3545;
    border-radius: 12px;
    background: transparent;
    color: #dc3545;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.login-logout-btn:hover {
    background-color: #dc3545;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.login-logout-btn:active {
    transform: translateY(0);
}

[data-theme="dark"] .login-logout-btn {
    border-color: #e05565;
    color: #e05565;
}

[data-theme="dark"] .login-logout-btn:hover {
    background-color: #e05565;
    color: #ffffff;
}

/* ---- Footer ---- */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.login-footer p {
    margin-bottom: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.login-footer a:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* ============================================
   SELECCIÓN DE PUNTO DE VENTA
   ============================================ */

.pv-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.pv-card {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.pv-card:hover {
    border-color: var(--accent);
    background-color: rgba(12, 184, 144, 0.04);
    box-shadow: 0 4px 12px rgba(12, 184, 144, 0.1);
    transform: translateY(-1px);
}

.pv-card:active {
    transform: translateY(0);
    box-shadow: none;
}

.pv-card:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pv-card.is-loading {
    pointer-events: none;
}

.pv-card-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pv-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: rgba(12, 184, 144, 0.1);
    flex-shrink: 0;
}

.pv-card-icon i {
    font-size: 1.25rem;
    color: var(--accent);
}

.pv-card-name {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pv-card-arrow {
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.pv-card:hover .pv-card-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

.pv-card-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 3.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pv-card-detail i {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Estado vacío */
.pv-empty {
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    background-color: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.pv-empty-icon {
    margin-bottom: 0.75rem;
}

.pv-empty-icon i {
    font-size: 2rem;
    color: #ffc107;
}

.pv-empty p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Dark mode PV */
[data-theme="dark"] .pv-card {
    background-color: var(--bg-tertiary);
    border-color: var(--border);
}

[data-theme="dark"] .pv-card:hover {
    border-color: var(--accent);
    background-color: rgba(12, 184, 144, 0.06);
}

[data-theme="dark"] .pv-card-icon {
    background-color: rgba(12, 184, 144, 0.15);
}

[data-theme="dark"] .pv-empty {
    background-color: rgba(255, 193, 7, 0.08);
    border-color: rgba(255, 193, 7, 0.2);
}

/* ============================================
   DARK MODE - Ajustes específicos
   ============================================ */

[data-theme="dark"] .login-hero-overlay {
    background: linear-gradient(135deg,
        rgba(12, 184, 144, 0.45) 0%,
        rgba(10, 154, 122, 0.50) 40%,
        rgba(25, 25, 25, 0.75) 100%);
}

[data-theme="dark"] .login-form-panel {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .login-input {
    background-color: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .login-input:focus {
    background-color: var(--bg-primary);
    border-color: var(--accent);
}

[data-theme="dark"] .login-logo img {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3)) brightness(0) invert(1);
}

[data-theme="dark"] .login-alert {
    background-color: rgba(220, 53, 69, 0.12);
    border-color: rgba(220, 53, 69, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet landscape */
@media (max-width: 1200px) {
    .login-hero {
        flex: 1 1 50%;
    }

    .login-form-panel {
        flex: 0 0 50%;
    }
}

/* Tablet portrait */
@media (max-width: 992px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-hero {
        flex: 0 0 auto;
        min-height: 280px;
        max-height: 320px;
    }

    .login-hero-content {
        padding: 2rem;
    }

    .login-hero-title {
        font-size: 1.75rem;
    }

    .login-hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .login-hero-features {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .login-hero-feature {
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .login-form-panel {
        flex: 1 1 auto;
        padding: 2rem 1.5rem;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .login-hero {
        min-height: 200px;
        max-height: 240px;
    }

    .login-hero-badge {
        width: 56px;
        height: 56px;
        border-radius: 16px;
        margin-bottom: 1rem;
    }

    .login-hero-badge i {
        font-size: 1.5rem;
    }

    .login-hero-title {
        font-size: 1.5rem;
    }

    .login-hero-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }

    .login-hero-features {
        gap: 0.5rem;
    }

    .login-hero-feature {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        border-radius: 8px;
    }

    .login-form-panel {
        padding: 1.5rem 1rem;
    }

    .login-form-container {
        max-width: 100%;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-input {
        height: 44px;
        font-size: 0.875rem;
    }

    .login-submit {
        height: 44px;
        font-size: 0.9375rem;
    }

    .login-logo img {
        width: 100px;
    }
}

/* Mobile small */
@media (max-width: 375px) {
    .login-hero {
        min-height: 160px;
        max-height: 200px;
    }

    .login-hero-features {
        display: none;
    }

    .login-form-panel {
        padding: 1rem 0.75rem;
    }
}

/* ============================================
   ANIMACIONES
   ============================================ */
@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes loginSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes alertShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
.login-input:focus {
    outline: none;
}

.login-submit:focus,
.login-forgot:focus,
.login-toggle-password:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .login-input {
        border-width: 3px;
    }

    .login-submit {
        border: 2px solid #ffffff;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-form-container,
    .login-hero-content {
        animation: none;
    }

    .login-submit:hover:not(:disabled) {
        transform: none;
    }

    .login-hero-bg {
        transition: none;
    }

    .login-hero-feature:hover {
        transform: none;
    }

    .login-alert {
        animation: none;
    }
}
