/* =======================================================
   VARIABLES GLOBALES Y RESET
   ======================================================= */
:root {
    --accent-color: #3d63ff;
    --soft-black: #212529;
    --light-gray: #f8f9fa;
    --sidebar-bg: #ffffff;
    --sidebar-link-color: #4b5563;
    --sidebar-link-hover-bg: #f3f4f6;
    --sidebar-link-active-bg: #eff6ff;
    --sidebar-link-active-color: #0d6efd;
    --page-bg: #F9FAFB;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 80px;
    --header-height: 70px;
}

/* ✅ ELIMINAR OVERLAY DE TAP EN ANDROID */
* {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    touch-action: manipulation !important;
}

body {
    background-color: var(--page-bg);
    font-family: 'system-ui', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    overflow-x: hidden;
}

/* =======================================================
   LAYOUT PRINCIPAL
   ======================================================= */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #f4f6f8;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: transparent;
    transition: margin-left 0.3s ease-in-out;
    width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed + .main-wrapper {
    width: calc(100% - var(--sidebar-width-collapsed));
}

/* =======================================================
   SMART MINI-SIDEBAR
   ======================================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1030;
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .brand-info span {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar.collapsed .brand-info img {
    margin-right: 0;
    width: 45px;
    height: 45px;
}

.sidebar-header {
    height: 80px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    height: auto;
    flex-direction: column;
    justify-content: center;
    padding: 15px 0;
}

.brand-info {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.brand-info img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.sidebar-header .bi-gem {
    font-size: 1.8rem;
    color: var(--accent-color);
}

#sidebarToggle, .btn-toggle {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    line-height: 1;
}

#sidebarToggle:hover, .btn-toggle:hover {
    background: #f3f4f6;
    color: #111827;
}

.sidebar.collapsed #sidebarToggle i {
    transform: rotate(180deg);
    transition: transform 0.3s ease-in-out;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-link-color);
    font-weight: 600;
    font-size: 1.05rem;
    border-radius: 0 24px 24px 0;
    margin-right: 12px;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.nav-link .bi,
.nav-link i {
    font-size: 1.4rem;
    margin-right: 16px;
    min-width: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.sidebar.collapsed .nav-link {
    padding: 12px;
    justify-content: center;
    margin-right: 0;
    border-radius: 12px;
    margin: 0 10px 8px 10px;
}

.sidebar.collapsed .nav-link .bi,
.sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.6rem;
}

.nav-link:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: #111827;
}

.nav-link.active {
    background-color: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color) !important;
    font-weight: 700;
}

.nav-link.active .bi,
.nav-link.active i {
    color: var(--sidebar-link-active-color);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1rem 1.5rem 1rem;
    border-top: 1px solid #374151;
    color: rgba(255, 255, 255, 0.7);
}

/* =======================================================
   HEADER Y CONTENIDO
   ======================================================= */
.app-header {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid #E5E7EB;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.content {
    flex: 1;
    overflow-y: auto;
}

/* =======================================================
   COMPONENTES COMUNES (CARDS)
   ======================================================= */
.card {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-link:hover .card {
    transform: translateY(-5px);
    box-shadow: 0 0.8rem 1.5rem rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    color: var(--soft-black);
    display: flex;
    align-items: center;
}

.card-header .bi {
    color: var(--accent-color);
    margin-right: 10px;
    font-size: 1.2rem;
}

.card-placeholder {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    color: #adb5bd;
    font-style: italic;
}

/* =======================================================
   TARJETAS DE OFERTAS (offer-card)
   ======================================================= */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}

.offer-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .08);
    transition: all .25s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 1px solid #e6e6e6;
}

.offer-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .15);
}

.offer-card.is-highlighted {
    /*border: 2px solid #b5c793;*/
}

.image-wrapper {
    width: 100%;
    height: 200px;
    background: #f3f4f6;
    overflow: hidden;
    position: relative;
}

.offer-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.offer-card-body {
    padding: 16px;
    flex: 1;
}

.offer-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.offer-card-description {
    font-size: .9rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.offer-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    font-size: .75rem;
    padding: 6px 10px;
    border-radius: 20px;
}

.offer-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    gap: 8px;
}

.offer-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    color: #6b7280;
}

.offer-card-actions {
    display: flex;
    gap: 8px;
}

.btn-edit-offer {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-delete-offer {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-edit-offer:hover,
.btn-delete-offer:hover {
    opacity: .9;
    transform: scale(1.05);
}

/* =======================================================
   PANTALLA DE BLOQUEO (PIN)
   ======================================================= */
.lock-key,
.pin-key {
    position: relative !important;
    z-index: 1 !important;
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 12px !important;
    margin: 4px !important;
    border-radius: 12px !important;
    background-color: #ffffff !important;
    border: 2px solid #e9ecef !important;
    color: #495057 !important;
    font-size: 1.5rem !important;
    font-weight: bold !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    transition: all 0.05s ease !important;
    outline: none !important;
}

.lock-key:active,
.pin-key:active,
.lock-key.active,
.pin-key.active {
    transform: scale(0.92) !important;
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    transition: all 0.03s ease !important;
}

.lock-key:focus,
.pin-key:focus,
.lock-key:focus-visible,
.pin-key:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: #e9ecef !important;
}

/* ======================================================= 
   MENU ITEM EDITOR
   ======================================================= */
.menu-editor-container {
    max-width: 1200px;
/*max-width: 1000px;*/
    margin: 0 auto;
    padding-bottom: 100px;
}

.menu-editor-container .form-control,
.menu-editor-container .form-select {
    height: 52px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background-color: #f9fafb;
    font-size: 1.05rem;
    font-weight: 500;
    transition: all 0.2s;
    color: #111827;
}

.menu-editor-container .form-control:focus,
.menu-editor-container .form-select:focus {
    background-color: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13,110,253,0.1);
}

.menu-editor-container textarea.form-control {
    height: auto;
    border-radius: 16px;
}

.menu-editor-container .form-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #6b7280;
    font-weight: 700;
    margin-bottom: 8px;
}

.editor-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-bottom: 24px;
    overflow: hidden;
}

.editor-card-header {
    padding: 20px 24px;
    background-color: #ffffff;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
}

.editor-card-header h4 {
    margin: 0;
    font-weight: 800;
    font-size: 1.25rem;
    color: #111827;
}

.switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f3f4f6;
}

.switch-row:last-child {
    border-bottom: none;
}

.switch-row .form-check-input {
    width: 3.5rem;
    height: 1.75rem;
    cursor: pointer;
}

.option-group-card {
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.option-group-card:focus-within {
    border-color: #0d6efd;
}

.option-row-item {
    background: #f9fafb;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
}

.image-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    background: #f9fafb;
    text-align: center;
    padding: 30px;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-zone:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* =======================================================
   ANIMACIONES Y UTILIDADES
   ======================================================= */
@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.toastify {
    z-index: 10000 !important;
}

/* =======================================================
   RESPONSIVE - PANTALLA DE BLOQUEO
   ======================================================= */
@media (max-height: 600px) {
    #lock-screen-logo {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 0.5rem !important;
    }
    
    #lock-screen-name {
        font-size: 1.25rem !important;
        margin-bottom: 0 !important;
    }
    
    #lock-pin-dots {
        margin-bottom: 1rem !important;
    }
    
    .bi-circle, .bi-circle-fill {
        font-size: 1rem !important;
    }

    .lock-key {
        font-size: 1.25rem !important;
        padding: 0.5rem !important;
        width: 60px !important;
        height: 60px !important;
    }
    
    #pos-lock-overlay .d-grid {
        grid-template-columns: repeat(3, 60px) !important;
        gap: 0.5rem !important;
    }

    #btn-full-logout {
        margin-top: 1rem !important;
        font-size: 0.9rem !important;
        padding: 5px !important;
    }
}

@media (max-height: 400px) {
    #lock-screen-logo,
    #lock-screen-name + p {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .offers-grid {
        grid-template-columns: 1fr;
    }
    
    .image-wrapper {
        height: 220px;
    }
}

/* ============================================
   MODALES BOOTSTRAP - OPTIMIZADOS TABLET
   Excluye modales con clase modal-fullscreen
   ============================================ */

/* Modal base - más ancho para tablet horizontal */
.modal-dialog:not(.modal-fullscreen) {
    margin: 40px auto !important;
    max-width: 900px !important;
}

/* Modal pequeño */
.modal-dialog.modal-sm:not(.modal-fullscreen) {
    max-width: 500px !important;
}

/* Modal grande */
.modal-dialog.modal-lg:not(.modal-fullscreen) {
    max-width: 1000px !important;
}

/* Modal extra grande */
.modal-dialog.modal-xl:not(.modal-fullscreen) {
    max-width: 1200px !important;
}

/* Contenido del modal - SOLO si NO es fullscreen */
.modal-dialog:not(.modal-fullscreen) .modal-content {
    border: none !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
    background: white;
}

/* Header con gradiente - SOLO modales regulares */
.modal-dialog:not(.modal-fullscreen) .modal-header {
    background: linear-gradient(135deg, #3d63ff 0%, #2a4fd9 100%) !important;
    color: white !important;
    padding: 28px 32px !important;
    border: none !important;
}

.modal-dialog:not(.modal-fullscreen) .modal-title {
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    color: white !important;
}

/* Botón cerrar */
.modal-dialog:not(.modal-fullscreen) .modal-header .btn-close {
    filter: brightness(0) invert(1) !important;
    opacity: 0.9 !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
}

/* Body - SOLO modales regulares */
.modal-dialog:not(.modal-fullscreen) .modal-body {
    padding: 32px !important;
    background: #f8fafc;
}

/* Inputs touch-friendly - SOLO modales regulares */
.modal-dialog:not(.modal-fullscreen) .modal-body .form-control,
.modal-dialog:not(.modal-fullscreen) .modal-body .form-select {
    border: 2px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 16px 18px !important;
    font-size: 1rem !important;
    min-height: 56px !important;
}

.modal-dialog:not(.modal-fullscreen) .modal-body .form-control:focus,
.modal-dialog:not(.modal-fullscreen) .modal-body .form-select:focus {
    border-color: #3d63ff !important;
    box-shadow: 0 0 0 4px rgba(61, 99, 255, 0.12) !important;
}

/* Footer - SOLO modales regulares */
.modal-dialog:not(.modal-fullscreen) .modal-footer {
 /*   padding: 24px 32px !important;*/
    background: white !important;
    border-top: 1px solid #e2e8f0 !important;
}

.modal-dialog:not(.modal-fullscreen) .modal-footer .btn {
    min-height: 56px !important;
    padding: 16px 32px !important;
    border-radius: 14px !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    min-width: 150px !important;
}

/* ============================================
   TABLET LANDSCAPE (1024px+)
   ============================================ */
@media (min-width: 1024px) {
    .modal-dialog:not(.modal-fullscreen) {
        max-width: 1000px !important;
        margin: 0px auto !important;
    }
    
    .modal-dialog.modal-lg:not(.modal-fullscreen) {
        max-width: 1100px !important;
    }
    
    .modal-dialog.modal-xl:not(.modal-fullscreen) {
        max-width: 1300px !important;
    }
    
    .modal-dialog:not(.modal-fullscreen) .modal-body {
        padding: 40px !important;
    }
}

/* ============================================
   TABLET PEQUEÑA / MÓVIL
   ============================================ */
@media (max-width: 768px) {
    .modal-dialog:not(.modal-fullscreen) {
        max-width: 95% !important;
        margin: 20px auto !important;
    }
    
    .modal-dialog:not(.modal-fullscreen) .modal-header {
        padding: 24px !important;
    }
    
    .modal-dialog:not(.modal-fullscreen) .modal-body {
        padding: 24px !important;
    }
    
    .modal-dialog:not(.modal-fullscreen) .modal-footer {
        padding: 20px !important;
        flex-direction: column-reverse;
    }
    
    .modal-dialog:not(.modal-fullscreen) .modal-footer .btn {
        width: 100% !important;
    }
}

/* Animaciones - SOLO modales regulares */
.modal.fade:not(.modal-fullscreen) .modal-dialog {
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.3s ease-out;
}

.modal.show:not(.modal-fullscreen) .modal-dialog {
    transform: scale(1) translateY(0);
}

/* Backdrop - para todos los modales */
.modal-backdrop.show {
    opacity: 0.6 !important;
    backdrop-filter: blur(4px);
} 

/* Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 10px !important;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 10px !important;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #94a3b8 !important;
    border-radius: 10px !important;
    border: 2px solid #f1f5f9 !important;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #64748b !important;
}
 

/* Scrollbar flechas */
.custom-scroll-area {
    position: relative;
    overflow-y: auto;
}

.scroll-arrows {
    position: absolute;
    right: 12px;
    bottom: 110px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1060;
    pointer-events: none;
}

.scroll-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;
    color: white;

    cursor: pointer;

    background: rgba(61, 99, 255, 0.75);
    backdrop-filter: blur(10px);

    box-shadow: 0 6px 18px rgba(0,0,0,0.25);

    transition: all 0.2s ease;

    pointer-events: auto;
}
