/* ============================================
   TEACHER DASHBOARD STYLES
   ============================================
   Extends main.css for dashboard-specific layouts.
   Inherits theme variables and global typography.
   ============================================ */

/* ============================================
   BODY OVERRIDE FOR DASHBOARD PAGES
   ============================================
   main.css locks body to viewport with overflow:hidden.
   Dashboard needs to scroll, so we override here.
   ============================================ */
body.dashboard-page {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
}

/* ============================================
   HEADER POLISH FOR DASHBOARD
   ============================================ */
/* Add spacing between logo and badge */
body.dashboard-page .header .python-badge {
    margin-left: 1rem;
}

/* ============================================
   DASHBOARD CONTAINER
   ============================================ */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: calc(var(--header-height, 70px) + 2rem);
    min-height: calc(100vh - var(--header-height, 70px));
}

/* ============================================
   CLASSROOM GRID
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* ============================================
   CARDS (Classroom Cards)
   ============================================ */
.dashboard-card {
    background: var(--bg-light, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.15);
    border-color: var(--primary, #7c3aed);
}

.dashboard-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary, #1e293b);
    font-size: 1.25rem;
}

/* Join Code label - lighter for better contrast */
.dashboard-card .card-label,
.class-header .card-label {
    color: #9ca3af; /* text-gray-400 equivalent */
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Dark mode cards */
body.dark-mode .dashboard-card {
    background: rgba(30, 27, 75, 0.6);
    border-color: rgba(139, 92, 246, 0.3);
}

body.dark-mode .dashboard-card:hover {
    background: rgba(49, 46, 129, 0.8);
    border-color: rgba(139, 92, 246, 0.5);
}

body.dark-mode .dashboard-card h3 {
    color: #e5e5e7;
}

body.dark-mode .dashboard-card .card-label,
body.dark-mode .class-header .card-label {
    color: #6b7280; /* Lighter in dark mode for better contrast */
}

/* ============================================
   JOIN CODE DISPLAY
   ============================================ */
.code-display {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 1.25rem;
    text-align: center;
    padding: 1rem 1.5rem;
    margin-top: 0.75rem;
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary, #f1f5f9);
    border: 2px dashed var(--border-color, #cbd5e1);
    color: var(--primary, #7c3aed);
    font-weight: 600;
    letter-spacing: 0.05em;
    display: inline-block;
    min-width: 200px;
}

body.dark-mode .code-display {
    background: rgba(49, 46, 129, 0.5);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

/* ============================================
   CLASS HEADER (Detail Page)
   ============================================ */
.class-header {
    background: var(--bg-light, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 2rem;
    margin-bottom: 2rem;
}

body.dark-mode .class-header {
    background: rgba(30, 27, 75, 0.6);
    border-color: rgba(139, 92, 246, 0.3);
}

.class-header h1 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .class-header h1 {
    color: #e5e5e7;
}

/* ============================================
   STUDENT TABLE
   ============================================ */
.student-table {
    width: 100%;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    border-collapse: collapse;
    background: var(--bg-light, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .student-table {
    background: rgba(30, 27, 75, 0.6);
    border-color: rgba(139, 92, 246, 0.3);
}

/* Table Headers - Modern Polish */
.student-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #64748b);
    background: var(--bg-secondary, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .student-table th {
    background: rgba(49, 46, 129, 0.5);
    color: #a1a1aa;
    border-bottom-color: rgba(139, 92, 246, 0.2);
}

/* Right-align Challenges Completed column */
.student-table th:last-child,
.student-table td:last-child {
    text-align: right;
    padding-right: 1.5rem;
}

/* Table Rows */
.student-table td {
    padding: 1.25rem;
    color: var(--text-secondary, #64748b);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.9375rem;
}

body.dark-mode .student-table td {
    color: #a1a1aa;
    border-bottom-color: rgba(139, 92, 246, 0.15);
}

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

/* Row hover */
.student-table tbody tr:hover {
    background: var(--bg-secondary, #f8fafc);
}

body.dark-mode .student-table tbody tr:hover {
    background: rgba(49, 46, 129, 0.3);
}

/* Student name - bold */
.student-table td:first-child {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .student-table td:first-child {
    color: #e5e5e7;
}

/* ============================================
   PROGRESS BADGE
   ============================================ */
.progress-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-create {
    background: var(--primary, #7c3aed);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.btn-create:hover {
    background: var(--primary-dark, #6d28d9);
    transform: translateY(-1px);
}

.btn-back {
    background: var(--primary, #7c3aed);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: var(--primary-dark, #6d28d9);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem;
    border: 2px dashed var(--border-color, #cbd5e1);
    border-radius: var(--radius-lg, 12px);
    color: var(--text-secondary, #64748b);
    grid-column: 1 / -1;
}

body.dark-mode .empty-state {
    border-color: rgba(139, 92, 246, 0.3);
    color: #a1a1aa;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .empty-state h3 {
    color: #e5e5e7;
}

/* ============================================
   PAGE TITLE ROW
   ============================================ */
.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 2rem; /* Ensure spacing between title and button */
}

.page-title-row h1,
.page-title-row h2 {
    margin: 0;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .page-title-row h1,
body.dark-mode .page-title-row h2 {
    color: #e5e5e7;
}

/* ============================================
   SECTION HEADER (e.g., "Students Enrolled")
   ============================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
    color: var(--text-primary, #1e293b);
    font-size: 1.25rem;
}

body.dark-mode .section-header h2 {
    color: #e5e5e7;
}

.section-header .count {
    color: var(--text-secondary, #64748b);
    font-size: 0.875rem;
}

body.dark-mode .section-header .count {
    color: #a1a1aa;
}
