/* ==========================================
   BASE
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

.admin-body {
    min-height: 100vh;
    background: var(--bg-main);
    /* CAMBIO: Reducir padding en móvil para maximizar ancho */
    padding: 0.5rem;
}

@media (min-width: 768px) {
    .admin-body {
        padding: 1rem 1.5rem;
    }
}

.hidden {
    display: none !important;
}

.no-scroll {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ==========================================
   LOGIN
   ========================================== */
.admin-login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-login-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: var(--radius-soft);
    box-shadow: var(--shadow-soft);
    padding: 2rem;
}

.admin-login-card h1 {
    margin-bottom: 0.5rem;
    font-size: 2rem;
    text-align: center;
}

.admin-login-card p {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

.admin-message {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.95rem;
    color: #b00020;
}

/* ==========================================
   DASHBOARD
   ========================================== */
.admin-dashboard {
    /* CAMBIO: Eliminar max-width para usar todo el ancho disponible */
    max-width: 100%;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

@media(min-width: 768px) {
    .admin-header {
        flex-direction: row;
        align-items: center;
    }
}

.admin-header h1 {
    margin-bottom: 0.3rem;
}

.admin-header p {
    color: #666;
}

/* ==========================================
   PANEL Y TABS
   ========================================== */
.admin-panel {
    background: #ffffff;
    border-radius: var(--radius-soft);
    box-shadow: var(--shadow-soft);
    padding: 0.75rem;
    /* CAMBIO: Contener todo el contenido, modificado para no cortar sombras/hover */
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .admin-panel {
        padding: 1.5rem;
    }
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .admin-tabs {
        gap: 1rem;
    }
}

.admin-tab {
    border: none;
    background: var(--bg-secondary);
    color: var(--primary);
    padding: 0.6rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .admin-tab {
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
}

.admin-tab.active {
    background: var(--primary);
    color: #ffffff;
}

.admin-tab-content {
    display: none;
}

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

.admin-section-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

@media(min-width: 768px) {
    .admin-section-head {
        flex-direction: row;
        align-items: center;
    }
}

/* ==========================================
   TABLAS
   ========================================== */
.admin-table-wrapper {
    width: 100%;
    /* CAMBIO: Asegurar scroll horizontal en móvil */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.admin-table th,
.admin-table td {
    padding: 0.9rem 0.8rem;
    border-bottom: 1px solid #e9e9e9;
    text-align: left;
    vertical-align: top;
    font-size: 0.95rem;
}

.admin-table th {
    color: var(--primary);
    font-weight: 600;
    background: #fafafa;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-action {
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-edit {
    background: #e9f2ff;
    color: #1d4f91;
}

.btn-delete {
    background: #ffe9e9;
    color: #a12626;
}

/* ==========================================
   DRAG & DROP
   ========================================== */
.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    color: #aaa;
    user-select: none;
    display: inline-block;
    padding: 0.1rem 0.3rem;
    margin-right: 0.3rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    vertical-align: middle;
}

.drag-handle:hover {
    color: var(--primary);
    background: #e9f2ff;
}

.drag-handle:active,
.sortable-chosen .drag-handle {
    cursor: grabbing;
    color: var(--primary);
}

.sortable-ghost {
    background: #e9f2ff !important;
    opacity: 0.6;
}

.sortable-chosen {
    background: #f5f8ff !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.orden-num {
    font-weight: 600;
    color: #555;
    vertical-align: middle;
}

.orden-saving {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================
   MODALES — ESTRUCTURA
   ========================================== */
.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem 3rem 1rem;
    z-index: 999;
    animation: fadeInBackdrop 0.2s ease;
    overflow-y: auto;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.admin-modal-card {
    width: 100%;
    max-width: 620px;
    overflow: visible;
    background: #ffffff;
    border-radius: var(--radius-soft);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    padding: 0;
    animation: slideUpModal 0.25s ease;
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-radius: var(--radius-soft) var(--radius-soft) 0 0;
}

.admin-modal-head h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
}

.admin-close-btn {
    border: none;
    background: #f5f5f5;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.admin-close-btn:hover {
    background: #ffe9e9;
    color: #a12626;
}

/* ==========================================
   MODALES — FORMULARIO GRID
   ========================================== */
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1rem;
    padding: 1.5rem;
}

.modal-form-grid .full-width {
    grid-column: 1 / -1;
}

.modal-form-grid .form-group {
    margin-bottom: 0;
}

@media (max-width: 540px) {
    .modal-form-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .admin-modal {
        padding: 0.5rem;
        align-items: center;
    }

    .admin-modal-card {
        border-radius: var(--radius-soft);
    }
}

/* ==========================================
   FORMULARIOS — CAMPOS
   ========================================== */
.admin-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--primary);
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form input[type="time"],
.admin-form input[type="month"],
.admin-form input[type="datetime-local"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* Altura homogénea para campos de una línea */
.admin-form input:not(textarea),
.admin-form select {
    height: 42px;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.1);
}

/* Forzar que el icono del selector sea siempre visible */
.admin-form input::-webkit-calendar-picker-indicator {
    opacity: 1;
    cursor: pointer;
}

.admin-form textarea {
    resize: vertical;
    min-height: 70px;
}

.admin-form select {
    appearance: auto;
    cursor: pointer;
}

.admin-form input::placeholder,
.admin-form textarea::placeholder {
    color: #bbb;
}

.admin-form .btn {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ==========================================
   SUBGRUPO / CATEGORÍA — NUEVO
   ========================================== */
#subgrupoNuevoGroup,
#categoriaNuevoGroup {
    transition: all 0.2s ease;
}

#subgrupoNuevoGroup:not(.hidden),
#categoriaNuevoGroup:not(.hidden) {
    animation: fadeSlideDown 0.25s ease;
}

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

/* ==========================================
   IMAGEN — TOGGLE URL / ARCHIVO
   ========================================== */
.imagen-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.img-toggle-btn {
    flex: 1;
    padding: 0.55rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
    font-family: inherit;
}

.img-toggle-btn:hover {
    border-color: #bbb;
    background: #f0f0f0;
}

.img-toggle-btn.active {
    border-color: var(--primary);
    background: #e9f2ff;
    color: var(--primary);
    font-weight: 600;
}

.img-upload-hint {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.4rem;
}

.img-upload-status {
    font-size: 0.85rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.img-upload-status.uploading { color: #666; }
.img-upload-status.success { color: #2b7a2b; }
.img-upload-status.error { color: #a12626; }

.img-preview-container {
    margin-top: 0.3rem;
}

.img-preview-container label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--primary);
}

.img-preview-container img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 0.5rem;
}

.btn-remove-img {
    border: none;
    background: #ffe9e9;
    color: #a12626;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-remove-img:hover {
    background: #ffd4d4;
}

.admin-form input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: #fafafa;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.admin-form input[type="file"]:hover {
    border-color: var(--primary);
}

/* ==========================================
   SCROLLBAR SUTIL EN MODALES
   ========================================== */
.admin-modal-card::-webkit-scrollbar {
    width: 6px;
}

.admin-modal-card::-webkit-scrollbar-track {
    background: transparent;
}

.admin-modal-card::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.admin-modal-card::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ==========================================
   TESTIMONIOS — TABLA Y PREVIEW
   ========================================== */
.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
    display: block; 
    min-width: 40px;
    min-height: 40px;
    aspect-ratio: 1 / 1;
}

.table-avatar-placeholder {
    width: 40px;
    height: 40px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #aaa;
    flex-shrink: 0;
}

.avatar-preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.preview-avatar {
    width: 90px;
    height: 90px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #eee;
    flex-shrink: 0;
    display: block;
}

/* ==========================================
   CAMPO GENERADO CON BOTÓN EDITAR
   ========================================== */
.generated-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.6rem 0.8rem;
    background: #f8f9fa;
    border: 1px solid #e9e9e9;
    border-radius: 8px;
    margin-bottom: 0.4rem;
}

.generated-field-preview {
    flex: 1;
    min-width: 0;
}

.generated-field-preview label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.15rem;
    font-weight: 500;
}

.preview-text {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    word-break: break-word;
}

.btn-edit-text {
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-edit-text:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #e9f2ff;
}

/* ==========================================
   FIELD HINT (textos de ayuda)
   ========================================== */
.field-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #999;
    line-height: 1.3;
}

/* ==========================================
   ORDEN — HINT INTELIGENTE
   ========================================== */
.orden-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
    line-height: 1.3;
}

/* ==========================================
   BOTONES DE ORDENAMIENTO POR FECHA
   ========================================== */
.section-head-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.sort-buttons {
    display: flex;
    gap: 0.4rem;
}

.btn-sort {
    border: 2px solid #ddd;
    background: #fafafa;
    color: #555;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-sort:hover {
    border-color: var(--primary);
    background: #e9f2ff;
    color: var(--primary);
}

.btn-sort:active {
    transform: scale(0.96);
}

/* ==========================================
   DATETIME-LOCAL Y TIME INPUTS
   ========================================== */
.admin-form input[type="datetime-local"],
.admin-form input[type="time"],
.admin-form input[type="date"] {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.admin-form input[type="datetime-local"]:focus,
.admin-form input[type="time"]:focus,
.admin-form input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.1);
}

/* ==========================================
   VISTA AGRUPADA DE ACTIVIDADES
   ========================================== */

#actividadesContainer {
    display: flex;
    flex-direction: column;
    /* CAMBIO: Más separación entre categorías */
    gap: 2.5rem;
}

/* Categoría */
.admin-categoria-group {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    /* Contener visualmente pero permitir scroll interno */
    overflow: hidden;
}

.admin-categoria-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.admin-categoria-header .cat-handle {
    cursor: grab;
    font-size: 1.2rem;
    color: #999;
    user-select: none;
}

.admin-categoria-header .cat-handle:hover {
    color: #333;
}

.admin-categoria-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a2e;
}

/* Subgrupo */
.admin-subgrupos-container {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-subgrupo-group {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fafbfc;
}

.admin-subgrupo-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f0f2f5;
    border-bottom: 1px solid #eee;
}

.admin-subgrupo-header .sub-handle {
    cursor: grab;
    font-size: 1rem;
    color: #aaa;
    user-select: none;
}

.admin-subgrupo-header .sub-handle:hover {
    color: #333;
}

.admin-subgrupo-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #444;
}

.admin-subgrupo-badge {
    background: var(--primary, #4a6cf7);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: auto;
}

.admin-subgrupo-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    box-sizing: border-box;
}

.admin-table-nested {
    margin: 0;
    border: none;
    border-radius: 0;
    font-size: 0.9rem;
    min-width: 550px;
    width: 100%;
    table-layout: auto;
}

.admin-table-nested thead th {
    background: #f7f8fa;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    color: #777;
}

.admin-table-nested tbody td {
    padding: 0.5rem 0.75rem;
}

.admin-table-nested .act-handle {
    cursor: grab;
    color: #bbb;
    margin-right: 0.25rem;
}

.admin-table-nested .act-handle:hover {
    color: #333;
}

/* Drag & drop visual para grupos */
.admin-categoria-group.sortable-ghost,
.admin-subgrupo-group.sortable-ghost {
    opacity: 0.4;
    background: #e8f0fe;
}

.admin-categoria-group.sortable-chosen,
.admin-subgrupo-group.sortable-chosen {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Reemplaza la regla CLAVE existente por esta */
#actividadesContainer,
.admin-subgrupos-container,
.admin-categoria-group,
.admin-subgrupo-group,
.admin-subgrupo-table-wrapper {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#tab-actividades {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#categoriasContainer {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* ==========================================
   RESPONSIVE — MÓVIL
   ========================================== */
@media (max-width: 768px) {
    .admin-table-nested {
        font-size: 0.8rem;
    }

    .admin-subgrupo-header {
        padding: 0.5rem 0.75rem;
    }

    .admin-categoria-header {
        padding: 0.75rem 1rem;
    }

    /* CAMBIO: Reducir padding general en móvil */
    .admin-categoria-title {
        font-size: 1rem;
    }

    .admin-subgrupo-title {
        font-size: 0.85rem;
    }
}

/* ==========================================
   GALERÍA — Panel Admin
   ========================================== */

/* --- Cabecera con toggle y botón subir --- */
.galeria-view-toggle {
    display: flex;
    gap: 4px;
}

#btnSubirGaleria {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#btnSubirGaleria input[type="file"] {
    display: none;
}

/* --- Zona de Drag & Drop --- */
.galeria-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed #c8c8c8;
    border-radius: 12px;
    padding: 36px 20px;
    margin: 16px 0;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
    color: #666;
}

.galeria-drop-zone:hover,
.galeria-drop-zone.drag-over {
    border-color: var(--primary, #7a5c3b);
    background: #f5f0ea;
    color: #333;
}

.galeria-drop-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.galeria-drop-zone p {
    margin: 0;
    font-size: 0.95rem;
}

.galeria-drop-hint {
    font-size: 0.8rem !important;
    color: #999;
}

/* --- Barra de progreso de subida --- */
.galeria-upload-status {
    margin: 0 0 16px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.galeria-upload-status.hidden {
    display: none;
}

.galeria-upload-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.galeria-upload-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary, #7a5c3b);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.galeria-upload-status p {
    margin: 0;
    font-size: 0.85rem;
    color: #444;
    font-weight: 500;
}

/* --- Grid de imágenes --- */
.galeria-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 4px 0 24px;
}

/* --- Card individual (vista grid) --- */
.galeria-admin-card {
    position: relative;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
}

.galeria-admin-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.galeria-admin-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
}

.galeria-admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.galeria-admin-card:hover .galeria-admin-thumb img {
    transform: scale(1.04);
}

.galeria-admin-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-top: 1px solid #f0f0f0;
}

.galeria-admin-nombre {
    font-size: 0.78rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.galeria-admin-peso {
    font-size: 0.72rem;
    color: #999;
}

/* --- Botón borrar en la card --- */
.galeria-admin-borrar {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(180, 30, 30, 0.85);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
}

.galeria-admin-card:hover .galeria-admin-borrar {
    opacity: 1;
    transform: scale(1);
}

.galeria-admin-borrar:hover {
    background: rgba(180, 30, 30, 1);
}

/* --- Vista lista --- */
.galeria-admin-lista {
    padding: 4px 0 24px;
}

.galeria-lista-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: block;
}

/* --- Estado vacío / mensaje --- */
.galeria-empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 0.95rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .galeria-admin-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }

    .galeria-admin-borrar {
        opacity: 1;
        transform: scale(1);
    }

    .galeria-drop-zone {
        padding: 24px 16px;
    }
}

/* ==========================================
   GALERÍA — Barra de configuración
   ========================================== */

.galeria-config-bar {
    background: #f9f7f4;
    border: 1px solid #e8e0d5;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.galeria-config-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.galeria-config-field > label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.galeria-config-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: #888;
}

.galeria-config-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.galeria-config-input-row input[type="number"] {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid #d0c8be;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}

.galeria-config-input-row input[type="number"]:focus {
    outline: none;
    border-color: var(--primary, #7a5c3b);
}

.galeria-config-input-row input[type="number"]::-webkit-outer-spin-button,
.galeria-config-input-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.galeria-config-input-row .btn {
    padding: 8px 18px;
    font-size: 0.9rem;
}

/* --- Mensaje de feedback inline --- */
.galeria-config-msg {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    transition: opacity 0.2s;
}

.galeria-config-msg.hidden {
    display: none;
}

.galeria-config-msg--success {
    color: #2b7a2b;
    background: #e8f5e9;
}

.galeria-config-msg--error {
    color: #a12626;
    background: #fdecea;
}

/* --- Texto informativo de total --- */
.galeria-config-total {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .galeria-config-bar {
        padding: 14px 16px;
    }

    .galeria-config-input-row {
        gap: 8px;
    }

    .galeria-config-input-row input[type="number"] {
        width: 75px;
    }
}

/* ==========================================
   CUSTOM DROPDOWN (Categorias/Subgrupos)
   ========================================== */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-input {
    width: 100%;
    box-sizing: border-box;
    /* Estilos se heredan de los inputs normales del panel */
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card, #fff);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.custom-select-dropdown.hidden {
    display: none;
}

.custom-select-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-color, #333);
    transition: background 0.2s ease, color 0.2s ease;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: rgba(0, 0, 0, 0.03);
}

.custom-select-option.new-option {
    color: var(--primary, #0056b3);
    font-weight: 500;
}
.custom-select-option.new-option:hover {
    background: rgba(0, 86, 179, 0.05);
}

/* ==========================================
   TOGGLE SWITCH (Notificaciones)
   ========================================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--primary, #0056b3);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==========================================
   CUSTOM TIME PICKER (Inline)
   ========================================== */
.custom-time-picker {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 0.8rem;
    background: #fff;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    box-sizing: border-box;
    height: 42px;
    width: 100%;
}

.custom-time-picker input[type="number"] {
    width: 45px;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    padding: 0;
    margin: 0;
    background: transparent;
    color: var(--text-color, #333);
    border-radius: 4px;
}

.custom-time-picker input[type="number"]:focus,
.custom-time-picker select:focus {
    outline: 2px solid rgba(0, 86, 179, 0.2);
    background: rgba(0, 86, 179, 0.05);
}

/* Selector dividido al 50% cada parte */
.custom-time-picker.picker-split {
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.custom-time-picker.picker-split > input.time-hh,
.custom-time-picker.picker-split > select.time-ampm {
    flex: 1;
    width: 50%;
    height: 100%;
    text-align: center;
    border: none;
    border-radius: 0;
    padding: 0 10px;
}

.custom-time-picker.picker-split > input.time-hh {
    border-right: 1px solid #ddd;
}

.custom-time-picker select.time-ampm {
    border: none;
    background: transparent;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color, #333);
    padding: 0;
    border-radius: 4px;
    height: 100%;
}

.custom-time-picker:not(.picker-split) select.time-ampm {
    margin-left: 2px;
}

.btn-clear-time:hover {
    color: #e74c3c !important;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-message {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #555;
}

/* Tipos de Toast */
.toast--success { border-left-color: #2b7a2b; }
.toast--success .toast-icon { color: #2b7a2b; }

.toast--error { border-left-color: #a12626; }
.toast--error .toast-icon { color: #a12626; }

.toast--info { border-left-color: var(--primary); }
.toast--info .toast-icon { color: var(--primary); }

.toast--warning { border-left-color: #e65100; }
.toast--warning .toast-icon { color: #e65100; }

/* Progress bar inside toast */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    width: 100%;
}

.toast-progress-fill {
    height: 100%;
    background: inherit;
    width: 0%;
    transition: width linear;
}

.toast--success .toast-progress-fill { background: rgba(43, 122, 43, 0.2); }
.toast--error .toast-progress-fill { background: rgba(161, 38, 38, 0.2); }
.toast--info .toast-progress-fill { background: rgba(44, 62, 80, 0.2); }
.toast--warning .toast-progress-fill { background: rgba(230, 81, 0, 0.2); }