/* ==========================================
   RESET Y BASES DEL PANEL
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    min-height: 100vh;
}

/* Layout General */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background-color: #003366;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-brand {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-sidebar-link {
    color: #e0e6ed;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.admin-sidebar-link.active {
    background-color: #ffffff;
    color: #003366;
    font-weight: 600;
}

.logout-link {
    color: #ff8a8a;
}

.logout-link:hover {
    background-color: rgba(255, 0, 0, 0.15);
    color: #ff3333;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-x: hidden;
}

.content-card {
    background: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.content-card h1 {
    color: #003366;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.admin-mobile-header {
    display: none;
    background-color: #003366;
    color: #ffffff;
    padding: 1rem 1.5rem;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
}

.admin-mobile-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.admin-menu-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.content-card h1, 
.content-card p,
.word-break {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Formularios */
.admin-form .form-group {
    margin-bottom: 1.2rem;
}

.admin-form label {
    display: block;
    font-weight: 600;
    color: #003366;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background-color: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.15);
}

.btn-primary {
    background-color: #003366;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: #002244;
}

.btn-secondary {
    background-color: #64748b;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Tablas y Acciones */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

.admin-table th {
    background-color: #f1f5f9;
    color: #1e293b;
    font-weight: 600;
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.92rem;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

/* Badges e información */
.meta-info {
    font-size: 0.8rem;
    color: #64748b;
    display: block;
    margin-top: 0.2rem;
}

/* Tabs */
.tab-container {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tab-btn:hover {
    color: #003366;
}

.tab-btn.active {
    color: #003366;
    border-bottom-color: #003366;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.btn-page {
    padding: 0.4rem 0.8rem;
    background-color: #f1f5f9;
    color: #003366;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-page.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Modales */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.5); 
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto; 
    padding: 1.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.2s ease-out;
}

.close-modal {
    color: #64748b;
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #000;
}

.modal-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 1rem;
}

.media-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.media-card-item img, 
.media-card-item video {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

/* Modal Carrusel / Lightbox */
.modal-img-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.modal-img-overlay.active {
    display: flex;
}

.modal-img-overlay .close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    user-select: none;
}

.modal-img-overlay img {
    max-width: 90%;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsivo */
@media (max-width: 768px) {
    .admin-mobile-header {
        display: flex;
    }

    .admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-overlay.active {
        display: block;
    }

    .admin-content {
        padding: 1rem;
    }
}

/* ==========================================================================
   BOTONES MODERNOS UNIFORMES (ADMIN PANEL)
   ========================================================================== */

/* Contenedor de botones alineados */
.action-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

/* Estilo Base Unificado */
.modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 95px; /* Ancho idéntico y uniforme */
    height: 36px;
    padding: 0 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    white-space: nowrap;
    outline: none;
}

.modern-btn svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
    flex-shrink: 0;
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.modern-btn:active {
    transform: translateY(0);
}

/* Variante: VER (Verde Esmeralda) */
.btn-modern-view {
    color: #047857;
    background-color: #ecfdf5;
    border-color: #a7f3d0;
}
.btn-modern-view:hover {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

/* Variante: EDITAR (Azul Índigo) */
.btn-modern-edit {
    color: #4338ca;
    background-color: #eef2ff;
    border-color: #c7d2fe;
}
.btn-modern-edit:hover {
    background-color: #e0e7ff;
    color: #3730a3;
    border-color: #a5b4fc;
}

/* Variante: ELIMINAR (Rojo Carmesí) */
.btn-modern-delete {
    color: #b91c1c;
    background-color: #fef2f2;
    border-color: #fecaca;
}
.btn-modern-delete:hover {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* Variante: DESCARGAR (Verde Slate) */
.btn-modern-download {
    color: #0f766e;
    background-color: #f0fdfa;
    border-color: #99f6e4;
}
.btn-modern-download:hover {
    background-color: #ccfbf1;
    color: #115e59;
}

/* --- Clases de Utilidad para Panel Admin --- */
.text-success-msg { color: #16a34a; font-weight: bold; margin-bottom: 1rem; }
.text-error-msg { color: #dc2626; font-weight: bold; margin-bottom: 1rem; }
.form-container-narrow { max-width: 500px; }
.form-title-spaced { margin-bottom: 1.5rem; color: #334155; }
.text-center-muted { text-align: center; color: #666; }
.text-muted-light { color: #94a3b8; }
.text-danger-bold { color: #dc2626; font-weight: 500; }
.text-danger { color: #dc2626; }
.meta-user-bold { font-weight: 500; color: #475569; }
.meta-date-gray { color: #64748b; }