/* ===== SHARED BANKO STYLES ===== */

body {
    font-family: sans-serif;
    background-color: #f4f4f9;
    margin: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 { 
    margin-bottom: 20px; 
    color: #333; 
}

/* === COMMON BUTTON STYLES === */
.button-container {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    color: white;
    display: inline-block;
}

.btn-print { 
    background-color: #28a745; 
}

.btn-print:hover { 
    background-color: #218838; 
}

.btn-generate { 
    background-color: #007bff; 
}

.btn-generate:hover { 
    background-color: #0056b3; 
}

/* === ERROR MESSAGE === */
.error-message {
    padding: 20px;
    border: 2px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    font-weight: bold;
    max-width: 800px;
    margin: 20px auto;
}

/* ===== BANKO PLADER TIL PRINT (A4) ===== */

/* CONTAINER TIL ALLE 3 PLADER */
.sheets-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 15px; 
}

/* SELVE KORTET */
.banko-card {
    background-color: #fff;
    border: 2px solid #333; 
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box; 
}

/* RÆKKERNE */
.banko-row {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-bottom: 4px;
    /* Højde tilpasset så 3 plader kan være på en A4 side */
    height: 95px; 
}

/* CELLER (Fælles for både billeder og tomme) */
.banko-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff; /* Altid hvid baggrund */
    overflow: hidden;
    position: relative;
}

/* TOMME FELTER */
.banko-cell.empty {
    /* Før var denne grå (#eee), nu er den hvid eller gennemsigtig */
    background-color: #fff; 
}

/* BILLEDE I BANKO CELLS */
.banko-cell img {
    width: 100%;
    height: 75%; 
    object-fit: contain;
    display: block;
}

/* NUMMER I BANKO */
.banko-number {
    font-size: 16px; 
    font-weight: bold;
    color: #007bff;
    line-height: 1.2;
}

/* ===== BANKOPLADE OVERSIGT (A3) ===== */

/* HOVED CONTAINER (Oversigtspladen) */
.overview-card {
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1400px; /* Bredere da det er A3 */
    box-sizing: border-box;
}

/* GRID LAYOUT */
.image-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr); /* 10 kolonner */
    gap: 5px;
}

/* DE ENKELTE FELTER */
.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    text-align: center;
    /* Fast højde sikrer at rækkerne står pænt */
    height: 130px; 
    overflow: hidden;
}

/* BILLEDE I GRID */
.grid-item img {
    width: 100%;
    height: 60%; /* Billedet fylder toppen */
    object-fit: contain;
    margin-bottom: 2px;
}

/* INFO TEKST (Nummer og Navn) */
.item-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    line-height: 1.1;
}

/* NUMMERET I GRID */
.item-number {
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff; /* Den blå farve */
    margin: 0;
}

/* NAVNET I GRID */
.item-name {
    font-size: 0.75em;
    color: #333;
    font-weight: 600;
    white-space: normal;
    margin-top: 2px;
}

/* ===== PRINT STYLING (A4 PORTRAIT) ===== */
@media print {
    @page {
        size: A4 portrait;
        margin: 5mm; 
    }

    body {
        background-color: white;
        margin: 0;
        padding: 0;
        display: block;
    }
    
    h1, .button-container, .error-message {
        display: none !important;
    }

    .sheets-container {
        display: block;
        width: 100%;
        max-width: none;
        gap: 10mm; 
    }

    .banko-card {
        box-shadow: none;
        border: 2px solid #000;
        page-break-inside: avoid; 
        margin-bottom: 10mm; 
    }
    
    /* Sikrer at tomme felter forbliver hvide på print */
    .banko-cell.empty {
         background-color: #fff !important;
         -webkit-print-color-adjust: exact;
         print-color-adjust: exact;
    }
}

/* ===== PRINT STYLING (A3 PORTRAIT) ===== */
@media print {
    @page {
        size: A3 portrait; /* Sætter papirstørrelsen til A3 */
        margin: 10mm;      /* Margen */
    }

    .overview-card {
        box-shadow: none;
        border: 2px solid #000;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .grid-item {
        border: 1px solid #ccc;
    }
}
