/* ============================================================
   Inventario Sedisa - Estilos Globales
   ============================================================ */

:root {
    --sedisa-primary: #1a5276;
    --sedisa-primary-light: #2980b9;
    --sedisa-secondary: #27ae60;
    --sedisa-warning: #f39c12;
    --sedisa-danger: #e74c3c;
    --sedisa-dark: #2c3e50;
    --sedisa-light: #ecf0f1;
    --sedisa-bg: #f5f6fa;
    --sedisa-white: #ffffff;
    --sedisa-text: #2c3e50;
    --sedisa-text-light: #7f8c8d;
    --sedisa-border: #dcdde1;
    --sedisa-shadow: 0 2px 10px rgba(0,0,0,0.08);
    --sedisa-radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--sedisa-bg);
    color: var(--sedisa-text);
    margin: 0;
    padding: 0;
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar-sedisa {
    background: linear-gradient(135deg, var(--sedisa-primary), var(--sedisa-primary-light));
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 12px 20px;
}

.navbar-sedisa .navbar-brand {
    color: white !important;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

.navbar-sedisa .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-sedisa .nav-link:hover {
    color: white !important;
}

.navbar-sedisa .nav-link.active {
    color: white !important;
    border-bottom: 2px solid white;
}

/* ============================================================
   Campana de notificaciones
   ============================================================ */
.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.4rem;
    color: white;
    padding: 8px 12px;
    transition: transform 0.2s;
}

.notification-bell:hover {
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--sedisa-danger);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 450px;
    overflow-y: auto;
    background: white;
    border-radius: var(--sedisa-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1050;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--sedisa-border);
    cursor: pointer;
    transition: background 0.15s;
}

.notification-item:hover {
    background: var(--sedisa-bg);
}

.notification-item.unread {
    background: #eaf2f8;
    border-left: 4px solid var(--sedisa-primary-light);
}

.notification-item .notif-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--sedisa-text);
    margin-bottom: 4px;
}

.notification-item .notif-time,
.notification-item .notif-folio {
    font-size: 0.8rem;
    color: var(--sedisa-text-light);
}

.notification-item .notif-folio {
    margin-top: 2px;
}

.history-card {
    cursor: pointer;
}

/* ============================================================
   Cards
   ============================================================ */
.card-sedisa {
    background: var(--sedisa-white);
    border: none;
    border-radius: var(--sedisa-radius);
    box-shadow: var(--sedisa-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.card-sedisa:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-sedisa .card-header {
    background: transparent;
    border-bottom: 2px solid var(--sedisa-bg);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 18px 24px;
}

/* ============================================================
   Botones grandes para Usuario 1 (persona mayor)
   ============================================================ */
.btn-sedisa {
    border-radius: 8px;
    font-weight: 600;
    padding: 12px 28px;
    font-size: 1.05rem;
    transition: all 0.2s;
    border: none;
}

.btn-sedisa:hover,
.btn-sedisa:focus,
.btn-sedisa:active {
    color: white !important;
    filter: brightness(1.08);
}

.btn-sedisa-lg {
    padding: 18px 36px;
    font-size: 1.25rem;
    border-radius: 12px;
    min-height: 60px;
}

.btn-sedisa-xl {
    padding: 24px 48px;
    font-size: 1.5rem;
    border-radius: 16px;
    min-height: 75px;
    width: 100%;
}

.btn-primary-sedisa {
    background: var(--sedisa-primary);
    color: white;
}

.btn-primary-sedisa:hover {
    background: var(--sedisa-primary-light);
    color: white;
}

.btn-success-sedisa {
    background: var(--sedisa-secondary);
    color: white;
}

.btn-success-sedisa:hover {
    background: #219a52;
    color: white;
}

.btn-warning-sedisa {
    background: var(--sedisa-warning);
    color: white;
}

.btn-warning-sedisa:hover {
    background: #d68910;
    color: white;
}

.btn-danger-sedisa {
    background: var(--sedisa-danger);
    color: white;
}

.btn-danger-sedisa:hover {
    background: #c0392b;
    color: white;
}

.btn-info-sedisa {
    background: #3498db;
    color: white;
}

.btn-info-sedisa:hover {
    background: #2980b9;
    color: white;
}

/* ============================================================
   Estado seleccionado para grupos de filtros
   ============================================================ */
.filter-group .btn-sedisa {
    border: 2px solid transparent;
}

.filter-group .btn-sedisa.is-selected {
    color: white !important;
    filter: brightness(0.9);
    border-color: #111;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}

.filter-group .btn-sedisa:active,
.filter-group .btn-sedisa:focus,
.filter-group .btn-sedisa:focus-visible {
    color: white !important;
}

/* ============================================================
   Formularios grandes (accesibilidad)
   ============================================================ */
.form-control-lg-sedisa {
    font-size: 1.2rem;
    padding: 14px 18px;
    border-radius: 10px;
    border: 2px solid var(--sedisa-border);
    transition: border-color 0.2s;
}

.form-control-lg-sedisa:focus {
    border-color: var(--sedisa-primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.form-label-lg {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--sedisa-dark);
}

/* ============================================================
   Estados de pedido
   ============================================================ */
.badge-estado {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-height: 34px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: center;
}

.badge-creado { background: #3498db; color: white; }
.badge-en_preparacion { background: #f39c12; color: white; }
.badge-preparado { background: #27ae60; color: white; }
.badge-carta_porte_pendiente { background: #e67e22; color: white; }
.badge-carta_porte_lista { background: #2ecc71; color: white; }
.badge-completado { background: #1abc9c; color: white; }
.badge-cancelado { background: #e74c3c; color: white; }

/* ============================================================
   Tabla responsiva
   ============================================================ */
.table-sedisa {
    border-radius: var(--sedisa-radius);
    overflow: hidden;
}

.table-sedisa thead th {
    background: var(--sedisa-dark);
    color: white;
    font-weight: 600;
    padding: 14px 18px;
    border: none;
    font-size: 0.95rem;
}

.table-sedisa tbody td {
    padding: 12px 18px;
    vertical-align: middle;
    font-size: 1rem;
}

.table-sedisa tbody tr:hover {
    background: #eaf2f8;
}

/* ============================================================
   Layout principal
   ============================================================ */
.main-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sedisa-dark);
    margin-bottom: 30px;
}

.page-subtitle {
    color: var(--sedisa-text-light);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

/* ============================================================
   Login page
   ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sedisa-primary) 0%, var(--sedisa-primary-light) 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .logo h1 {
    color: var(--sedisa-primary);
    font-weight: 800;
    font-size: 1.8rem;
}

.login-card .logo p {
    color: var(--sedisa-text-light);
    margin-top: 5px;
}

/* ============================================================
   Selector de productos (Pedidos)
   ============================================================ */
.product-selector {
    background: white;
    border: 2px solid var(--sedisa-border);
    border-radius: var(--sedisa-radius);
    padding: 20px;
    margin-bottom: 15px;
    transition: border-color 0.2s;
}

.product-selector:hover {
    border-color: var(--sedisa-primary-light);
}

.product-selector .product-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sedisa-dark);
}

.product-selector .quantity-input {
    width: 100px;
    font-size: 1.4rem;
    text-align: center;
    font-weight: 700;
    padding: 10px;
    border: 2px solid var(--sedisa-border);
    border-radius: 10px;
}

.product-selector .quantity-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.product-selector .quantity-btn:active {
    transform: scale(0.9);
}

.product-selector .btn-minus {
    background: var(--sedisa-danger);
    color: white;
}

.product-selector .btn-plus {
    background: var(--sedisa-secondary);
    color: white;
}

/* ============================================================
   Pantalla de éxito
   ============================================================ */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(39, 174, 96, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.success-overlay .check-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: bounceIn 0.5s;
}

.success-overlay h2 {
    font-size: 2.5rem;
    font-weight: 700;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Navbar: acciones siempre visibles
   ============================================================ */
.navbar-end-actions {
    flex-shrink: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
    /* Dropdown de notificaciones: fijo debajo del navbar */
    .notification-dropdown.show {
        position: fixed;
        top: 65px;
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        max-height: 70vh;
        border-radius: var(--sedisa-radius);
        box-shadow: 0 8px 30px rgba(0,0,0,0.25);
        z-index: 1055;
    }

    /* Contenido principal */
    .main-content {
        padding: 15px;
    }

    .page-title {
        font-size: 1.4rem;
        margin-bottom: 16px;
    }

    .page-subtitle {
        font-size: 1rem;
        margin-bottom: 14px;
    }

    /* Botones */
    .btn-sedisa-xl {
        padding: 18px 24px;
        font-size: 1.2rem;
        min-height: 60px;
    }

    .btn-sedisa-lg {
        padding: 14px 20px;
        font-size: 1.05rem;
        min-height: 50px;
    }

    /* Grupos de filtros */
    .filter-group {
        gap: 8px !important;
    }

    .filter-group .btn-sedisa {
        padding: 10px 16px;
        font-size: 0.95rem;
        flex: 1 1 auto;
    }

    /* Selector de productos */
    .product-selector {
        padding: 14px;
    }

    .product-selector .product-name {
        font-size: 1.05rem;
        margin-bottom: 8px;
    }

    .product-selector .quantity-input {
        width: 75px;
        font-size: 1.2rem;
        padding: 8px;
    }

    .product-selector .quantity-btn {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }

    /* Login */
    .login-card {
        margin: 15px;
        padding: 30px 25px;
    }

    /* Toast de notificación */
    .ws-toast {
        left: 8px;
        right: 8px;
        top: 70px;
        min-width: auto;
        max-width: none;
    }

    /* Modales */
    .modal-dialog {
        margin: 10px;
    }

    /* Nav links en el collapse (admin) */
    .navbar-collapse .nav-link {
        padding: 10px 12px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
}

@media (max-width: 575px) {
    .page-title {
        font-size: 1.2rem;
    }

    /* Badges de estado más compactos */
    .badge-estado {
        font-size: 0.72rem;
        padding: 5px 10px;
        min-height: 28px;
    }

    /* Cards: apila contenido verticalmente */
    .card-sedisa .card-body.d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .card-sedisa .card-body.d-flex.justify-content-between > .text-end {
        align-self: flex-end;
        margin-top: 4px;
    }

    /* Tablas más compactas */
    .table-sedisa thead th,
    .table-sedisa tbody td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* Login */
    .login-card .logo h1 {
        font-size: 1.4rem;
    }
}

/* ============================================================
   Toast de notificación en tiempo real
   ============================================================ */
.ws-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    min-width: 320px;
    max-width: 420px;
}

.ws-toast .toast {
    border: none;
    border-radius: var(--sedisa-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    border-left: 5px solid var(--sedisa-primary-light);
}

/* ============================================================
   Utilidades
   ============================================================ */
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.text-sedisa-primary { color: var(--sedisa-primary) !important; }
.bg-sedisa-primary { background: var(--sedisa-primary) !important; }
.cursor-pointer { cursor: pointer; }
