/* Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f1c40f;
    --text-color: #666;
    --background-color: #f5f6fa;
    --white: #fff;
    --border-radius: 8px;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition: 0.3s;
}


/* Base y Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--background-color);
}


.dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}


/* Sidebar y Menú */
.sidebar {
    background: var(--primary-color);
    color: var(--white);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}


.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    border-bottom: 1px solid var(--secondary-color);
}


.logo-text {
    font-size: 1.2rem;
    white-space: nowrap;
}


.stacked-icons {
    position: relative;
    width: 32px;
    height: 32px;
    display: inline-block;
}


.icon-layer {
    position: absolute;
    font-size: 28px;
}


.icon-layer:nth-child(1) { left: 8px; top: 0; }
.icon-layer:nth-child(2) { left: 0; top: 20px; }
.icon-layer:nth-child(3) { left: 16px; top: 20px; }


.menu {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}


.menu-primary,
.menu-secondary {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}


.menu a {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem;
    font-size: 0.9rem;
    color: white;
    text-decoration: none;
    transition: 0.3s;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
}


.menu a i {
    font-size: 1rem;
    min-width: 20px;
}


.menu a:hover,
.menu a.active {
    background: var(--secondary-color);
}


.menu-toggle {
    display: none;     /* Oculto por defecto en pantalla grande */
}


/* Contenedores y Componentes */.container {
    padding: 2rem;
    background: var(--white);
    border-radius: var(--border-radius);
    margin: 2rem;
}


.pos-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    padding: 2rem;
}
/* Productos y Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}


.product-card {
    background: var(--white);
    padding: 0.8rem;
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}


.product-card img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 auto 0.5rem;
    display: block;
}


.product-card.selected {
    border: 2px solid var(--accent-color);
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}


.order-section {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
}


/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}


.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    display: flex;           /* Añadir */
    flex-direction: column;  /* Añadir */
    align-items: center;     /* Añadir */
}



.modal.persistent {
    pointer-events: all;
}


/* Botones y Controles */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}


.btn-primary {
    background: var(--accent-color);
    color: var(--white);
}


.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}


.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0 5px;
}


.btn-logout:hover {
    color: #ff4444;
}
/* Notificaciones */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    z-index: 1000;
}


.notification {
    background: var(--white);
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 250px;
    display: flex;
    align-items: center;
    gap: 8px;
}


.notification.success { border-left: 4px solid var(--success-color); }
.notification.error { border-left: 4px solid var(--error-color); }
.notification.warning { border-left: 4px solid var(--warning-color); }


/* Tablas */
table {
    width: 100%;
    border-collapse: collapse;
}


th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}


/* Formularios */
.form-group {
    margin-bottom: 1rem;
    position: relative;
}


.form-control {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}


.input-error {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 4px;
    display: none;
}


.form-group input.invalid {
    border-color: var(--error-color);
}


/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}


.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}


.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
/* Slider y Switch continuación */
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}


input:checked + .slider {
    background-color: #2196F3;
}


input:checked + .slider:before {
    transform: translateX(26px);
}


.slider.round {
    border-radius: 34px;
}


.slider.round:before {
    border-radius: 50%;
}


/* Indicadores */
.format-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(44, 62, 80, 0.9);
    padding: 6px 12px;
    border-radius: 15px;
    color: white;
    font-size: 0.9rem;
    z-index: 1001;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-indicator {
    position: fixed;
    bottom: 8px;
    right: 80px;
    background: var(--white);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}


@media (max-width: 768px) {
    .format-indicator {
        background: var(--primary-color);
        opacity: 0.7;
    }
    
    .user-indicator {
        right: auto;
        left: 10px;
        background: rgba(255, 255, 255, 0.7);
        opacity: 0.7;
    }

    .format-indicator:hover,
    .format-indicator:active,
    .user-indicator:hover,
    .user-indicator:active {
        opacity: 1;
        background: var(--primary-color);
    }
    
    .user-indicator:hover,
    .user-indicator:active {
        background: var(--white);
    }
}



/* Preview de imagen */
.image-preview-container {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 1rem 0;
}


#imagePreview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #f8f9fa;
}


.image-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
/* Módulo de Ventas */
.sales-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}


.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}


.stat-card h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}


.stat-card p {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}


.total {
    text-align: right;
    font-size: 1.2rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}


/* Animaciones */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}


@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}


@keyframes shake-effect {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}


.shake-effect {
    animation: shake-effect 0.5s ease-in-out;
}



/* Ajustes para móvil */
@media (max-width: 768px) {
    .dashboard {
              grid-template-columns: 1fr;
    }
   
    .sidebar {
              position: fixed;
              bottom: 0;
              left: 0;
              right: 0;
              z-index: 100;
              padding: 0.5rem;
              background: var(--primary-color);
              display: flex;
              flex-direction: column;
              width: 100%;
    }


    .menu-secondary {
              order: 1;
              display: none;
    }
   
    .menu-primary {
              order: 2;
              display: grid;
              grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
              gap: 0.5rem;
              width: 100%;
    }
                   .menu-toggle {
                             order: 3;
                             display: flex;
                             width: auto;
                             background: var(--accent-color);
                             padding: 0.5rem 1rem;
                             border: none;
                             border-radius: 20px;
                             margin: 0.3rem auto;
                             color: var(--white);
                             align-items: center;
                             justify-content: center;
                             gap: 0.5rem;
                             box-shadow: var(--shadow);
                             transform: translateY(-2px);
                             font-weight: bold;
                             text-transform: uppercase;
                             letter-spacing: 1px;
                             font-size: 0.8rem;
                   }


                   .menu-toggle:hover {
                             background: var(--secondary-color);
                             transform: translateY(-1px);
                   }


                   .menu-toggle i {
                             animation: bounce 2s infinite;
                   }


                   @keyframes bounce {
                             0%, 100% { transform: translateY(0); }
                             50% { transform: translateY(-3px); }
                   }
    .menu-secondary.show {
              display: grid;
              grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
              gap: 0.5rem;
              width: 100%;
              margin-bottom: 0.2rem;
    }


    #main-content {
              margin-bottom: 200px;
    }


    .menu-primary a,
    .menu-secondary.show a {
              width: 100%;
              justify-content: center;
              background: var(--secondary-color);
              font-size: 0.9rem;
              padding: 0.5rem;
    }


    .logo {
              order: 4;
              padding: 0.5rem;
              justify-content: center;
    }


    .logo .stacked-icons {
              width: 40px;
              height: 40px;
    }


    .logo-text {
              font-size: 1.5rem;
    }


}
   
.ticket-container {
    font-family: monospace;
    white-space: pre;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    box-shadow: var(--shadow);
    max-width: 300px;        /* Añadir */
    margin: 0 auto;          /* Añadir */
}




.ticket-content {
    font-size: 12px;
    line-height: 1.2;
}


.actions-bar {
    margin: 1rem 0;
    display: flex;
    gap: 1rem;
}


.ticket-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}


@media print {
    body * {
              visibility: hidden;
    }
    .ticket-container, .ticket-container * {
              visibility: visible;
    }
    .ticket-container {
              position: absolute;
              left: 0;
              top: 0;
    }
    .ticket-actions {
              display: none;
    }
}

/*selectores de admin principal*/
.primary-admin-selector {
    margin: 1rem 0;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}


/*aquí lo de la categorizacion de roles en vista usuarios*/

.users-hierarchical {
    display: grid;
    grid-auto-flow: dense;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.role-section {
    display: contents;
}

.role-header {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
    width: fit-content;
    padding-right: 2rem;
}

.user-card {
    break-inside: avoid;
    page-break-inside: avoid;
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.user-card.super-admin { border-left: 4px solid #ff9800; }
.user-card.admin { border-left: 4px solid #2196f3; }
.user-card.seller { border-left: 4px solid #4caf50; }

.user-card:hover {
    transform: translateY(-2px);
}
