/* ══════════════════════════════════════════════
   DASHBOARD & ADMIN — shadcn-inspired components
   ══════════════════════════════════════════════ */

/* ── Page layout ── */
.dash-page { max-width: 960px; margin: 0 auto; padding: 0 1rem 3rem; }
.dash-page-sm { max-width: 520px; margin: 0 auto; padding: 0 1rem 3rem; }
.dash-page-md { max-width: 680px; margin: 0 auto; padding: 0 1rem 3rem; }

/* ── Page header ── */
.dash-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 1rem;
    padding: 1.25rem 0; margin-bottom: .5rem;
    border-bottom: 1px solid var(--border-color);
}
.dash-header-info h1 { font-size: 1.375rem; font-weight: 700; margin-bottom: .125rem; }
.dash-header-info p { font-size: .8125rem; color: var(--text-secondary); }
.dash-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Stats row ── */
.dash-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem; margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1rem;
}
.stat-card .stat-label {
    font-size: .6875rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem;
}
.stat-card .stat-value {
    font-size: 1.5rem; font-weight: 700; color: var(--text-primary);
}

/* ── Card wrapper ── */
.dash-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); overflow: hidden;
}
.dash-card-header {
    padding: .875rem 1rem; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.dash-card-header h3 { font-size: .875rem; font-weight: 600; }
.dash-card-body { padding: 1rem; }

/* ── Tables ── */
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th {
    padding: .625rem 1rem; text-align: left;
    font-size: .6875rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border-color);
}
.dash-table td {
    padding: .625rem 1rem; font-size: .8125rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: rgba(255,255,255,.02); }
.dash-table .user-cell {
    display: flex; align-items: center; gap: .625rem;
}
.dash-table .user-cell img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.dash-table .user-cell span { font-weight: 500; }
.dash-table .actions-cell { text-align: right; white-space: nowrap; }
.dash-table .action-link {
    background: none; border: none; cursor: pointer;
    font-size: .8125rem; font-weight: 500; font-family: inherit;
    padding: .25rem .5rem; border-radius: var(--radius-sm);
    transition: background .15s;
}
.dash-table .action-link:hover { background: rgba(255,255,255,.05); }
.action-edit { color: var(--primary); }
.action-delete { color: var(--danger); }

/* ── Forms (shared for dashboard/admin pages) ── */
.form-control, .form-input, .input-premium {
    width: 100%;
    padding: .5rem .75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: .8125rem;
    font-family: inherit;
    transition: border-color .15s;
    outline: none;
}
.form-control:focus, .form-input:focus, .input-premium:focus {
    border-color: var(--border-light);
}
.form-control:disabled { opacity: .4; cursor: not-allowed; }

select.form-control, select.input-premium {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23737373' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
}
select option { background: var(--bg-secondary); color: var(--text-primary); }

textarea.form-control { resize: vertical; min-height: 72px; }

.form-group label, .form-group .form-label {
    display: block; margin-bottom: .375rem;
    font-size: .75rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .04em;
}

/* Checkboxes */
.form-check {
    display: flex; align-items: center; gap: .5rem;
    font-size: .8125rem; cursor: pointer;
}
.form-check input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--primary);
    cursor: pointer;
}

/* ── Modals (for admin CRUD) ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}
.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 92%; max-width: 440px;
    padding: 1.25rem;
    animation: modalSlideUp .25s ease-out;
}
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-box h2, .modal-box h3 {
    font-size: 1rem; font-weight: 600; margin-bottom: 1rem;
}
.modal-box .form-actions {
    display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem;
}

/* ── Drop zone ── */
.drop-zone {
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--text-muted);
}
.drop-zone-content p { font-size: .8125rem; color: var(--text-secondary); }

/* ── Progress bar ── */
.progress-bar-bg {
    width: 100%; height: 4px;
    background: var(--border-color); border-radius: 2px;
    overflow: hidden;
}
.progress-bar-fill {
    width: 0%; height: 100%;
    background: var(--primary);
    transition: width .3s ease;
    border-radius: 2px;
}

/* ── Empty states ── */
.empty-state {
    padding: 3rem 1.5rem; text-align: center;
}
.empty-state i { font-size: 2rem; color: var(--text-muted); margin-bottom: .75rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: .375rem; color: var(--text-secondary); }
.empty-state p { font-size: .8125rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ── Playlist / lesson cards for dashboard ── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }

.dash-list-item {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: .875rem 1rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; transition: border-color .15s;
}
.dash-list-item:hover { border-color: var(--border-light); }

/* ── Resource search results ── */
.resource-results-list {
    max-height: 180px; overflow-y: auto;
    border-radius: var(--radius-sm);
    padding: .25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.resource-item {
    padding: .5rem .75rem; cursor: pointer;
    border-radius: var(--radius-sm); font-size: .8125rem;
    transition: background .15s;
}
.resource-item:hover { background: rgba(255,255,255,.05); }
.resource-item.selected { background: var(--primary); color: #fff; }

/* ── Auth pages ── */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 2rem;
    width: 100%; max-width: 380px;
}
.auth-card .auth-header {
    text-align: center; margin-bottom: 1.5rem;
}
.auth-card .auth-header h1 {
    font-size: 1.375rem; font-weight: 700; margin-bottom: .25rem;
}
.auth-card .auth-header p {
    font-size: .8125rem; color: var(--text-secondary);
}
.auth-card .auth-icon {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(0,149,246,.1);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto .875rem;
}
.auth-card .auth-icon i { font-size: 1.25rem; color: var(--primary); }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .8125rem; }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer span { color: var(--text-muted); }
.auth-divider {
    text-align: center; font-size: .75rem; color: var(--text-muted);
    margin-top: .75rem;
}
.auth-divider a { color: var(--text-secondary); text-decoration: none; }
.auth-divider a:hover { color: var(--text-primary); }

/* ── Scrollbar for admin lists ── */
.dash-card-body::-webkit-scrollbar, #lessons-list::-webkit-scrollbar { width: 3px; }
.dash-card-body::-webkit-scrollbar-thumb, #lessons-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* ── Back link ── */
.back-link {
    display: inline-flex; align-items: center; gap: .375rem;
    color: var(--text-secondary); font-size: .8125rem;
    text-decoration: none; margin-bottom: 1rem;
    transition: color .15s;
}
.back-link:hover { color: var(--text-primary); }
.back-link i { font-size: .625rem; }
