/* =====================================================================
   COPA EDAM — Panel Admin
   Reutiliza las variables y componentes de theme.css (glass-panel,
   stat-card, card-block, btn-gold, etc.) y añade el shell propio del
   panel: sidebar fija, topbar y widgets del dashboard.
   ===================================================================== */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 270px;
    flex-shrink: 0;
    background: var(--glass-bg-strong);
    border-right: 1px solid var(--glass-border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1100;
}
.admin-sidebar-brand {
    padding: 0 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-sidebar-close { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; line-height: 1; }

.admin-nav-group { margin-bottom: 12px; padding: 0 12px; }
.admin-nav-group-title { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--edam-text-muted); padding: 10px 12px 4px; font-weight: 700; }
.admin-nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    font-size: 0.86rem; font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
}
.admin-nav-link i { width: 18px; text-align: center; color: var(--edam-text-muted); }
.admin-nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.admin-nav-link.active { background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.04)); color: var(--edam-gold-light); }
.admin-nav-link.active i { color: var(--edam-gold-light); }
.admin-sidebar-footer { padding: 16px 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); margin-top: 12px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    position: sticky; top: 0; z-index: 900;
    display: flex; align-items: center; gap: 16px;
    padding: 16px 24px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--glass-border);
}
.admin-page-title { font-size: 1.15rem; margin: 0; font-family: var(--font-display); font-weight: 700; flex: 1; }
.admin-topbar-actions { display: flex; align-items: center; gap: 14px; }

.admin-user-menu {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    color: #fff;
}
.admin-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--edam-gold-pale), var(--edam-gold));
    color: #000; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.78rem; flex-shrink: 0;
}
.admin-user-info { text-align: left; line-height: 1.15; }
.admin-user-name { display: block; font-size: 0.82rem; font-weight: 700; }
.admin-user-role { display: block; font-size: 0.68rem; color: var(--edam-text-muted); }
.admin-user-dropdown { background: var(--edam-navy); border: 1px solid var(--glass-border); }
.admin-user-dropdown .dropdown-item { color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; }
.admin-user-dropdown .dropdown-item:hover, .admin-user-dropdown .dropdown-item:focus { background: rgba(212, 175, 55, 0.12); color: #fff; }

.admin-content { padding: 24px; flex: 1; min-width: 0; }

.admin-kpi-grid .stat-card { text-align: left; padding: 18px; }
.admin-charts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 24px 0; }
.admin-charts-grid canvas { max-width: 100%; }
.admin-bottom-grid { margin-top: 24px; }

.section-subtitle { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin: 6px 0 14px; color: rgba(255, 255, 255, 0.85); }
.quick-access-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quick-access-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 22px 10px; text-align: center; font-size: 0.82rem; font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-access-card i { font-size: 1.4rem; color: var(--edam-gold-light); }
.quick-access-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-gold-glow); }

.admin-list-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: 0.85rem; }
.admin-list-row:first-child { border-top: none; padding-top: 0; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 36px 32px; }

/* ---------------------------------------------------------------------
   Formularios del admin (crear/editar) y controles Bootstrap en tema oscuro
   --------------------------------------------------------------------- */

.admin-body .form-label { color: var(--edam-text-muted); font-size: 0.85rem; font-weight: 600; }
.admin-body .form-control,
.admin-body .form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
}
.admin-body .form-control:focus,
.admin-body .form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--edam-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
    color: #fff;
}
.admin-body .form-control:disabled,
.admin-body .form-control[readonly] { opacity: 0.55; }
.admin-body .form-control::placeholder { color: rgba(255, 255, 255, 0.35); }
.admin-body .form-select option { background: var(--edam-navy); color: #fff; }
.admin-body .form-check-input { background-color: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.25); }
.admin-body .form-check-input:checked { background-color: var(--edam-gold); border-color: var(--edam-gold); }
.admin-body .form-text { color: var(--edam-text-muted); font-size: 0.78rem; }
.admin-body .invalid-feedback { display: block; }

.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.admin-toolbar h2 { margin: 0; }

.form-card { padding: 26px; margin-bottom: 24px; }
.form-card-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.form-card-header h2 { margin: 0 0 4px; font-size: 1.1rem; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

.thumb-preview { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.04); }

/* ---------------------------------------------------------------------
   Tablas de listado (DataTables sobre tema oscuro)
   --------------------------------------------------------------------- */

.table-card { padding: 22px; overflow-x: auto; }
.table-admin { width: 100% !important; color: rgba(255, 255, 255, 0.88); }
.table-admin th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--edam-text-muted); border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important; padding: 10px 12px !important; }
.table-admin td { padding: 10px 12px !important; border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important; vertical-align: middle; }
.table-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.12); }

.badge-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-status.is-on { background: rgba(76, 175, 80, 0.15); color: #6fe07d; }
.badge-status.is-off { background: rgba(220, 38, 38, 0.15); color: #f28b8b; }
.badge-status.is-neutral { background: rgba(212, 175, 55, 0.15); color: var(--edam-gold-light); }

.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.btn-icon-action {
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8); font-size: 0.82rem; transition: background 0.15s ease, color 0.15s ease;
}
.btn-icon-action:hover { background: rgba(212, 175, 55, 0.15); color: var(--edam-gold-light); }
.btn-icon-action.btn-delete:hover { background: rgba(220, 38, 38, 0.18); color: #f28b8b; }

/* DataTables: adaptar controles al tema oscuro */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info { color: var(--edam-text-muted); font-size: 0.82rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: rgba(255, 255, 255, 0.75) !important; border-radius: 8px !important; border: 1px solid transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--edam-gold) !important; color: #000 !important; border-color: var(--edam-gold) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(212, 175, 55, 0.15) !important; color: #fff !important;
}
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:after { opacity: 0.5; }

/* CKEditor sobre tema oscuro */
.ck.ck-editor { color: #1a1a1a; }
.ck.ck-toolbar { background: rgba(255, 255, 255, 0.9) !important; }
.ck.ck-content { min-height: 220px; background: #fff !important; color: #1a1a1a !important; }

/* ---------------------------------------------------------------------
   Responsive: sidebar como drawer por debajo de 992px
   --------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }
    .admin-sidebar.is-open { transform: translateX(0); }
    .admin-sidebar-close { display: inline-block; }
    .admin-content { padding: 18px; }
    .admin-charts-grid { grid-template-columns: minmax(0, 1fr); }
    .quick-access-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
    .btn-drawer-toggle#admin-sidebar-toggle { display: none; }
}
