:root {
    --primario: #2196f3;
    --primario-dark: #1976d2;
    --acento: #4caf50;
    --peligro: #f44336;
    --texto: #333;
    --fondo: #f5f5f5;
    --blanco: #ffffff;
    --borde: #e0e0e0;
    --fondo-card: #ffffff;
    --oferta-ok: #8bc34a;
    /* Verde Claro */
    --oferta-ko: #e91e63;
    /* Rosa/Fucsia */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--fondo);
    color: var(--texto);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
header {
    background-color: var(--primario);
    color: var(--blanco);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* Main Container */
main {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 80px;
    /* Space for bottom nav */
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 75px;
    background: var(--blanco);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 25px;
    gap: 30px;
    border-top: 1px solid var(--borde);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #757575;
    font-size: 12px;
}

.nav-item.active {
    color: var(--primario);
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 2px;
}

/* Card Style */
.card {
    background: var(--fondo-card);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Forms */
input,
select,
textarea {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid var(--borde);
    font-size: 16px;
    background: var(--blanco);
    color: var(--texto);
    transition: opacity 0.2s, border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primario);
}

button,
.btn-pwa {
    display: block;
    width: 100%;
    background-color: var(--primario);
    color: var(--blanco);
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-pwa-cancel {
    background-color: #f1f3f5 !important;
    color: #495057 !important;
}

button:active,
.btn-pwa:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

/* Utils */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

/* Diálogos Personalizados (Reemplazo de alert/confirm) */
.pwa-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.pwa-dialog-overlay.open {
    display: flex;
}

.pwa-dialog-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--fondo-card);
    width: 90%;
    max-width: 320px;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: scaleUpCenter 0.2s ease-out forwards;
}

@keyframes scaleUpCenter {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.pwa-dialog-card h3 {
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 700;
}

.pwa-dialog-card p {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.pwa-dialog-footer {
    display: flex;
    gap: 12px;
}

.pwa-dialog-footer button {
    margin-bottom: 0;
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
}

.btn-dialog-cancel {
    background: #f0f0f0;
    color: #444;
}

.btn-dialog-confirm {
    background: var(--primario);
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
    }

    to {
        transform: scale(1);
    }
}

/* Toast System */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    width: 90%;
    max-width: 350px;
    pointer-events: none;
}

.toast-item {
    background: var(--acento);
    /* Default Success Green */
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    /* IMPORTANTE: Permitir clics en el toast */
    animation: toastIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards,
        toastOut 0.3s ease-in forwards 2.7s;
}

.toast-item.success {
    background: var(--acento);
}

.toast-item.danger {
    background: var(--peligro);
}

.toast-item.offer-active {
    background: var(--oferta-ok);
    border: 2.5px solid white;
}

.toast-item.offer-inactive {
    background: var(--oferta-ko);
    border: 2.5px solid white;
}

.toast-item i {
    font-size: 18px;
}

@keyframes toastIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* Sidebar (Menú Lateral) */
#sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 2500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

#pwa-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--blanco);
    z-index: 3000;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

#pwa-sidebar.active {
    left: 0;
}

.sidebar-header {
    background: var(--primario);
    color: white;
    padding: 30px 20px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    text-decoration: none;
    color: var(--texto);
    font-size: 16px;
    font-weight: 600;
}

.sidebar-item i {
    font-size: 22px;
    color: var(--primario);
    width: 25px;
    text-align: center;
}

.sidebar-item.active {
    background: rgba(33, 150, 243, 0.1);
    color: var(--primario);
    border-left: 4px solid var(--primario);
}

/* Restaurar espacio para barra inferior */
main {
    padding-bottom: 90px !important;
}

.bottom-nav {
    display: flex !important;
}

/* Soporte para Modales Modernos y Profesionales */
.pwa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.pwa-modal-overlay.open {
    display: flex;
}

.pwa-modal-card {
    background: var(--fondo-card);
    width: 100%;
    max-width: 440px;
    border-radius: 28px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpModal {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 25px;
    text-align: center;
}

.modal-header h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primario);
    margin-bottom: 5px;
}

.modal-header p {
    font-size: 14px;
    color: #888;
}

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 25px;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-footer button {
    margin-bottom: 0;
}

/* Wizard List Styling */
.wizard-check-list {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 18px;
    padding: 10px;
}

.wizard-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: white;
    margin-bottom: 8px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.wizard-check-item:last-child {
    margin-bottom: 0;
}

.wizard-check-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-bottom: 0;
    cursor: pointer;
    accent-color: var(--primario);
}

.wizard-check-item label {
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    flex: 1;
    color: var(--texto);
}