/**
 * Trainingstagebuch - CSS Styles
 * Dark theme matching the site design + print optimization
 */

/* ===========================================
   Print Header (only visible when printing)
   =========================================== */
.print-header {
    display: none;
}

/* ===========================================
   Metadata Grid
   =========================================== */
.tb-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.tb-meta-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
}

.tb-meta-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tb-input {
    width: 100%;
    height: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.tb-input:focus {
    outline: none;
    border-color: rgba(74, 158, 255, 0.5);
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

/* ===========================================
   Mood Selector
   =========================================== */
.tb-mood-selector {
    display: flex;
    gap: 8px;
}

.tb-mood {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.tb-mood:hover {
    opacity: 0.8;
    transform: scale(1.15);
}

.tb-mood.active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

/* ===========================================
   Weather Selector
   =========================================== */
.tb-weather-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tb-weather-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tb-weather-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.tb-weather-option:has(input:checked) {
    background: rgba(74, 158, 255, 0.15);
    border-color: rgba(74, 158, 255, 0.4);
    color: #fff;
}

.tb-weather-option input[type="radio"] {
    display: none;
}

/* ===========================================
   Add Toolbar
   =========================================== */
.tb-add-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.tb-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid;
}

.tb-add-praezision {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}

.tb-add-praezision:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: #e74c3c;
    color: #fff;
}

.tb-add-duell {
    background: rgba(52, 152, 219, 0.1);
    border-color: rgba(52, 152, 219, 0.4);
    color: #3498db;
}

.tb-add-duell:hover {
    background: rgba(52, 152, 219, 0.2);
    border-color: #3498db;
    color: #fff;
}

/* ===========================================
   Empty Hint
   =========================================== */
.tb-empty-hint {
    text-align: center;
    padding: 20px 16px;
    color: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tb-empty-hint i {
    font-size: 1.2rem;
}

.tb-empty-hint p {
    font-size: 0.9rem;
    margin: 0;
}

/* ===========================================
   Serie Badge & Header
   =========================================== */
.tb-serie-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.tb-serie-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
}

.tb-badge-praezision {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.tb-badge-duell {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.tb-serie-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-accent-light, #ffaa00);
    line-height: 1;
}

.tb-serie-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
}

.tb-serie-delete {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    padding: 0;
}

.tb-serie-delete:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.5);
    color: #dc3545;
}

/* ===========================================
   Series Grid
   =========================================== */
.tb-series-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 16px;
}

.tb-serie-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.tb-serie-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ===========================================
   Target SVG
   =========================================== */
.tb-target-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}

.tb-target {
    width: 100%;
    max-width: 180px;
    height: auto;
    border-radius: 4px;
}

.tb-target-duell {
    max-width: 180px;
}

.tb-ring-zone {
    cursor: pointer;
    pointer-events: all;
}

.tb-ring-zone:hover {
    fill: rgba(74, 158, 255, 0.15) !important;
}

.tb-shot-marker {
    pointer-events: none;
}

/* ===========================================
   Shot Inputs
   =========================================== */
.tb-shots-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}

.tb-shot-field {
    flex: 0 0 auto;
}

.tb-shot-input {
    width: 40px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    -moz-appearance: textfield;
}

.tb-shot-input::-webkit-outer-spin-button,
.tb-shot-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tb-shot-input:focus {
    outline: none;
    border-color: rgba(74, 158, 255, 0.5);
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

.tb-shot-input.filled {
    border-color: rgba(40, 167, 69, 0.4);
    background: rgba(40, 167, 69, 0.1);
}

/* ===========================================
   Serie Sum
   =========================================== */
.tb-serie-sum {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tb-sum-value {
    color: var(--color-accent-light, #ffaa00);
}

/* ===========================================
   Total Row
   =========================================== */
.tb-total-row {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.tb-total-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(74, 158, 255, 0.1);
    border: 2px solid rgba(74, 158, 255, 0.3);
    border-radius: 12px;
}

.tb-total-label {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.tb-total-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-accent-light, #ffaa00);
    min-width: 60px;
    text-align: center;
    padding: 4px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.tb-total-max {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ===========================================
   Notes
   =========================================== */
.tb-notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.tb-note-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.tb-textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.tb-textarea:focus {
    outline: none;
    border-color: rgba(74, 158, 255, 0.5);
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

/* ===========================================
   Action Buttons
   =========================================== */
.tb-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
    margin-bottom: 16px;
}

.tb-actions .btn {
    padding: 12px 32px;
    font-size: 1rem;
}

/* ===========================================
   Touch Drag Preview
   =========================================== */
.tb-shot-input.tb-preview {
    color: rgba(74, 158, 255, 0.7);
    border-color: rgba(74, 158, 255, 0.4);
}

.tb-zoom-shot-display.tb-preview-val {
    border-color: rgba(74, 158, 255, 0.6);
    background: rgba(74, 158, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
}

/* ===========================================
   Target Zoom Overlay (Mobile)
   =========================================== */
.tb-zoom-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    touch-action: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: auto;
}

.tb-zoom-overlay.active {
    display: flex;
}

.tb-zoom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin-bottom: 12px;
}

.tb-zoom-title {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.tb-zoom-close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.tb-zoom-close:active {
    background: rgba(255, 255, 255, 0.25);
}

.tb-zoom-target-area {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-zoom-target-area svg {
    width: 100%;
    height: 100%;
    touch-action: none;
}

.tb-zoom-shots {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.tb-zoom-shot-display {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-align: center;
    line-height: 40px;
    font-size: 1.1rem;
    font-weight: 700;
}

.tb-zoom-shot-display.filled {
    border-color: rgba(40, 167, 69, 0.5);
    background: rgba(40, 167, 69, 0.15);
}

.tb-zoom-shot-display.next {
    border-color: rgba(74, 158, 255, 0.6);
    background: rgba(74, 158, 255, 0.15);
    animation: tb-zoom-pulse 1.5s ease infinite;
}

@keyframes tb-zoom-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(74, 158, 255, 0); }
}

.tb-zoom-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-top: 12px;
    text-align: center;
}

/* Zoom button on target cards (touch devices only) */
.tb-zoom-btn {
    display: none;
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(74, 158, 255, 0.8);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    z-index: 5;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.tb-zoom-btn:active {
    background: rgba(74, 158, 255, 1);
    transform: scale(0.9);
}

@media (pointer: coarse) {
    .tb-zoom-btn {
        display: flex;
    }
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 992px) {
    .tb-series-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tb-meta-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tb-meta-row {
        grid-template-columns: 1fr;
    }

    .tb-series-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .tb-serie-card {
        padding: 12px 8px;
    }

    .tb-shot-input {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .tb-shots-row {
        gap: 4px;
    }

    .tb-notes-grid {
        grid-template-columns: 1fr;
    }

    .tb-total-box {
        flex-wrap: wrap;
        justify-content: center;
        padding: 12px 16px;
    }

    .tb-weather-selector {
        gap: 8px;
    }

    .tb-weather-option {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .tb-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .tb-target {
        max-width: 140px;
    }

    .tb-target-duell {
        max-width: 140px;
    }
}

@media (max-width: 480px) {
    .tb-series-grid {
        grid-template-columns: 1fr;
    }

    .tb-shot-input {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .tb-target {
        max-width: 160px;
    }

    .tb-target-duell {
        max-width: 160px;
    }
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    /* Hide non-print elements */
    .no-print,
    .legal-header,
    .footer-modern,
    .navbar,
    .navbar-modern,
    header,
    footer,
    .no-print-header .legal-card-icon,
    .cookie-consent,
    .skip-to-content,
    .tb-actions,
    .tb-zoom-btn,
    .tb-zoom-overlay,
    #cookie-banner,
    nav {
        display: none !important;
    }

    /* Show print header */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 16px;
        padding: 12px;
        border: 2px solid #000;
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-header h1 {
        font-size: 14pt;
        margin: 0 0 4px;
        color: #000 !important;
    }

    .print-header p {
        font-size: 9pt;
        margin: 0;
        color: #333 !important;
    }

    /* Reset colors for print */
    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10pt;
    }

    .legal-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .legal-card,
    .tb-card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
        margin-bottom: 12px !important;
        break-inside: avoid;
        box-shadow: none !important;
    }

    /* Serien container must allow page breaks */
    #tb-serien-container {
        break-inside: auto !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    #tb-serien-container > .legal-card-header {
        display: none !important;
    }

    #tb-serien-container > .legal-card-body {
        padding: 0 !important;
    }

    .legal-card-header {
        background: #f5f5f5 !important;
        border-bottom: 1px solid #ccc !important;
        padding: 6px 12px !important;
    }

    .legal-card-title {
        color: #000 !important;
        font-size: 11pt !important;
    }

    .legal-card-body {
        padding: 12px !important;
    }

    /* Section headers with color bars */
    .tb-badge-praezision {
        background: #fdd !important;
        color: #c0392b !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tb-badge-duell {
        background: #d6eaf8 !important;
        color: #2471a3 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tb-serie-time {
        color: #666 !important;
    }

    .tb-serie-delete {
        display: none !important;
    }

    .tb-add-toolbar,
    .tb-empty-hint {
        display: none !important;
    }

    /* Meta fields */
    .tb-meta-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .tb-meta-field label {
        color: #333 !important;
        font-size: 8pt;
    }

    .tb-input,
    .tb-shot-input,
    .tb-textarea {
        background: #fff !important;
        border: 1px solid #999 !important;
        color: #000 !important;
        font-size: 9pt;
    }

    /* Mood */
    .tb-mood {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        opacity: 0.3;
    }

    .tb-mood.active {
        opacity: 1 !important;
        border-color: #000 !important;
    }

    /* Weather */
    .tb-weather-option {
        border: 1px solid #ccc !important;
        color: #000 !important;
        background: transparent !important;
    }

    .tb-weather-option:has(input:checked) {
        background: #e0e0e0 !important;
        border-color: #000 !important;
    }

    /* Series grid */
    .tb-series-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px;
    }

    .tb-serie-card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        padding: 8px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .tb-serie-header {
        margin-bottom: 8px !important;
    }

    .tb-serie-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 7pt !important;
        padding: 2px 5px !important;
    }

    .tb-serie-number {
        color: #000 !important;
        font-size: 12pt !important;
    }

    .tb-serie-sum {
        color: #000 !important;
        border-top: 1px solid #ccc !important;
    }

    .tb-sum-value {
        color: #000 !important;
        font-weight: 800;
    }

    /* Total row */
    .tb-total-row {
        margin-top: 12px !important;
    }

    /* Targets */
    .tb-target {
        max-width: 100px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tb-target-duell {
        max-width: 100px !important;
    }

    .tb-target-wrapper {
        margin-bottom: 6px !important;
    }

    .tb-target circle,
    .tb-target text {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tb-shot-marker {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Total */
    .tb-total-box {
        background: #f5f5f5 !important;
        border: 2px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tb-total-label {
        color: #000 !important;
    }

    .tb-total-value {
        color: #000 !important;
        background: #fff !important;
        border: 1px solid #000 !important;
        font-size: 16pt;
    }

    .tb-total-max {
        color: #666 !important;
    }

    /* Notes */
    .tb-notes-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tb-note-field label {
        color: #000 !important;
    }

    .tb-textarea {
        min-height: 60px;
    }

    /* Shot inputs */
    .tb-shot-input {
        width: 24px !important;
        height: 20px !important;
        font-size: 8pt !important;
        padding: 1px !important;
        border-radius: 2px !important;
    }

    .tb-shots-row {
        gap: 3px !important;
        margin-bottom: 4px !important;
    }

    .tb-shot-input.filled {
        border-color: #000 !important;
        background: #f0f0f0 !important;
    }

    .tb-serie-sum {
        font-size: 9pt !important;
        padding-top: 4px !important;
    }

    /* Page settings */
    @page {
        size: A4 portrait;
        margin: 10mm;
    }
}
