/* ============================================= */
/* SafetyTraining - Page-Specific Styles        */
/* Login, Dashboard, Training Viewer, Admin     */
/* ============================================= */

/* ==================== */
/* Page Header          */
/* ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}

.page-header p {
    margin: 0;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ==================== */
/* Login Page           */
/* ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.login-card {
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    text-align: center;
    color: var(--primary-color);
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
}

.login-card h2 {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 2rem;
    font-size: 1.25rem;
    font-weight: 400;
}

.delivery-options {
    display: flex;
    gap: 1rem;
}

.delivery-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.delivery-option:hover {
    background: var(--bg-secondary);
}

.delivery-option input:checked + span {
    color: var(--primary-color);
}

.otp-input {
    font-size: 1.5rem;
    letter-spacing: 0.5rem;
    text-align: center;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.login-footer p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ==================== */
/* Dashboard            */
/* ==================== */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.dashboard-header p {
    color: var(--text-secondary);
    margin: 0;
}

.assignment-category {
    margin-bottom: 2rem;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.category-count {
    font-weight: 400;
    color: var(--text-secondary);
}

.category-overdue .category-title {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

/* ==================== */
/* Filter Bar           */
/* ==================== */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
}

.filter-options {
    display: flex;
    gap: 0.5rem;
}

.filter-options select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-surface);
}

.search-bar {
    margin-bottom: 1rem;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tabs .tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
}

.filter-tabs .tab:hover {
    background: var(--bg-secondary);
}

.filter-tabs .tab.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filter-tabs .tab.danger.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

/* ==================== */
/* Training Viewer      */
/* ==================== */
.training-viewer {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.training-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    margin: 0;
    font-size: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slide-counter {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.slide-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.training-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.slide-dots {
    display: flex;
    gap: 0.5rem;
}

.slide-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-normal);
}

.slide-dot.visited {
    background: var(--border-color);
}

.slide-dot.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

/* ==================== */
/* Quiz Slides          */
/* ==================== */
.quiz-slide {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-start {
    text-align: center;
    padding: 3rem;
}

.quiz-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.quiz-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-number {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

.answer-feedback {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
}

.answer-feedback.correct {
    background: #dcfce7;
    color: var(--success-color);
}

.answer-feedback.incorrect {
    background: #fef2f2;
    color: var(--danger-color);
}

.question-text {
    font-size: 1.5rem;
    margin: 0 0 2rem;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.answer-option:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: #f0fdfa;
}

.answer-option.correct {
    border-color: var(--success-color);
    background: #dcfce7;
}

.answer-option.incorrect {
    border-color: var(--danger-color);
    background: #fef2f2;
}

.answer-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-weight: bold;
}

.quiz-actions {
    text-align: center;
}

.incorrect-feedback {
    text-align: center;
}

.incorrect-feedback p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* ==================== */
/* Training Complete    */
/* ==================== */
.training-complete {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.complete-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.result-summary {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
}

.result-value {
    font-weight: 600;
}

/* ==================== */
/* My Trainings         */
/* ==================== */
.trainings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.training-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.training-item .training-icon {
    font-size: 2rem;
}

.training-item .training-info {
    flex: 1;
}

.training-item .training-info h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.training-item .training-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.training-item .training-status {
    margin-right: 1rem;
}

/* ==================== */
/* Team Progress        */
/* ==================== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ==================== */
/* Admin: Reports       */
/* ==================== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Recent Activity */
.recent-activity {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.recent-activity h3 {
    margin: 0 0 1rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

/* ==================== */
/* Admin: User Mgmt     */
/* ==================== */
/* Covered by .users-table in components.css */

/* ==================== */
/* Admin: Assignments   */
/* ==================== */
.assignment-page .assignment-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.assignment-form {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: fit-content;
}

.user-selection {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.user-selection h3 {
    margin: 0 0 1rem;
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.selection-count {
    margin-left: auto;
    color: var(--text-secondary);
}

.user-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.user-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-item:last-child {
    border-bottom: none;
}

.user-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.user-item.selected {
    background: #f0fdfa;
}

.user-item.already-assigned {
    opacity: 0.6;
}

.user-item .user-name {
    font-weight: 500;
}

.user-item .user-email {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.assignment-actions {
    margin-top: 2rem;
    text-align: center;
}

/* ==================== */
/* Access Denied        */
/* ==================== */
.access-denied {
    text-align: center;
    padding: 4rem 2rem;
}

.access-denied h2 {
    margin: 0 0 1rem;
}

/* ==================== */
/* Coming Soon          */
/* ==================== */
.coming-soon {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border-radius: var(--radius);
}

.coming-soon .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ==================== */
/* Pagination           */
/* ==================== */
.pagination {
    display: flex;
    justify-content: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== */
/* Responsive           */
/* ==================== */
@media (max-width: 768px) {
    .top-nav {
        padding: 0.75rem 1rem;
    }

    .nav-links {
        display: none;
    }

    .assignment-cards {
        grid-template-columns: 1fr;
    }

    .training-header,
    .training-footer {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .progress-indicator {
        width: 100%;
        order: 3;
    }

    .slide-dots {
        flex-wrap: wrap;
    }

    .assignment-page .assignment-content {
        grid-template-columns: 1fr;
    }
}

/* ============================================= */
/* Shared Page Patterns                          */
/* Reusable classes extracted from inline styles */
/* ============================================= */

/* ---- Full-height page shell ---- */
.admin-page,
.user-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
    padding-top: 0.5rem;
    overflow: hidden;
}

/* ---- Page header panel (gradient banner) ---- */
.page-header-panel {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 2rem;
}

.page-title {
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ---- Filter / toolbar bar ---- */
.filter-section {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.search-field {
    min-width: 300px;
}

/* ---- Scrollable table / content container ---- */
.content-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.table-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

/* ---- Standard table head & row styling ---- */
/* Apply by adding Class="styled-table" to MudTable */
.styled-table .mud-table-head .mud-table-cell {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.styled-table .mud-table-body .mud-table-row:hover {
    background: var(--gray-50);
}

.styled-table .mud-table-body .mud-table-cell {
    vertical-align: middle;
}

.styled-table .mud-table-sortlabel .mud-button-root {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Loading / empty placeholders ---- */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.4;
}

/* ---- Access denied ---- */
.access-denied-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.access-denied-card {
    padding: 3rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
}

/* ---- Content panel (white card) ---- */
.content-panel {
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    height: 100%;
    overflow-y: auto;
}

/* ---- Sidebar / folder panel ---- */
.folder-panel {
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    height: 100%;
    overflow-y: auto;
}

/* ---- Group overview badge alignment ---- */
.group-badge-count {
    min-width: 48px;
    justify-content: center;
}

.group-badge-percent {
    min-width: 64px;
    justify-content: center;
}

/* ---- Stat cards (small metric boxes) ---- */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    height: 100%;
}

/* ---- Content section (card with internal scroll) ---- */
.content-section {
    flex: 1;
    min-height: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-section .mud-table-container {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* ---- Utility: font weight ---- */
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
