:root {
    /* Barvy z config.php */
    --primary-color: #4a90d9;
    --bg-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --cell-height: 100px;

    /* Dynamická šířka sloupců (nastavuje PHP) */
    --num-cols: 12;
    --col-width: calc(100% / var(--num-cols));
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.controls {
    font-size: 14px;
    background: #eee;
    padding: 5px 10px;
    border-radius: 4px;
}

.controls a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    margin: 0 3px;
}

.controls a:hover {
    text-decoration: underline;
}

.controls a.active {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.print-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
    display: inline-block;
}

.print-btn:hover {
    opacity: 0.9;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 8px;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    width: var(--col-width);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    height: 40px;
    text-align: center;
    font-size: 14px;
}

td {
    counter-increment: cell-counter;
    height: var(--cell-height);
    min-height: var(--cell-height);
}

tbody {
    counter-reset: cell-counter;
}

td::after {
    content: counter(cell-counter);
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    font-weight: bold;
    color: #666;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 2px;
    z-index: 10;
}

.cell-content {
    display: block;
    padding-right: 20px;
    padding-top: 4px;
    font-size: clamp(10px, 1.5vw, 14px);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

/* === OPTIMALIZACE PRO TISK === */
@media print {
    body {
        margin: 0;
        background: white;
    }

    .container {
        box-shadow: none;
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .no-print, .print-btn, .controls, .info {
        display: none !important;
    }

    .cell-content {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        font-size: 12px;
    }

    td {
        height: auto;
        min-height: 80px;
    }

    th {
        height: 30px;
        font-size: 12px;
    }
}
