/* Modern, clean styling for Knobler des Monats */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --neutral-bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 10px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--neutral-bg);
    color: var(--text);
    line-height: 1.5;
}

/* Header */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    font-size: 36px;
    background: #f1f5f9;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.brand h1 {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
}

.brand .subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.header-stats {
    display: flex;
    gap: 10px;
}

.stat-pill {
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.stat-pill span {
    font-weight: 700;
    color: var(--primary);
}

/* Navigation Tabs */
.nav-tabs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 22px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.section-header p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-select, .form-input {
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    outline: none;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Rounds Grid */
.rounds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.round-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.round-card.current-round {
    border: 2px solid #2563eb;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.14);
    background: #f8fafc;
}

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

.round-num {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.round-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.round-deadline {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.round-tasks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
}

.task-tag {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.task-tag:hover {
    background: #e2e8f0;
}

.round-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    margin-top: 8px;
}

/* Speed Entry Table */
.solution-ref-bar {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    font-weight: 600;
}

.solution-ref-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.solution-ref-letter {
    background: #1e293b;
    color: #fff;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #fbfcfe;
}

.task-col {
    width: 95px;
    text-align: center !important;
}

.entry-box {
    width: 44px;
    height: 38px;
    text-align: center;
    font-family: monospace;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: all 0.15s;
    background: #ffffff;
}

.entry-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.entry-box.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success);
}

.entry-box.wrong {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
}

.pts-badge {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
}

.saved-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    background: var(--success-light);
}

/* Leaderboard */
.subnav-card {
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.view-toggles {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.view-btn {
    border: none;
    background: none;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
}

.view-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.subnav-filters {
    display: flex;
    gap: 14px;
    align-items: center;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 12px 18px;
}

.rank-cell {
    font-weight: 700;
    font-size: 15px;
    width: 60px;
}

.rank-1 { color: #d97706; font-size: 18px; }
.rank-2 { color: #64748b; font-size: 17px; }
.rank-3 { color: #b45309; font-size: 16px; }

.total-points-cell {
    font-weight: 800;
    font-size: 16px;
    color: var(--primary);
}

/* Catalog Grid */
.tasks-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.catalog-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.catalog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.catalog-img-wrap {
    height: 120px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fbfcfe;
    border-radius: 4px;
    margin-bottom: 10px;
}

.catalog-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.catalog-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalPop 0.2s ease-out;
}

.modal-large {
    max-width: 820px;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.form-field {
    margin-bottom: 14px;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-field .form-input {
    width: 100%;
}

/* Login Overlay & Logout Button */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.login-card {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid #e2e8f0;
}

.login-brand {
    text-align: center;
    margin-bottom: 26px;
}

.login-icon {
    font-size: 44px;
    background: #eff6ff;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border: 1.5px solid #bfdbfe;
}

.login-brand h2 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.login-brand p {
    font-size: 13px;
    color: var(--text-muted);
}

.login-form .form-input {
    padding: 10px 14px;
    font-size: 14px;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}

.login-submit-btn {
    width: 100%;
    padding: 11px 16px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 6px;
    justify-content: center;
}

.btn-logout {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fecaca;
    color: #991b1b;
}

/* Print Styles for Notice Board (Schwarzes Brett) */
.print-header {
    display: none;
    margin-bottom: 20px;
}

@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        padding: 0 !important;
    }
    .app-header, .nav-tabs, .section-header, .subnav-card, .modal, .login-overlay {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    #tab-leaderboard {
        display: block !important;
    }
    .printable-card {
        border: none !important;
        box-shadow: none !important;
    }
    .print-header {
        display: block !important;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
    .print-header h1 {
        font-size: 24px;
        font-weight: 800;
    }
    .data-table th, .data-table td {
        border-bottom: 1px solid #ddd !important;
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
}
