* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

:root {
    --thw-blue: #002855;
    --thw-blue-light: #003d73;
    --thw-orange: #FF8C00;
    --thw-orange-hover: #e07800;
    --thw-gray-bg: #f5f7fa;
    --thw-card-bg: #ffffff;
    --thw-border: #e2e8f0;
    --thw-text: #2d3748;
    --thw-text-muted: #718096;
    --color-success: #38a169;
    --color-warning: #dd6b20;
    --color-danger: #e53e3e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--thw-gray-bg);
    color: var(--thw-text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 25px;
    padding: 25px 20px;
    background: linear-gradient(135deg, var(--thw-blue), var(--thw-blue-light));
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 40, 85, 0.3);
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

header .subtitle {
    opacity: 0.9;
    font-size: 1.05rem;
}

.home-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.5rem;
    transition: background 0.3s;
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.header-actions {
    position: absolute;
    top: 15px;
    right: 15px;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--thw-orange), #FFA500);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--thw-orange-hover), var(--thw-orange));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.btn-secondary {
    background-color: #edf2f7;
    color: var(--thw-text);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-danger {
    background-color: #fff5f5;
    color: var(--color-danger);
    border: 1px solid #feb2b2;
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Tabs Navigation */
.tabs-wrapper {
    background: var(--thw-card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    overflow-x: auto;
}

.tabs {
    display: flex;
    border-bottom: 2px solid var(--thw-border);
    min-width: max-content;
}

.tab-btn {
    padding: 14px 22px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    color: var(--thw-text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--thw-blue);
    background-color: #f7fafc;
}

.tab-btn.active {
    color: var(--thw-orange);
    border-bottom-color: var(--thw-orange);
    background-color: #fffaf0;
}

.tab-badge {
    background-color: var(--thw-border);
    color: var(--thw-text);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.tab-btn.active .tab-badge {
    background-color: var(--thw-orange);
    color: white;
}

/* Summary Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--thw-card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--thw-blue);
    display: flex;
    flex-direction: column;
}

.stat-card.orange {
    border-left-color: var(--thw-orange);
}

.stat-card.green {
    border-left-color: var(--color-success);
}

.stat-card.red {
    border-left-color: var(--color-danger);
}

.stat-title {
    font-size: 0.85rem;
    color: var(--thw-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--thw-text);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--thw-text-muted);
    margin-top: 4px;
}

/* Sections */
.content-section {
    background: var(--thw-card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: 25px;
    margin-bottom: 25px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #edf2f7;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    font-size: 1.3rem;
    color: var(--thw-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Helper Cards Grid */
.helpers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.helper-card {
    background: var(--thw-card-bg);
    border: 1px solid var(--thw-border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.helper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.helper-card.helper-excluded {
    opacity: 0.5;
    border: 1px dashed var(--thw-border);
}

.helper-card.helper-excluded:hover {
    opacity: 0.8;
}

.helper-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.helper-name {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--thw-blue);
}

.helper-course {
    font-size: 0.85rem;
    color: var(--thw-text-muted);
    margin-bottom: 15px;
}

.progress-container {
    margin-bottom: 15px;
}

.progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.progress-bar-bg {
    height: 10px;
    background-color: #edf2f7;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.progress-100 { background-color: var(--color-success); }
.progress-good { background-color: #319795; }
.progress-mid { background-color: var(--thw-orange); }
.progress-low { background-color: var(--color-danger); }

.helper-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background-color: #f7fafc;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.helper-stat-item span:first-child {
    display: block;
    color: var(--thw-text-muted);
    font-size: 0.75rem;
}

.helper-stat-item span:last-child {
    font-weight: bold;
    color: var(--thw-text);
}

.helper-stat-item.danger span:last-child {
    color: var(--color-danger);
}

.helper-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--thw-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.6;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 20px;
}

/* Missing Topics Planning Table */
.table-responsive {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.data-table th,
table.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--thw-border);
}

table.data-table th {
    background-color: #f7fafc;
    color: var(--thw-blue);
    font-weight: 600;
    position: sticky;
    top: 0;
}

table.data-table tr:hover {
    background-color: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-success { background: #c6f6d5; color: #22543d; }
.badge-warning { background: #feebc8; color: #7b341e; }
.badge-danger { background: #fed7d7; color: #742a2a; }
.badge-blue { background: #bee3f8; color: #2b6cb0; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--thw-blue), var(--thw-blue-light));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.modal-close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 25px;
    background-color: #f7fafc;
    border-top: 1px solid var(--thw-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form elements in modal */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--thw-blue);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--thw-border);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fafafa;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--thw-orange);
    background-color: white;
}

.csv-textarea {
    font-family: Consolas, 'Courier New', monospace !important;
    font-size: 0.85rem !important;
    resize: vertical;
    min-height: 110px;
    line-height: 1.4;
}

.upload-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 14px 0 10px;
    color: var(--thw-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.upload-divider::before,
.upload-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--thw-border);
}

.upload-divider span {
    padding: 0 12px;
}

.csv-error-hint {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--color-danger);
    font-weight: 500;
}

.file-dropzone {
    border: 2px dashed var(--thw-orange);
    background-color: #fffaf0;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.file-dropzone:hover {
    background-color: #feebc8;
}

.file-dropzone-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

/* Helper detail view table inside modal */
.detail-topic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-topic-item {
    background: #f8fafc;
    border: 1px solid var(--thw-border);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-topic-item.completed {
    border-left: 4px solid var(--color-success);
}

.detail-topic-item.missing {
    border-left: 4px solid var(--color-danger);
    background-color: #fff5f5;
}

.detail-topic-item.partial {
    border-left: 4px solid var(--color-warning);
    background-color: #fffaf0;
}

.topic-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.topic-meta {
    font-size: 0.8rem;
    color: var(--thw-text-muted);
}

/* Dienstplan */
.dienstplan-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dienstplan-month {
    background: var(--thw-card-bg);
    border: 1px solid var(--thw-border);
    border-radius: 12px;
    overflow: hidden;
}

.dienstplan-month-header {
    background: linear-gradient(135deg, var(--thw-blue), var(--thw-blue-light));
    color: white;
    padding: 12px 20px;
}

.dienstplan-month-header h3 {
    font-size: 1.05rem;
    margin: 0;
}

.dienstplan-days-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.dienstplan-day {
    padding: 16px 20px;
    border-right: 1px solid var(--thw-border);
}

.dienstplan-day:last-child {
    border-right: none;
}

.dienstplan-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--thw-border);
}

.dienstplan-day-date {
    font-weight: 700;
    font-size: 1rem;
    color: var(--thw-blue);
}

.dienstplan-day-capacity {
    font-size: 0.85rem;
    font-weight: 600;
}

.dienstbar-day-bar {
    height: 6px;
    background: #edf2f7;
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

.dienstplan-day-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.dienstplan-day-topics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dienstplan-empty {
    font-size: 0.85rem;
    color: var(--thw-text-muted);
    font-style: italic;
    padding: 8px 0;
}

.dienstplan-topic {
    background: #f7fafc;
    border: 1px solid var(--thw-border);
    border-radius: 8px;
    padding: 10px 12px;
}

.dienstplan-topic-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--thw-text);
    margin-bottom: 4px;
}

.dienstplan-topic-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dienstplan-topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.dienstplan-topic-assigned {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.dienstplan-subtopics {
    margin-top: 6px;
    padding-left: 10px;
    border-left: 2px solid var(--thw-border);
    font-size: 0.8rem;
    color: var(--thw-text);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        position: static;
        margin-top: 15px;
        display: flex;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .helpers-grid {
        grid-template-columns: 1fr;
    }

    .dienstplan-days-row {
        grid-template-columns: 1fr;
    }

    .dienstplan-day {
        border-right: none;
        border-bottom: 1px solid var(--thw-border);
    }

    .dienstplan-day:last-child {
        border-bottom: none;
    }
}
