/* Panel de Administración */

/* Header admin: no recortar el dropdown */
.header.teal-header {
    overflow: visible !important;
    padding-right: 0.75rem !important;
}
/* Header: título a la izquierda, perfil en la esquina superior derecha (donde el círculo) */
.header.teal-header .header-content {
    display: flex !important;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    max-width: 100%;
    min-height: 3rem;
    position: relative;
    gap: 1rem;
}
.header.teal-header .header-content .header-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 3rem;
}
/* Perfil (Cargando...) en la esquina superior derecha del header */
.header.teal-header .header-content .profile-dropdown-wrapper {
    flex-shrink: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

/* Menú: posición base; al abrir, JS fija top/right para alinearlo con el botón */
#adminProfileDropdown,
div#adminProfileDropdown.profile-dropdown {
    position: absolute;
    top: 100%;
    left: auto;
    right: 0;
    bottom: auto;
    margin-top: 0.5rem;
    margin-left: 0;
    margin-right: 0;
    width: 240px;
    min-width: 200px;
    max-width: calc(100vw - 2rem);
    z-index: 999999 !important;
    transform-origin: top right !important;
    box-sizing: border-box !important;
}
#adminProfileDropdown:not(.is-open) {
    transform: translateY(-6px) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
#adminProfileDropdown.is-open {
    position: fixed !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
/* Flecha que une el menú con el botón */
#adminProfileDropdown::before {
    display: block !important;
    top: -7px !important;
    bottom: auto !important;
    right: 22px !important;
    left: auto !important;
    transform: rotate(45deg) !important;
}

.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem;
    background: #f5f5f5;
    min-height: calc(100vh - 200px);
}

.admin-nav {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-tab:hover {
    color: #2c7a7b;
    background: #f0f9f9;
}

.nav-tab.active {
    color: #2c7a7b;
    border-bottom-color: #2c7a7b;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.2rem;
}

.admin-section {
    display: none;
    animation: fadeIn 0.3s;
    padding: 0;
}

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

.admin-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c7a7b;
    margin: 0 0 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 3px solid #e0e0e0;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.section-header h2 {
    margin: 0;
    color: #2c7a7b;
    font-size: 1.75rem;
    font-weight: 700;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c7a7b 0%, #38a3a5 100%);
    border-radius: 12px;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c7a7b;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

#btnPreviewCharts {
    transition: all 0.3s ease;
}

#btnPreviewCharts:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(128, 90, 213, 0.4) !important;
}

#btnPreviewCharts:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(128, 90, 213, 0.3) !important;
}

.btn-quick-action:hover {
    background: #e6fffa !important;
    border-color: #2c7a7b !important;
    color: #234e52 !important;
}
.btn-quick-action:active {
    transform: scale(0.98);
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    box-sizing: border-box;
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    color: #2c7a7b;
    font-size: 1.3rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.chart-placeholder {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 1rem;
    padding: 1.5rem;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-input, .filter-select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    flex: 1;
    min-width: 200px;
}

.filter-select {
    flex: 0 1 auto;
    min-width: 150px;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
    margin-top: 1rem;
}

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

.admin-table thead {
    background: #2c7a7b;
    color: white;
}

.admin-table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f9f9f9;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-primary {
    background: #cfe2ff;
    color: #084298;
}

.badge-secondary {
    background: #e2e3e5;
    color: #41464b;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: #f0f0f0;
}

.btn-icon.edit {
    color: #2c7a7b;
}

.btn-icon.delete {
    color: #dc3545;
}

.btn-icon.activate {
    color: #28a745;
}

.btn-icon.warning {
    color: #ff9800;
}

.btn-icon.ban {
    color: #dc3545;
}

.btn-icon.info {
    color: #17a2b8;
}

.badge-warning {
    background: #ff9800;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #2c7a7b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2c7a7b;
    box-shadow: 0 0 0 3px rgba(44, 122, 123, 0.1);
}

/* Estilos para campos deshabilitados */
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background-color: #f5f5f5 !important;
    color: #666 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    border-color: #ddd !important;
}

.form-group label:has(+ input:disabled),
.form-group label:has(+ select:disabled),
.form-group label:has(+ textarea:disabled) {
    color: #999;
    cursor: not-allowed;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

/* Categorías Container */
.categorias-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.categoria-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.categoria-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.categoria-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c7a7b;
}

.subcategorias-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.subcategoria-badge {
    padding: 0.75rem 1.25rem;
    background: #f0f9f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.subcategoria-badge:hover {
    background: #e0f5f5;
    border-color: #2c7a7b;
    transform: translateY(-1px);
}

/* Comentarios Container */
.comentarios-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comentario-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.comentario-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.comentario-user {
    font-weight: 600;
    color: #2c7a7b;
}

.comentario-date {
    color: #999;
    font-size: 0.9rem;
}

.comentario-text {
    color: #333;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.comentario-meta {
    display: flex;
    gap: 1rem;
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Records Grid */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.record-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.record-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.record-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.record-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c7a7b;
    flex: 1;
    margin-right: 1rem;
}

.record-body {
    padding: 1.5rem;
}

.record-body p {
    margin: 0.75rem 0;
    color: #555;
    line-height: 1.6;
}

.record-body p:first-child {
    margin-top: 0;
}

.record-body p:last-child {
    margin-bottom: 0;
}

.record-body strong {
    color: #333;
    font-weight: 600;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    color: #999;
    font-size: 1.1rem;
}

.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
    font-size: 1.1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive e iOS */
@media (max-width: 768px) {
    .admin-nav {
        padding: 1rem;
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .nav-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-main {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Header admin en iOS: safe area superior */
.header.teal-header {
    padding-top: max(0.75rem, env(safe-area-inset-top)) !important;
}

