/* Dashboard page - styles by prototype dashboard.html */
/* All class names use ds- prefix for this page */

/* Design tokens: one radius and spacing for all interactive elements */
:root {
    --ds-radius: 8px;
    --ds-primary: #1446A0;
    --ds-primary-hover: #0f3580;
    --ds-secondary: #0c5460;
    --ds-secondary-hover: #09404d;
    --ds-border: #e0e0e0;
    --ds-btn-padding: 3px 10px;
    --ds-btn-font-size: var(--font-size-label);
    --ds-btn-font-weight: 600;
    --ds-btn-border: 1px solid #e0e0e0;
}

.ds-container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 8px 16px;
    min-height: 0;
    box-sizing: border-box;
}

/* Hero: как в прототипе — два столбца, на узких 1 колонка (560px) */
.ds-hero-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
@media (max-width: 560px) {
    .ds-hero-row { grid-template-columns: 1fr; }
}

.ds-hero-card {
    border-radius: var(--ds-radius);
    padding: 10px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 0;
}
.ds-hero-card--continue {
    background: linear-gradient(135deg, #1446A0 0%, #1a5bc7 100%);
    color: #fff;
    box-shadow: 0 1px 4px rgba(20, 70, 160, 0.2);
}
.ds-hero-card--review {
    background: linear-gradient(135deg, #0c5460 0%, #117a8b 100%);
    color: #fff;
    box-shadow: 0 1px 4px rgba(12, 84, 96, 0.2);
}
.ds-hero-label { font-size: var(--font-size-label); opacity: 0.9; margin-bottom: 2px; }
.ds-hero-title { font-size: var(--font-size-body); font-weight: 700; margin-bottom: 2px; line-height: 1.2; }
.ds-hero-meta { font-size: var(--font-size-label); opacity: 0.9; margin-bottom: 0; }
.ds-hero-btn {
    flex-shrink: 0;
    padding: var(--ds-btn-padding);
    border-radius: var(--ds-radius);
    font-weight: var(--ds-btn-font-weight);
    font-size: var(--ds-btn-font-size);
    text-decoration: underline;
    transition: opacity 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.ds-hero-card--continue .ds-hero-btn { background: #fff; color: var(--ds-primary); }
.ds-hero-card--review .ds-hero-btn { background: #fff; color: var(--ds-secondary); }
.ds-hero-card--continue .ds-hero-btn:hover,
.ds-hero-card--review .ds-hero-btn:hover { opacity: 0.92; text-decoration: underline; }
.ds-hero-empty { min-height: 40px; }
/* Student slim: hero omitted (callbacks still target ds-hero-*) */
.ds-hero-row--hidden-student {
    display: none !important;
}

/* Student: one column for Ucheba + feedback stack */
.ds-dashboard-grid--student-slim {
    grid-template-columns: 1fr !important;
}
.ds-two-col--student-single {
    grid-template-columns: 1fr !important;
}

.ds-feedback-section-subtitle {
    font-size: var(--font-size-label);
    color: #666;
    margin: -4px 0 8px 0;
}

.ds-ucheba-empty-state {
    font-size: var(--font-size-secondary);
    color: #555;
    line-height: 1.4;
}
.ds-student-ucheba-empty-link {
    font-weight: 600;
    color: var(--ds-primary);
    text-decoration: underline;
}

/* Учёба + Проверки: колонки выравниваем по верху, чтобы правая не растягивалась в высоту */
.ds-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
    align-items: start;
}
@media (min-width: 900px) {
    .ds-dashboard-grid { grid-template-columns: 1fr 1fr; }
    #ds-feedback-section { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
    .ds-dashboard-grid { grid-template-columns: 1fr 1fr; }
    #ds-feedback-section { grid-column: 1 / -1; }
}

/* Activity section (full width; navigation via header) */
.ds-bottom-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
    margin-top: 8px;
    align-items: start;
}

.ds-section {
    background: var(--background-color, #fff);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    padding: 10px 12px;
    margin-bottom: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.ds-dashboard-grid .ds-section,
.ds-bottom-grid .ds-section { margin-bottom: 0; }

#ds-courses-section {
    min-width: 0;
}

#ds-learners-section {
    min-width: 0;
}

#ds-feedback-section {
    min-width: 0;
}

/* Main panel title (Ucheba, Proverki, Aktivnost) — prominent */
.ds-section-title {
    font-size: var(--font-size-section-title);
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.ds-section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.ds-section-header-row .ds-section-title { margin-bottom: 0; }
/* Sub-section label (Kursy, Podopechnye) — visually secondary, under the main title */
.ds-section-subtitle {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
/* Secondary button: "Vse", same style as progress-link for harmony */
.ds-section-all-btn {
    display: inline-block;
    padding: var(--ds-btn-padding);
    font-size: var(--ds-btn-font-size);
    font-weight: var(--ds-btn-font-weight);
    color: var(--ds-primary);
    text-decoration: underline;
    background: transparent;
    border: var(--ds-btn-border);
    border-radius: var(--ds-radius);
    transition: background 0.15s ease, color 0.15s ease;
}
.ds-section-all-btn:hover { background: var(--ds-primary); color: #fff; text-decoration: underline; }

/* Учёба: Курсы и Подопечные в один ряд (как в прототипе .two-col) — сетка на внутреннем div */
#ds-ucheba-two-col,
.ds-two-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.ds-ucheba-col { min-width: 0; }

.ds-courses-list,
.ds-learners-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-x: auto;
    overflow-y: auto;
}

/* Ucheba: table-like rows (type, assigned, completed, progress, name) */
.ds-ucheba-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    font-size: var(--font-size-secondary);
}
.ds-ucheba-tr {
    display: grid;
    grid-template-columns: minmax(52px, 72px) minmax(72px, 88px) minmax(72px, 88px) minmax(52px, 72px) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 3px 2px;
    border-bottom: 1px solid #f0f0f0;
}
.ds-ucheba-tr:last-child {
    border-bottom: none;
}
.ds-ucheba-tr--head {
    font-weight: 600;
    font-size: var(--font-size-label);
    color: #555;
    border-bottom: 2px solid #e9ecef;
    padding-top: 0;
    padding-bottom: 4px;
}
/* columns: 1 type, 2 assigned, 3 completed, 4 progress, 5 name */
.ds-ucheba-tr--head .ds-ucheba-th:nth-child(3) {
    text-align: center;
}
.ds-ucheba-tr--head .ds-ucheba-th:nth-child(4) {
    text-align: left;
}
.ds-ucheba-th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ds-ucheba-table-section {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: #495057;
    padding: 10px 2px 4px;
    margin-top: 4px;
    border-top: 1px solid #e9ecef;
}
.ds-ucheba-table-section:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 4px;
}
.ds-ucheba-td {
    min-width: 0;
}
.ds-ucheba-td--type {
    color: #495057;
    font-size: var(--font-size-label);
    font-weight: 600;
}
.ds-ucheba-td--date {
    color: #666;
    font-size: var(--font-size-label);
    white-space: nowrap;
}
.ds-ucheba-td--completed {
    text-align: center;
}
.ds-ucheba-td--name {
    min-width: 0;
    overflow: hidden;
}
.ds-ucheba-name {
    font-size: var(--font-size-body);
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Non-clickable title (locked task): plain text */
.ds-ucheba-name--plain {
    color: #19191A;
    font-weight: 600;
}
/* Clickable names: same affordance as classic links */
a.ds-ucheba-name {
    color: var(--ds-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
a.ds-ucheba-name:hover {
    color: var(--ds-primary-hover);
    text-decoration: underline;
}
a.ds-ucheba-name:focus-visible {
    color: var(--ds-primary-hover);
    outline: 2px solid var(--ds-primary);
    outline-offset: 2px;
}
.ds-ucheba-td--progress {
    display: flex;
    justify-content: flex-start;
    min-width: 0;
}
.ds-ucheba-progress-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
}
.ds-progress-bar--inline {
    flex: 0 1 auto;
    width: 36px;
    min-width: 28px;
    max-width: 40px;
    height: 5px;
}
.ds-ucheba-td-progress {
    flex-shrink: 0;
}

.ds-ucheba-tier-section {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: #495057;
    margin: 10px 0 4px 0;
    padding-top: 4px;
    border-top: 1px solid #e9ecef;
}
.ds-ucheba-tier-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.ds-progress-link--locked {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: var(--font-size-label);
    color: #868e96;
    background: #f1f3f5;
    cursor: not-allowed;
    text-decoration: none;
}

.ds-progress-block {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}
.ds-progress-block:last-child { border-bottom: none; padding-bottom: 0; }
/* Course/task name: title style, not link — dark text so it doesn't look like "Продолжить" */
.ds-progress-course { font-size: var(--font-size-body); font-weight: 600; color: #19191A; margin-bottom: 2px; letter-spacing: 0.01em; }
/* ds-progress-course-link: used with ds-ucheba-name in student table; link look from a.ds-ucheba-name */
a.ds-ucheba-name.ds-progress-course-link {
    display: block;
    max-width: 100%;
}
.ds-learners-list-empty { min-height: 0; }
.ds-progress-meta { font-size: var(--font-size-label); color: #666; margin-bottom: 4px; }
/* Progress bar and "Prodolzhit" button in one row; bar takes remaining width, button on the right */
.ds-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.ds-progress-bar {
    flex: 1;
    min-width: 0;
    height: 5px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}
.ds-progress-fill { height: 100%; background: linear-gradient(90deg, #1446A0, #1a5bc7); border-radius: 3px; }
.ds-progress-pct { flex-shrink: 0; font-size: var(--font-size-label); color: #666; min-width: 2em; }
/* Action link: same secondary button style as "Vse" */
.ds-progress-link {
    flex-shrink: 0;
    display: inline-block;
    font-size: var(--ds-btn-font-size);
    font-weight: var(--ds-btn-font-weight);
    color: var(--ds-primary);
    text-decoration: underline;
    padding: var(--ds-btn-padding);
    border: var(--ds-btn-border);
    border-radius: var(--ds-radius);
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
}
.ds-progress-link:hover { background: var(--ds-primary); color: #fff; text-decoration: underline; }

.ds-learners-item {
    padding: 3px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: var(--font-size-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.ds-learners-item:last-child { border-bottom: none; }
/* Learner name: title style; link stays clickable but looks like name, not same as action buttons */
.ds-learners-link { color: #19191A; text-decoration: none; flex: 1; min-width: 0; font-weight: 600; }
.ds-learners-link:hover { color: #1446A0; text-decoration: underline; }
.ds-learners-badge { font-size: var(--font-size-small); background: #fff3cd; color: #856404; padding: 1px 5px; border-radius: 6px; flex-shrink: 0; }
.ds-learners-muted { font-size: var(--font-size-label); color: #888; }
.ds-ucheba-placeholder { font-size: var(--font-size-secondary); color: #888; }

/* Список проверок: ограниченная высота и прокрутка, чтобы правая колонка не перевешивала */
.ds-feedback-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 40px;
    max-height: 320px;
    overflow-y: auto;
}
.ds-feedback-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #e8f4fd;
    border: 1px solid #b6d9f7;
    border-radius: var(--ds-radius);
    text-decoration: none;
    color: #0c5460;
    font-size: var(--font-size-secondary);
    font-weight: 500;
}
.ds-feedback-item:hover { background: #d0eaf9; }
.ds-feedback-tag { font-size: var(--font-size-small); background: #1446A0; color: #fff; padding: 1px 5px; border-radius: 4px; }
.ds-feedback-item--mentor { background: #f0f7e8; border-color: #c8e0b0; color: #2d5a1a; }
.ds-feedback-item--mentor:hover { background: #e0f0d0; }
.ds-feedback-placeholder { font-size: var(--font-size-secondary); color: #888; }

/* Лента активности: ограниченная высота и прокрутка */
.ds-activity-list {
    min-height: 40px;
    max-height: 280px;
    overflow-y: auto;
    font-size: var(--font-size-label);
    color: #555;
}
.ds-activity-item {
    padding: 3px 0;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
}
.ds-activity-item:last-child { border-bottom: none; }
.ds-activity-time { color: #999; flex-shrink: 0; }
.ds-activity-tag {
    font-size: var(--font-size-small);
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.ds-activity-tag-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}
.ds-activity-link { color: #1446A0; text-decoration: none; }
.ds-activity-link:hover { text-decoration: underline; }
.ds-activity-placeholder { font-size: var(--font-size-secondary); color: #888; }

/* Учёба: на очень узких экранах — одна колонка */
@media (max-width: 480px) {
    #ds-ucheba-two-col,
    .ds-two-col { grid-template-columns: 1fr; }
}
