/* ═══════════════════════════════════════════════
   ArtGallery — Admin v2
   Tab navigation · Stat cards · Entity lists · Charts
   ═══════════════════════════════════════════════ */

/* ── Tab Panel System ── */
.tab-panel { display: none; animation: tabFadeIn .25s ease; }
.tab-panel.active { display: block; }
@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Section Title ── */
.section-title {
    display: flex;
    align-items: baseline;
    gap: .6rem;
}
.section-title h6 {
    margin: 0;
    font-weight: 700;
    font-size: .95rem;
    color: var(--admin-text);
}
.section-tag {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--admin-accent);
    background: var(--accent-bg, rgba(59,113,202,.10));
    padding: .18rem .55rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ── Breadcrumb in Header ── */
.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.breadcrumb-icon {
    width: 32px; height: 32px;
    background: rgba(59,113,202,.10);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--admin-accent);
    font-size: 1rem;
}
.admin-breadcrumb h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.18rem;
    color: var(--admin-text);
}

/* ═══ STAT CARDS ═══ */
.stat-card {
    background: var(--admin-surface);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.stat-blue::before    { background: #3b71ca; }
.stat-green::before   { background: #16a34a; }
.stat-warning::before { background: #d97706; }
.stat-red::before     { background: #dc2626; }
.stat-purple::before  { background: #7c3aed; }
.stat-teal::before    { background: #0d9488; }

.stat-icon-wrap {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.stat-blue    .stat-icon-wrap { background: rgba(59,113,202,.1);  color: #3b71ca; }
.stat-green   .stat-icon-wrap { background: rgba(22,163,74,.1);   color: #16a34a; }
.stat-warning .stat-icon-wrap { background: rgba(217,119,6,.1);   color: #d97706; }
.stat-red     .stat-icon-wrap { background: rgba(220,38,38,.1);   color: #dc2626; }
.stat-purple  .stat-icon-wrap { background: rgba(124,58,237,.1);  color: #7c3aed; }
.stat-teal    .stat-icon-wrap { background: rgba(13,148,136,.1);  color: #0d9488; }

.stat-body { flex: 1; }
.stat-body h3 {
    font-size: 1.7rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: var(--admin-text);
    font-variant-numeric: tabular-nums;
}
.stat-body p {
    margin: .2rem 0 0;
    color: var(--admin-text-muted);
    font-size: .78rem;
    font-weight: 500;
}

/* ═══ MODULE CARDS (Dashboard) ═══ */
.module-card {
    background: var(--admin-surface);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.4rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    height: 100%;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59,113,202,.25);
}
.module-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.module-blue   { background: rgba(59,113,202,.1);  color: #3b71ca; }
.module-purple { background: rgba(139,92,246,.1);  color: #7c3aed; }
.module-teal   { background: rgba(20,184,166,.1);  color: #0d9488; }

.module-body { flex: 1; min-width: 0; }
.module-body h6 {
    margin: 0 0 .35rem;
    font-weight: 700;
    font-size: .95rem;
    color: var(--admin-text);
}
.module-body p {
    margin: 0 0 .75rem;
    font-size: .8rem;
    color: var(--admin-text-muted);
    line-height: 1.5;
}
.module-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.module-count {
    font-size: .78rem;
    font-weight: 600;
    color: var(--admin-accent);
    background: rgba(59,113,202,.08);
    padding: .2rem .55rem;
    border-radius: 20px;
}
.module-arrow {
    color: var(--admin-accent);
    font-size: 1.15rem;
    opacity: .7;
    transition: var(--transition);
}
.module-card:hover .module-arrow { opacity: 1; transform: translateX(3px); }

/* ═══ RECENT LIST (Dashboard) ═══ */
.recent-list { max-height: 340px; overflow-y: auto; }
.recent-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .8rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background var(--transition);
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #f9fafb; }
.recent-item img {
    width: 44px; height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
}
.recent-item-body { flex: 1; min-width: 0; }
.recent-item-body strong {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--admin-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recent-item-body span {
    font-size: .75rem;
    color: var(--admin-text-muted);
}
.recent-item-status { flex-shrink: 0; }

/* ═══ FILTER TOOLBAR ═══ */
.filter-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--admin-surface);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: .65rem 1rem;
}
.filter-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    min-width: 180px;
}
.filter-search i { color: var(--admin-text-muted); font-size: .9rem; }
.filter-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: .88rem;
    color: var(--admin-text);
    width: 100%;
    font-family: 'DM Sans', sans-serif;
}
.filter-search input::placeholder { color: var(--admin-text-muted); }
.filter-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-select {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: .8rem;
    padding: .35rem .7rem;
    color: var(--admin-text);
    background: #f9fafb;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    font-family: 'DM Sans', sans-serif;
}
.filter-select:focus { border-color: var(--admin-accent); box-shadow: 0 0 0 2px rgba(59,113,202,.1); }

/* ═══ TABLE ═══ */
.table-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid #f3f4f6;
    background: #fafbfc;
    border-radius: 0 0 14px 14px;
}
.table-container-hidden { display: none; }

.table-responsive { border-radius: 12px; overflow: hidden; border: 1px solid rgba(0,0,0,0.03); margin: 0 0.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; font-family: 'DM Sans', sans-serif; background: #fff; }
.admin-table thead th { background: #f8fafc; color: #475569; font-weight: 600; font-size: 0.85rem; padding: 1rem 1.25rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e2e8f0; border-top: none; white-space: nowrap; }
.admin-table tbody td { padding: 1rem 1.25rem; font-size: 0.9rem; color: #334155; border-bottom: 1px solid #f1f5f9; vertical-align: middle; transition: all 0.2s; }
.admin-table tbody tr { transition: all 0.2s ease; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #f8fafc; box-shadow: inset 3px 0 0 var(--admin-accent); transform: translateY(-1px); }
.admin-table img { border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.2s; }
.admin-table tbody tr:hover img { transform: scale(1.05); }

/* ═══ ENTITY LIST (Phong cách / Tác giả) ═══ */
.entity-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    padding: 1.25rem;
    max-height: 600px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}
.entity-item {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 16px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
}
.entity-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.07);
    border-color: rgba(59,113,202,0.18);
}
.entity-color-dot {
    width: 38px; height: 38px;
    border-radius: 10px;
    margin-right: .9rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px solid #fff;
    flex-shrink: 0;
}
.entity-avatar {
    width: 44px; height: 44px;
    border-radius: 12px;
    margin-right: .9rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--admin-accent), #7c3aed);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.entity-body {
    flex: 1;
    min-width: 0;
}
.entity-body strong {
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
    display: block;
}
.entity-body span {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    display: block;
}
.entity-actions {
    display: flex;
    gap: .4rem;
    flex-shrink: 0;
    margin-top: .75rem;
    width: 100%;
    justify-content: flex-end;
}
.entity-actions .btn { padding: .28rem .6rem; font-size: .78rem; border-radius: 8px; }

/* ═══ ADMIN MODAL ═══ */
.admin-modal-content {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--admin-surface);
}
.admin-modal-content .modal-header {
    background: linear-gradient(135deg, rgba(59,113,202,.06), rgba(124,58,237,.04));
    border-bottom: 1px solid #e5e7eb;
    padding: 1.25rem 1.5rem;
}
.admin-modal-content .modal-title {
    font-size: 1rem;
    font-weight: 700;
}
.admin-modal-content .modal-body { padding: 1.5rem; }
.admin-modal-content .modal-footer {
    border-top: 1px solid #f3f4f6;
    padding: 1rem 1.5rem;
    background: #fafbfc;
}

/* Image preview inside modal */
.image-preview-box {
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}
.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    color: #9ca3af;
    font-size: .78rem;
    padding: 1rem;
}
.image-placeholder i { font-size: 1.5rem; }

/* ═══ SIDEBAR ACTIVE STATE ═══ */
.sidebar-nav-link.active {
    background: rgba(59,113,202,.18);
    color: #fff;
    border-left-color: var(--admin-accent);
}

/* ═══ CHART LEGEND ═══ */
.chart-card {
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    border-radius: 20px;
    background: linear-gradient(145deg, #ffffff, #f9fafb);
}
.chart-container-left { width: 300px; height: 300px; flex-shrink: 0; position: relative; }
.chart-legend-right { display: flex; flex-direction: column; gap: 1rem; max-height: 300px; overflow-y: auto; padding-right: .5rem; }
.custom-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .85rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.03);
}
.custom-legend-item:hover { transform: translateX(5px); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; margin-right: .75rem; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.legend-label { font-weight: 600; font-size: .9rem; color: #334155; flex: 1; }
.legend-value { font-weight: 700; color: #0f172a; font-size: .95rem; margin-right: .5rem; }
.legend-percent { font-size: .75rem; font-weight: 600; background: #f1f5f9; padding: .2rem .45rem; border-radius: 6px; color: #64748b; }
.legend-progress-bar { height: 4px; border-radius: 4px; margin-top: .5rem; background: #f1f5f9; overflow: hidden; }
.legend-progress-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* ═══ DARK MODE ═══ */
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .module-card,
[data-bs-theme="dark"] .panel-card,
[data-bs-theme="dark"] .filter-toolbar {
    border-color: rgba(255,255,255,.07);
    background: var(--admin-surface);
}
[data-bs-theme="dark"] .admin-table { background: var(--admin-surface); }
[data-bs-theme="dark"] .admin-table thead th { background: rgba(0,0,0,0.2); border-bottom-color: rgba(255,255,255,0.08); color: #cbd5e1; }
[data-bs-theme="dark"] .admin-table tbody td { border-bottom-color: rgba(255,255,255,0.04); color: #e2e8f0; }
[data-bs-theme="dark"] .admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-bs-theme="dark"] .table-responsive { border-color: rgba(255,255,255,0.05); box-shadow: none; }
[data-bs-theme="dark"] .table-footer { background: rgba(255,255,255,.02); }
[data-bs-theme="dark"] .entity-list { background: rgba(0,0,0,0.15); }
[data-bs-theme="dark"] .entity-item { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.05); }
[data-bs-theme="dark"] .entity-item:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.1); box-shadow: 0 15px 35px rgba(0,0,0,0.3); }
[data-bs-theme="dark"] .entity-body strong { color: #f8fafc; }
[data-bs-theme="dark"] .entity-body span { color: #94a3b8; }
[data-bs-theme="dark"] .recent-item:hover { background: rgba(255,255,255,.03); }
[data-bs-theme="dark"] .filter-select { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: var(--admin-text); }
[data-bs-theme="dark"] .filter-search input { color: var(--admin-text); }
[data-bs-theme="dark"] .image-preview-box { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.1); }
[data-bs-theme="dark"] .admin-modal-content .modal-footer { background: rgba(255,255,255,.02); }
[data-bs-theme="dark"] .admin-modal-content .modal-header { background: rgba(59,113,202,.06); }
[data-bs-theme="dark"] .chart-card { background: var(--admin-surface); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
[data-bs-theme="dark"] .custom-legend-item { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.05); }
[data-bs-theme="dark"] .legend-label { color: #e2e8f0; }
[data-bs-theme="dark"] .legend-value { color: #f8fafc; }
[data-bs-theme="dark"] .legend-percent { background: rgba(255,255,255,0.1); color: #cbd5e1; }
[data-bs-theme="dark"] .legend-progress-bar { background: rgba(255,255,255,0.05); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .filter-toolbar { gap: .5rem; }
    .filter-search { min-width: 0; }
    .filter-group { width: 100%; }
    .filter-select { flex: 1; }
    .module-card { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-body h3 { font-size: 1.4rem; }
    .chart-container-left { width: 100%; height: 260px; }
}
