/* ==========================================================================
   1. GLOBALES Y VARIABLES
   ========================================================================== */
:root {
    --primary-color: #a51916;
    --primary-color-dark: #8c1613;
    --secondary-color: #007bff;
    --background-color: #f4f6f8;
    --text-color: #333;
    --chat-box-background: #ffffff;
    --user-message-color: #ffffff;
    --bot-message-color: #3c4043;
    --bot-message-background: #e8f0fe;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --delete-color: #dc3545;
    --delete-hover-color: #c82333;
    --success-color: #28a745;
    --success-hover-color: #218838;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    min-height: 100vh;
    color: var(--text-color);
    background-image: url("images/fondo2025.png");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

h1,
h2,
h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
}

/* ==========================================================================
   2. SISTEMA DE BOTONES MODULAR
   ========================================================================== */
.btn {
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.3s, transform 0.1s, box-shadow 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background-color: #6c757d !important;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    /* margin-top: 1rem; */
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
}

.btn-action {
    background-color: var(--secondary-color);
    color: white;
    margin: 16px 5px 5px 0px;
}

.btn-action:hover {
    background-color: #0056b3;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover-color);
}

.btn-danger {
    background-color: var(--delete-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--delete-hover-color);
}

.btn-link {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    background: none;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary-color-dark);
}

/* ==========================================================================
   3. ESTILOS ESPECÍFICOS PARA PANEL ADMINISTRATIVO
   ========================================================================== */
.admin-body {
    background-color: #f8f9fa;
    font-family: 'Roboto', sans-serif;
}

.admin-container {
    display: flex;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.admin-sidebar {
    width: 250px;
    background: linear-gradient(135deg, var(--primary-color), #2c3e50);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.admin-sidebar h2 {
    color: white;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.admin-nav {
    list-style: none;
    padding: 0;
}

.admin-nav li {
    margin-bottom: 0.5rem;
}

.admin-nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-nav i {
    margin-right: 10px;
    width: 20px;
}

.admin-main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    min-height: 100vh;
}

.admin-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
}

.admin-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-tab-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.admin-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.admin-tab {
    padding: 1rem 2rem;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.admin-tab.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background: #f0f8ff;
}

.admin-tab-content {
    display: none;
    padding: 2rem;
    min-height: 60vh;
}

.admin-tab-content.active {
    display: block;
}

.form-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

.form-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}



.form-control {
    width: 97%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

/* ESTILOS ESPECÍFICOS PARA TEXTAREAS - TAMAÑO FIJO Y NO REDIMENSIONABLE */
textarea.form-control {
    resize: vertical;
    min-height: 120px;
    max-height: 300px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

textarea.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 25, 22, 0.1);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 25, 22, 0.1);
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    /* margin: 16px 0px 0px; */
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-danger {
    background-color: var(--delete-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--delete-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-action {
    background-color: var(--success-color);
    color: white;
}

.btn-action:hover {
    background-color: var(--success-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

tr:hover {
    background-color: #f8f9fa;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    /* <-- VALOR ALTO PARA ASEGURAR QUE ESTÉ POR ENCIMA DE TODO */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* Un poco más oscuro para mejor contraste */
    backdrop-filter: blur(4px);
    /* Efecto moderno */
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    /* Un margen superior más pequeño para pantallas grandes */
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    /* Ocupa el 90% del ancho de la pantalla */
    max-width: 900px;
    /* Pero con un máximo de 900px */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    margin: 0;
    color: #6c757d;
    font-size: 1rem;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.image-uploader {
    margin: 1rem 0;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    margin: 0 auto;
    margin-top: 1rem;
    border-radius: 8px;
    display: none;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.user-info {
    font-size: 1.1rem;
    margin-left: 1rem;
    margin-right: 1rem;
}

.user-info b {
    color: var(--primary-color);
}

/* ==========================================================================
   4. ESTILOS ESPECÍFICOS PARA EDICIÓN DE SUCURSALES
   ========================================================================== */
.edit-sucursal-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
    width: 95%;
}

.sucursal-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sucursal-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
}

.sucursal-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.section-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    overflow: hidden;
}

.section-header {
    background: #f8f9fa;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.section-header i {
    transition: transform 0.3s ease;
}

.section-header.collapsed i {
    transform: rotate(-90deg);
}

.section-content {
    padding: 1.5rem;
}

.section-content.hidden {
    display: none;
}

.image-uploader-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.image-uploader-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.image-uploader-row input {
    flex: 1;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.equipment-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.equipment-card h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.equipment-image {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.equipment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.no-items {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

/* ESTILOS ESPECÍFICOS PARA TEXTAREAS EN EDICIÓN DE SUCURSALES */
.edit-sucursal-container textarea.form-control {
    resize: vertical;
    min-height: 120px;
    max-height: 200px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.edit-sucursal-container textarea.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 25, 22, 0.1);
}

/* ==========================================================================
   5. LAYOUT PÁGINA PRINCIPAL (INDEX)
   ========================================================================== */
.chat-page-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-banner {
    width: 100%;
    background-color: #ffffff;
    padding: 10px 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.header-banner .logo-container {
    margin-left: 30px;
}

.header-banner .logo {
    height: 45px;
}

.header-banner .banner-text {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--primary-color);
    padding: 0 20px;
}

.header-banner .user-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-right: 30px;
}

.header-banner .user-controls a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.header-banner .user-controls a:hover {
    color: var(--primary-color-dark);
}

footer {
    width: 100%;
    background-color: var(--primary-color);
    color: #ffffff;
    text-align: center;
    padding: 15px 20px;
    margin-top: auto;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-credits {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

.main-content {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin-top: 20px;
    flex-grow: 1;
    padding: 0 20px;
    gap: 20px;
    height: 75vh;
    align-items: stretch;
}

.video-panel {
    flex-basis: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    align-items: center;
    height: 100%;
}

.video-panel a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.video-thumbnail-container {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-align: center;
    background-color: var(--chat-box-background);
    padding-bottom: 10px;
}

.video-thumbnail-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.video-thumbnail-container img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.video-thumbnail-container p {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    margin: 10px 5px 0;
    line-height: 1.2;
    word-wrap: break-word;
}

.chat-container {
    flex-grow: 1;
    max-width: 800px;
    background-color: var(--chat-box-background);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 80%;
}

.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.user-message {
    background-color: var(--primary-color);
    color: var(--user-message-color);
    margin-left: auto;
    border-top-right-radius: 4px;
}

.bot-message {
    background-color: var(--bot-message-background);
    color: var(--bot-message-color);
    margin-right: auto;
    border-top-left-radius: 4px;
}

.video-link-container {
    width: 100%;
    max-width: 800px;
    text-align: center;
    margin: 20px auto;
}

.chat-input {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--chat-box-background);
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1rem;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button:hover {
    background-color: var(--primary-color-dark);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button svg {
    fill: white;
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   6. LAYOUT PÁGINAS SECUNDARIAS (LOGIN, ADMIN, FILES, RECOVER)
   ========================================================================== */
.auth-body,
.admin-body,
.files-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
}

.container,
.login-container,
.recover-box {
    width: 100%;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    box-sizing: border-box;
}

.container {
    max-width: 900px;
}

.login-container,
.recover-box {
    max-width: 400px;
    text-align: center;
    border-radius: 20px;
}

.login-container .logo {
    height: 60px;
    margin-bottom: 1rem;
}

.login-container .title,
.recover-box h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.login-form input,
.recover-box input,
.form-section input,
.form-section select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.login-form button,
.recover-box button {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-form button:hover,
.recover-box button:hover {
    background-color: var(--primary-color-dark);
}

.error-message,
#message-area {
    color: var(--primary-color);
    margin-top: 1rem;
    min-height: 1.2em;
}

.recover-link {
    display: block;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
}

.recover-link:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: #f2f2f2;
}

.form-section {
    border: 1px solid #ddd;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.actions button {
    margin-right: 5px;
    margin-bottom: 5px;
    margin-top: 1rem;
}

.upload-section {
    border: 2px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 8px;
    background-color: #fafafa;
}

.upload-section input[type="file"] {
    display: none;
}

.upload-label {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-block;
    transition: background-color 0.3s;
}

.upload-label:hover {
    background-color: #0056b3;
}

#upload-form button {
    background-color: var(--success-color);
}

#upload-form button:hover {
    background-color: var(--success-hover-color);
}

#progress-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 1rem;
    display: none;
}

#progress-bar {
    width: 0%;
    height: 20px;
    background-color: #4CAF50;
    border-radius: 5px;
    text-align: center;
    line-height: 20px;
    color: white;
    transition: width 0.4s ease;
}

td a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
}

/* ==========================================================================
   7. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 992px) {
    body {
        padding: 1rem;
    }

    .main-content {
        flex-direction: column;
        align-items: center;
        height: auto;
        margin-top: 10px;
        gap: 10px;
    }

    .video-panel {
        flex-basis: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        height: auto;
    }

    .video-panel a {
        width: 48%;
        max-width: 220px;
    }

    .chat-container {
        width: 100%;
        max-width: 100%;
        height: 70vh;
        margin-bottom: 20px;
    }

    .header-banner .banner-text {
        font-size: 1.2rem;
    }

    /* Estilos responsivos para el panel administrativo */
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        padding: 1rem;
    }

    .admin-main-content {
        padding: 1rem;
    }

    .admin-tabs {
        flex-wrap: wrap;
    }

    .admin-tab {
        flex: 1;
        text-align: center;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    /* Ajustes para el contenedor principal */
    .admin-tab-container {
        width: 100%;
        margin: 0;
        padding: 0 1rem;
    }

    .admin-tab-content {
        padding: 1rem;
    }

    /* Estilos responsivos para edición de sucursal */
    .sucursal-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .sucursal-header-actions {
        width: 100%;
        justify-content: center;
    }

    .section-header {
        padding: 1rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .equipment-grid {
        grid-template-columns: 1fr;
    }

    .stats-summary {
        grid-template-columns: 1fr;
    }

    .edit-sucursal-container {
        width: 98%;
        padding: 1rem;
    }
}

/* --- Estilos responsivos para detalle de sucursal --- */
@media (max-width: 768px) {
    .detalle-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .detalle-header-actions {
        width: 100%;
        justify-content: center;
    }

    .detalle-section-header {
        padding: 1rem;
    }

    .detalle-section-header h2 {
        font-size: 1.1rem;
    }

    .component-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .info-general-grid {
        grid-template-columns: 1fr;
    }

    .image-modal-content {
        width: 95%;
        margin-top: 2vh;
    }

    .image-modal-caption {
        width: 95%;
        font-size: 1rem;
    }
}

/* --- Estilos para Móviles (hasta 576px) --- */
@media (max-width: 576px) {
    body {
        padding: 0.5rem;
        background-image: none;
        background-color: var(--background-color);
    }

    .header-banner {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
    }

    .header-banner .logo-container,
    .header-banner .user-controls {
        margin: 0;
    }

    .header-banner .banner-text {
        font-size: 1.1rem;
        order: -1;
    }

    .main-content {
        margin-top: 15px;
        height: auto;
    }

    .video-panel a {
        width: 100%;
        max-width: none;
    }

    .chat-container {
        height: 80vh;
    }

    .video-link-container {
        display: none;
    }

    .container,
    .login-container,
    .recover-box {
        padding: 1rem;
    }

    /* Estilos móviles específicos para admin */
    .admin-main-content {
        padding: 1rem;
    }

    .admin-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .admin-header-actions {
        width: 100%;
        justify-content: center;
    }

    .admin-tab {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .table-container {
        overflow-x: auto;
    }

    .actions {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 1rem;
    }

    /* Estilos móviles específicos para edición de sucursal */
    .edit-sucursal-container {
        padding: 0.5rem;
        width: 99%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .image-uploader-row {
        flex-direction: column;
    }

    .image-uploader-row input {
        margin-bottom: 0.5rem;
    }

    .equipment-grid {
        grid-template-columns: 1fr;
    }

    .stats-summary {
        grid-template-columns: 1fr;
    }

    .section-header h2 {
        font-size: 1rem;
    }

    /* Ajustes para textareas en móviles */
    textarea.form-control {
        min-height: 100px;
        max-height: 150px;
    }
}

/* ==========================================================================
   8. ESTILOS ESPECÍFICOS PARA DETALLE DE SUCURSALES
   ========================================================================== */
/* --- Estilos para la Página de Detalle de Sucursal --- */
.detail-body {
    background-color: #f4f7f9;
}

.detail-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

#header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sucursal-header-logo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#equipo-grid-container {
    display: block; 
}

.equipo-section {
    margin-bottom: 2.5rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
}

.equipo-section:first-child {
    /* Quitamos el borde y el padding de la primera sección para que no se vea raro */
    border-top: none;
    padding-top: 0;
}

.equipo-section h2 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.equipo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.equipo-section .equipo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.equipo-card {
    background: #fdfdfd;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.equipo-card h4 {
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.equipo-card ul {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
}

.equipo-card ul li {
    margin-bottom: 0.5rem;
}

.item-gallery {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.item-gallery img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: transform 0.2s;
}

.item-gallery img:hover {
    transform: scale(1.1);
}

.status-operativo {
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.status-en {
    background-color: #ffc107;
    color: #333;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.status-de {
    background-color: #dc3545;
    color: white;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.equipo-card .card-actions {
    margin-top: 1rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
    text-align: right;
}

/* ESTILOS PARA EL MODAL DE IMAGEN */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.image-modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    margin-top: 5vh;
    border-radius: 8px;
}

.image-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

.image-modal-close:hover {
    color: #bbb;
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 30px;
    cursor: pointer;
    user-select: none;
    transform: translateY(-50%);
}

.image-modal-prev {
    left: 15px;
}

.image-modal-next {
    right: 15px;
}

.image-modal-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1.2rem;
}

.image-modal-counter {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #f1f1f1;
    font-size: 16px;
}

/* ==========================================================================
   9. ESTILOS ESPECÍFICOS PARA PÁGINA DE SUCURSALES
   ========================================================================== */
.sucursales-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 95%;
}

.sucursales-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sucursales-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
}

.sucursales-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-container {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 25, 22, 0.1);
}

.filter-container {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 0;
}

.sucursal-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    border: 1px solid #e9ecef;
    height: 100%;
}

.sucursal-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #e9ecef;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.card-content p {
    color: #6c757d;
    margin: 0.5rem 0;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.inauguration-order {
    background: #f8f9fa;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-color);
}

.card-action {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-action:hover {
    background: var(--primary-color-dark);
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
    font-size: 1.2rem;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ced4da;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.loading i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
}

/* ==========================================================================
   10. ESTILOS ESPECÍFICOS PARA PÁGINA DE ARCHIVOS COMPARTIDOS
   ========================================================================== */
.files-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 95%;
}

.files-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.files-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
}

.files-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.upload-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.upload-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 1.5rem;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: #f0f8ff;
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-area p {
    margin: 0.5rem 0;
    color: #6c757d;
}

.file-upload-area .file-name {
    font-weight: 500;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

.upload-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hidden-file-input {
    display: none;
}

.progress-container {
    width: 100%;
    background: #e9ecef;
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
    height: 10px;
    display: none;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.files-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.files-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.department-section {
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.department-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.department-header h3 {
    margin: 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.department-header i {
    transition: transform 0.3s ease;
}

.department-header.collapsed i {
    transform: rotate(-90deg);
}

.files-table-container {
    padding: 1.5rem;
    overflow-x: auto;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    color: #495057;
}

.files-table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.files-table tr:hover {
    background: #f8f9fa;
}

.file-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.file-size {
    font-weight: 500;
    color: #6c757d;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.no-files {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-files i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ced4da;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.search-filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.filter-dropdown {
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    font-size: 1rem;
    min-width: 150px;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin: 16px 0px 0px;
}

@media (max-width: 768px) {
    .files-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .files-header-actions {
        width: 100%;
        justify-content: center;
    }

    .search-filter-bar {
        flex-direction: column;
    }

    .search-box,
    .filter-dropdown {
        width: 100%;
    }

    .upload-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .files-table-container {
        padding: 1rem;
    }

    .files-table {
        font-size: 0.9rem;
    }

    .files-table th,
    .files-table td {
        padding: 0.5rem;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   11. ESTILOS ESPECÍFICOS PARA PÁGINA DE BASE DE CONOCIMIENTO
   ========================================================================== */

.knowledge-base-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

.knowledge-base-section h2 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.form-grid-single {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.form-grid-single .form-control {
    flex: 1;
    min-width: 250px;
}

.status-message {
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-message.success {
    background-color: var(--success-background);
    color: var(--success-color);
}

.status-message.error {
    background-color: var(--error-background);
    color: var(--delete-color);
}

.status-message.info {
    background-color: #d1ecf1;
    color: var(--info-color);
}

.ia-management {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.ia-management h3 {
    color: #856404;
    margin-top: 0;
}

.ia-management p {
    color: #856404;
}

#knowledge-files-table th,
#knowledge-files-table td {
    padding: 0.75rem;
}

#knowledge-files-table .actions {
    justify-content: center;
}

#knowledge-files-table .actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        padding: 1rem;
    }

    .admin-main-content {
        padding: 1rem;
    }

    .admin-tabs {
        flex-wrap: wrap;
    }

    .admin-tab {
        flex: 1;
        text-align: center;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .admin-tab-container {
        width: 100%;
        margin: 0;
        padding: 0 1rem;
    }

    .admin-tab-content {
        padding: 1rem;
    }

    .form-grid-single {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid-single .form-control {
        min-width: auto;
    }

    .form-grid-single .btn {
        width: 100%;
    }
}

/* ============================================= */
/* == ESTILOS PARA LA GALERÍA DE IMÁGENES DE EQUIPOS == */
/* ============================================= */

/* Contenedor principal de la galería */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    /* Permite que las imágenes pasen a la siguiente línea */
    gap: 1rem;
    /* Espacio entre las imágenes */
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

/* Cada item de la galería (imagen + descripción + botón) */
.gallery-item {
    position: relative;
    /* Necesario para posicionar el botón de eliminar */
    width: 150px;
    /* Ancho fijo para cada miniatura */
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* El enlace que envuelve la imagen */
.gallery-item a {
    display: block;
    width: 100%;
    height: 120px;
    /* Altura fija para el contenedor de la imagen */
    overflow: hidden;
    /* Oculta partes de la imagen que no quepan */
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* La imagen miniatura en sí */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Escala la imagen para que cubra el espacio sin deformarse */
    transition: transform 0.2s ease-in-out;
}

.gallery-item a:hover img {
    transform: scale(1.05);
    /* Efecto de zoom sutil al pasar el ratón */
}

/* La descripción debajo de la imagen */
.gallery-item-caption {
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    margin: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Añade "..." si el texto es muy largo */
}

/* El botón de eliminar, posicionado en la esquina superior derecha */
.gallery-item .delete-imagen-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    /* Hacemos el botón un poco más pequeño y semitransparente */
    padding: 2px 6px;
    font-size: 0.8rem;
    background-color: rgba(220, 53, 69, 0.8);
    /* Rojo semitransparente */
    border: none;
    opacity: 0;
    /* Oculto por defecto */
    transition: opacity 0.2s ease-in-out;
}

.gallery-item .delete-imagen-btn i {
    pointer-events: none;
    /* Asegura que el clic va al botón, no al icono */
}

/* El botón de eliminar aparece al pasar el ratón por encima del item */
.gallery-item:hover .delete-imagen-btn {
    opacity: 1;
}

/* ==========================================================================
   12. ESTILOS ESPECÍFICOS PARA CONSULTA DE PRECIOS (v2.0)
   ========================================================================== */

/* Encabezado de la página (Título y Botón de Promociones) */
.page-header {
    display: flex;
    justify-content: space-between;
    /* Alinea los elementos a los extremos */
    align-items: center;
    /* Centra verticalmente */
    flex-wrap: wrap;
    /* Permite que pasen a la siguiente línea en móviles */
    gap: 1rem;
    /* Espacio entre el título y el botón */
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Contenedor de la barra de búsqueda */
.search-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper .form-control {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    box-sizing: border-box;
    /* Asegura que el padding no desborde el input */
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.product-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e9ecef;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f8f9fa;
    /* Color de fondo para imágenes que no cargan */
}

.product-info {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-description {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.product-code {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0 0 1rem 0;
    font-family: 'monospace';
}

.product-prices {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

.product-price.bs {
    color: var(--primary-color-dark);
}

.product-price.usd {
    font-size: 1.4rem;
    color: var(--success-color);
}

.status-message {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-size: 1.1rem;
    margin-top: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.detail-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-section {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 6px;
}

.detail-section h4 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.detail-section.full-width {
    grid-column: span 2;
}

.offer-highlight {
    background: #fff3cd;
    border: 1px solid #ffeeba;
}

/* Estilos para la paginación */
.pagination-container {
    text-align: center;
    padding: 20px 0;
}

.pagination-container span {
    margin-right: 15px;
    font-weight: 500;
}

.pagination-container .btn {
    margin: 0 5px;
}

/* --- NUEVOS ESTILOS PARA EL MÓDULO DE PRECIOS --- */

/* Navegación de Submódulos */
.sub-nav {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.sub-nav .btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
}

.sub-nav .btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Contenedores de Vistas */
.view-container {
    display: none;
    /* Ocultos por defecto */
    padding-top: 20px;
}

.view-container.active {
    display: block;
    /* La vista activa se muestra */
}

/* Barra de Búsqueda Centrada */
.search-bar-centered {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.search-bar-centered .search-input-wrapper {
    min-width: 400px;
}

.search-bar-centered .form-control {
    height: 50px;
}

/* Ajustes a la tabla de resultados para el nuevo formato de lista */
#resultsTable {
    width: 100%;
    border-collapse: collapse;
}

#resultsTable th,
#resultsTable td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

#resultsTable th {
    background-color: #f2f2f2;
    font-weight: 600;
}

#resultsTable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#resultsTable tbody tr:hover {
    background-color: #f1f1f1;
    cursor: pointer;
}

/* --- ESTILO PARA EL CONTENEDOR PRINCIPAL (VERSIÓN CON MARGEN) --- */

.price-query-container {
    width: 100%;
    max-width: 1600px;
    margin: 2rem auto 0 auto;
    /* 2rem de margen superior, centrado horizontal, 0 inferior */
    padding: 20px;
}

/* --- ESTILOS PARA EL NUEVO MODAL DE DETALLES --- */
.detail-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

/* .detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
} */
.price-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    align-items: center;
}

.price-grid strong {
    font-weight: 500;
}

.price-grid .price-final {
    font-size: 1.1rem;
    font-weight: bold;
}

.offer-dates {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    padding: 10px;
    border-radius: 4px;
    margin: 15px 0;
    text-align: center;
}

#modalBarcode {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin-top: 10px;
}

/* --- ESTILOS PARA LA SECCIÓN DE OFERTA EN EL MODAL --- */

.offer-header {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 20px 0 0 0;
    font-size: 0.9rem;
}

.offer-header p {
    margin: 5px 0;
}

.offer-section {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-top: none;
    padding: 15px;
    margin: 0 0 20px 0;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.offer-section h4 {
    margin-top: 0;
}

.selected-row {
    background-color: #fffbe6 !important;
    /* Un amarillo suave para destacar */
    font-weight: 500;
}

/* --- ESTILOS PARA EL MODAL DE SELECCIÓN DE FORMATO --- */
.format-selector-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.format-wrapper {
    text-align: center;
    /* Centra el título debajo */
}

.format-option {
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 10px;
    /* Un poco menos de padding */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: white;
    /* Añadimos fondo por si acaso */
}

.format-option:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.format-option img {
    width: 100%;
    height: auto;
    display: block;
    /* Asegura que la imagen se comporte como un bloque */
}

.format-wrapper p {
    margin: 10px 0 0 0;
    /* Margen superior para separar el texto */
    font-weight: 500;
    color: #333;
}

.table-actions-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

/* --- ESTILOS MEJORADOS PARA FORMULARIOS DE BÚSQUEDA --- */

.search-form-container {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    /* 4 columnas de igual tamaño para los filtros */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 15px;
    align-items: flex-end;
    /* Alinea los elementos en la base */
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Regla específica para la fila de botones */
.action-row {
    /* Anulamos el grid de 4 columnas */
    grid-template-columns: auto auto 1fr;
    /* Botón1, Botón2, Spinner que ocupa el resto */
    margin-bottom: 0;
}

/* --- ESTILOS PARA ORDENACIÓN DE TABLAS --- */
th[data-sort-by] {
    cursor: pointer;
    position: relative;
}

th[data-sort-by]:hover {
    background-color: #e9ecef;
}

th[data-sort-by] .fa-sort,
th[data-sort-by] .fa-sort-up,
th[data-sort-by] .fa-sort-down {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

th.sort-asc .fa-sort,
th.sort-desc .fa-sort {
    display: none;
}

th.sort-asc .fa-sort-up {
    color: var(--primary-color);
}

th.sort-desc .fa-sort-down {
    color: var(--primary-color);
}

/* --- ESTILOS DE ESTADO PARA TABLAS --- */

/* Usamos !important para asegurarnos de que estos estilos de fondo 
   sobrescriban los estilos de las filas pares/impares y el hover. */

tr.status-expired {
    background-color: #ffebee !important;
    /* Rojo muy suave */
}

tr.status-active {
    background-color: #e8f5e9 !important;
    /* Verde muy suave */
}

tr.status-future {
    background-color: #fffde7 !important;
    /* Amarillo muy suave */
}

/* Opcional: Para que el texto no se pierda en el color de fondo */
tr.status-expired td {
    color: #c62828;
    /* Rojo oscuro */
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================= */
/* ESTILOS ESPECÍFICOS PARA TARJETAS DE INVENTARIO */
/* ============================================= */

/* Usamos nuestra nueva clase para apuntar solo a estas tarjetas */
.inventory-selection-card .card-content-centered {
    /* Usamos Flexbox para un centrado perfecto */
    display: flex;
    flex-direction: column; /* Apila los elementos verticalmente */
    justify-content: center; /* Centra verticalmente */
    align-items: center;     /* Centra horizontalmente */
    
    /* Aseguramos que ocupe toda la altura de la tarjeta */
    height: 100%; 
    
    /* Añadimos un poco de espacio interno */
    padding: 1rem;
    
    /* Opcional: Centra el texto dentro del h3 y el botón si es necesario */
    text-align: center;
}

/* Espaciado entre el icono y el título
.inventory-selection-card .card-content-centered .fas {
    margin-bottom: 1rem;
} */

/* Espaciado entre el título y el meta (botón) */
.inventory-selection-card .card-content-centered h3 {
    margin-bottom: 1.5rem;
}