/* CSS Reset für unser Tool */
#bk-tasting-app {
    all: initial;
    /* Setzt fast alle geerbten Styles zurück */
    display: block;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f4f4;
    padding: 30px;
    color: #333;
    border-radius: 12px;
    line-height: 1.5;
}

#bk-tasting-app h2,
#bk-tasting-app h3,
#bk-tasting-app h4 {
    display: block;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2a100;
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Flex-Grid für die Kopfdaten */
.bk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.bk-input-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
}

#bk-tasting-app input,
#bk-tasting-app textarea,
#bk-tasting-app select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    /* Wichtig für die Breite */
    font-size: 1rem;
}

/* Styling der Blöcke */
.bk-block {
    background: white;
    border: 1px solid #ddd;
    border-left: 8px solid #e2a100;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.bk-block:hover {
    transform: translateX(5px);
}

.bk-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* Buttons */
.bk-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: opacity 0.2s;
    box-sizing: border-box;
}

.bk-btn-add {
    background: #e2a100;
    color: white;
    margin-right: 10px;
}

.bk-btn-save {
    background: #27ae60;
    color: white;
    width: 100%;
    font-size: 1.2em;
    margin-top: 20px;
}

.bk-btn-delete {
    background: #c0392b;
    color: white;
    font-size: 0.8em;
}

.bk-btn:hover {
    opacity: 0.8;
}

/* Material-Checkliste */
.bk-material-card {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

/* ========================================== */
/* DRUCK-ANSICHT (A4 Formatierung & Mobile-Safe) */
/* ========================================== */
@media print {

    /* Verstecke die anderen App-Bereiche (Dashboard, Planer, Mod) komplett */
    #bk-tasting-app>div:not(#bk-print-view),
    .app-bottom-nav {
        display: none !important;
    }

    /* Verstecke typische WordPress-Elemente (Menü, Footer, Sidebar) */
    header,
    footer,
    nav,
    aside,
    iframe,
    #wpadminbar,
    .sidebar,
    .widget-area {
        display: none !important;
    }

    /* Setzt die Seite für den PDF-Druck zurück */
    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* WICHTIG: position: static löst das Problem der leeren Seiten auf Tablets/Handys! */
    #bk-print-view {
        display: block !important;
        position: static !important;
        width: 100% !important;
        visibility: visible !important;
    }

    /* Schönes Tabellen-Layout für den Ausdruck */
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .print-table th,
    .print-table td {
        border: 1px solid #000;
        padding: 10px;
        text-align: left;
    }

    .print-table th {
        background-color: #f2f2f2 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-header {
        border-bottom: 2px solid #000;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
}

/* ========================================== */
/* MOBILE DASHBOARD ANSICHT (Karten-Layout)   */
/* ========================================== */
@media screen and (max-width: 768px) {
    /* Mache die Tabelle zu normalen Block-Elementen */
    .bk-responsive-table table, 
    .bk-responsive-table thead, 
    .bk-responsive-table tbody, 
    .bk-responsive-table th, 
    .bk-responsive-table td, 
    .bk-responsive-table tr { 
        display: block; 
    }
    
    /* Verstecke den Tabellenkopf (nur visuell, nicht für Screenreader) */
    .bk-responsive-table thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    /* Mach aus jeder Zeile eine Karte */
    .bk-responsive-table tr { 
        border-bottom: 3px solid #e2a100 !important; 
        margin-bottom: 15px; 
        background: #fff;
    }
    
    /* Abstand links schaffen für die Labels */
    .bk-responsive-table td { 
        border: none;
        border-bottom: 1px solid #eee; 
        position: relative;
        padding-left: 35% !important; 
        text-align: left; 
    }
    
    /* Die Labels vor dem Inhalt generieren */
    .bk-responsive-table td::before { 
        position: absolute;
        top: 15px;
        left: 15px;
        width: 30%; 
        white-space: nowrap;
        font-weight: bold;
        color: #2c3e50;
        content: attr(data-label); /* Holt den Text aus dem HTML-Attribut! */
    }

    /* Die Buttons unten formatiert anordnen */
    .bk-responsive-table td[data-label="Aktionen"] {
        padding-left: 15px !important; /* Label-Platz aufheben */
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        background: #f9f9f9; /* Leichter Kontrast für die Buttons */
    }
    
    /* Das Label "Aktionen" ausblenden, da Buttons selbsterklärend sind */
    .bk-responsive-table td[data-label="Aktionen"]::before {
        display: none; 
    }
}