:root {
    --primary-color: #1e40af;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --border-color: #e2e8f0;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #ffffff;
    color: var(--text-dark);
}

/* ============================================
   PRINT-ONLY CONTAINER
   ============================================ */

#printContainer {
    display: none;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    @page {
        size: A4 portrait;
        margin: 20mm 8mm 8mm 8mm;
    }

    html,
    body {
        height: auto;
        overflow: visible;
        background: white !important;
        margin: 0;
        padding: 0;
    }

    body > *:not(#printContainer) {
        display: none !important;
    }

    #printContainer {
        display: block !important;
        position: relative;
        left: auto;
        top: auto;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        font-size: 9pt;
        line-height: 1.25;
        margin: 0;
        padding: 0;
    }

    /* --- SEITE 1: Titel + Logos + Übersicht --- */

    .print-title-page {
        page-break-after: always;
        margin-bottom: 2mm;
    }

    .print-title-page:last-child {
        page-break-after: auto;
    }

    .print-title-header {
        text-align: center;
        margin-bottom: 10mm;
    }

    .print-title-header h1 {
        font-size: 16pt;
        margin: 0 0 4px 0;
        font-weight: 700;
        color: #000000;
    }

    .print-plan-name {
        font-size: 12pt;
        color: #334155;
        margin: 0 0 6px 0;
    }

    .print-total-time {
        font-size: 10pt;
        color: #334155;
    }

    .print-logos-row {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 12mm;
        margin: 8mm 0 12mm 0;
    }

    .print-logo {
        width: 80px;
    }

    .print-logo img {
        width: 100%;
        height: auto;
    }

    .print-summary-box {
        margin: 0 10mm;
        border: 1.5pt solid #334155;
        border-radius: 4px;
        padding: 4mm;
    }

    .print-summary-box h2 {
        font-size: 11pt;
        margin: 0 0 4mm 0;
        text-decoration: underline;
        text-align: center;
        color: #000000;
    }

    .print-summary-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .print-summary-item {
        display: flex;
        justify-content: space-between;
        padding: 3px 0;
        border-bottom: 0.5pt dotted #94a3b8;
        font-size: 9pt;
        color: #000000;
    }

    .print-summary-item:last-child {
        border-bottom: none;
    }

    .print-summary-footer {
        margin-top: 3mm;
        padding-top: 2mm;
        border-top: 1.5pt solid #334155;
        display: flex;
        justify-content: space-between;
        font-size: 10pt;
        font-weight: 700;
        color: #000000;
    }

    .print-footer-note {
        margin-top: 15mm;
        text-align: center;
        font-size: 7pt;
        color: #94a3b8;
    }

    /* --- SEITE 2+: Übungen mit Rahmen --- */

    .print-exercise {
        page-break-inside: avoid;
        margin-bottom: 4mm;
        padding: 3mm;
        border: 0.75pt solid #64748b;
        border-radius: 4px;
    }

    .print-exercise:last-child {
        margin-bottom: 0;
    }

    .print-ex-header {
        margin-bottom: 2px;
        padding-bottom: 2px;
        border-bottom: 0.5pt solid #cbd5e1;
    }

    .print-ex-num {
        display: inline-block;
        min-width: 16px;
        font-weight: 700;
        color: #000000;
    }

    .print-ex-name {
        font-weight: 700;
        font-size: 10pt;
        color: #000000;
    }

    .print-ex-meta {
        display: inline;
        font-size: 8pt;
        color: #475569;
        margin-left: 6px;
    }

    .print-ex-cat {
        background: #dbeafe;
        color: #000000;
        padding: 1px 5px;
        border-radius: 3px;
        font-size: 7pt;
        font-weight: 600;
        margin-right: 4px;
    }

    .print-ex-dur {
        color: #000000;
        font-weight: 600;
    }

    .print-ex-body {
        display: flex;
        gap: 4mm;
        margin-top: 2px;
    }

    .print-ex-text {
        flex: 1;
        min-width: 0;
    }

    .print-ex-materials {
        font-size: 8pt;
        color: #334155;
        margin: 1px 0;
    }

    .print-ex-desc {
        font-size: 8.5pt;
        color: #1e293b;
        line-height: 1.2;
        margin: 2px 0;
        text-align: justify;
        white-space: pre-line;
    }

    .print-ex-notes {
        font-size: 8pt;
        color: #475569;
        font-style: italic;
        margin: 2px 0 0 0;
        padding-left: 6px;
        border-left: 2px solid #94a3b8;
    }

    .print-ex-board {
        flex-shrink: 0;
        width: 140px;
    }

    .print-ex-board img {
        width: 100%;
        max-height: 160px;
        object-fit: contain;
        border: 0.5pt solid #94a3b8;
        border-radius: 3px;
    }
}

/* ============================================
   SCREEN STYLES (shared across pages)
   ============================================ */

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-nav {
    flex-shrink: 0;
}

.btn-back {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.25);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.plan-name-input {
    flex: 1;
    font-size: 14pt;
    font-weight: 600;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.plan-name-input:focus {
    border-color: var(--primary-color);
}

.plan-controls-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.saved-plans-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.saved-plans-bar label {
    font-size: 10pt;
    white-space: nowrap;
}

.saved-plans-bar select {
    flex: 1;
    max-width: 500px;
}

.planner-layout {
    display: flex;
    min-height: calc(100vh - 200px);
}

.exercise-pool-sidebar {
    width: 350px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: var(--bg-light);
    padding: 15px;
}

.training-plan-section {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.trained-exercise-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.trained-exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.cat-badge {
    background: #dbeafe;
    color: #000000;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 8pt;
    font-weight: 600;
}

.duration-badge {
    background: #fef3c7;
    color: #000000;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 8pt;
    font-weight: 600;
}

.level-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 8pt;
    font-weight: 600;
}

.level-beginner {
    background: #d1fae5;
    color: #000000;
}

.level-intermediate {
    background: #fef3c7;
    color: #000000;
}

.level-advanced {
    background: #fecaca;
    color: #000000;
}

.trained-exercise-body {
    margin-top: 10px;
}

.trained-ex-material,
.trained-ex-notes,
.trained-ex-description {
    font-size: 10pt;
    margin: 8px 0;
}

.trained-ex-board {
    margin-top: 10px;
}

.trained-ex-board img {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.trained-exercise-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.btn-move-up, .btn-move-down, .btn-remove {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 9pt;
    transition: opacity 0.2s;
}

.btn-move-up, .btn-move-down {
    background: #e2e8f0;
    color: #000000;
}

.btn-move-up:hover, .btn-move-down:hover {
    background: #cbd5e1;
}

.btn-remove {
    background: #fee2e2;
    color: #000000;
    margin-left: auto;
}

.btn-remove:hover {
    background: var(--danger-color);
    color: white;
}

.time-tracker {
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 11pt;
    text-align: right;
}

.plan-summary {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.plan-summary h3 {
    margin: 0 0 12px 0;
    color: #000000;
    font-size: 12pt;
}

.plan-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-summary li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dotted var(--border-color);
    font-size: 10pt;
}

.plan-summary li.summary-total {
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
    margin-top: 10px;
    padding-top: 10px;
    font-size: 11pt;
}