/* static/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #dfdfdf;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 10px;
    border-radius: 10px;
}

h1 {
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.logo {
    max-width: 200px;
    margin-bottom: 10px;
}

.controls {
    justify-content: center;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    border-width: 1px;
    border-radius: 25px;
    border-color: black;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #3b8ed0;
    color: black;
}

.btn-primary:hover {
    background: #2e7ab8;
    border-width: 2px;
}

.btn-danger {
    background: #e35151;
    color: black;
}

.btn-danger:hover {
    background: #c93939;
    border-width: 2px;
}

.btn-mode.solo {
    background: #06c9f5;
    color: black;
}

.btn-mode.all {
    background: #FFCDB2;
    color: #333;
}

.btn-scan {
    background: #4CAF50;
    color: black;
    font-size: 18px;
}

#search-btn {
    background-color: #32CD32;
    color: black;
}

#search-btn:hover {
    background-color: #28a428;
    border-width: 2px;
}

#clear-colors-btn {
    background: #ff9800;
    color: black;
}

#clear-colors-btn:hover {
    background: #e68900;
    border-width: 2px;
}

.scanner-section {
    justify-content: center;
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== VIDEO CONTAINER S CROSSHAIR ===== */
#video-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    max-height: 400px;
    margin: 10px auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

/* Overlay pre crosshair */
.crosshair-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Zameriavací rámček */
.crosshair-box {
    position: relative;
    width: 250px;
    height: 250px;
    border: 3px solid rgba(0, 255, 0, 0.8);
    border-radius: 10px;
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    animation: pulse-border 2s infinite;
}

/* Rohy rámčeka */
.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid #00ff00;
}

.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 10px;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 10px;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 10px;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 10px;
}

/* Kríž v strede */
.crosshair-line {
    position: absolute;
    background: rgba(255, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.crosshair-line.horizontal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 3px;
}

.crosshair-line.vertical {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3px;
    height: 60px;
}

/* Inštrukcia */
.scan-instruction {
    margin-top: 20px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    animation: blink 1.5s infinite;
}

/* Animácie */
@keyframes pulse-border {

    0%,
    100% {
        border-color: rgba(0, 255, 0, 0.8);
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    }

    50% {
        border-color: rgba(0, 255, 0, 1);
        box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Úspešné skenovanie - zelený flash */
.crosshair-box.success {
    border-color: #00ff00 !important;
    background: rgba(0, 255, 0, 0.3) !important;
    animation: success-flash 0.5s;
}

@keyframes success-flash {

    0%,
    100% {
        background: rgba(0, 255, 0, 0.1);
    }

    50% {
        background: rgba(0, 255, 0, 0.5);
    }
}

/* Chybné skenovanie - červený flash */
.crosshair-box.error {
    border-color: #ff0000 !important;
    background: rgba(255, 0, 0, 0.3) !important;
    animation: error-flash 0.5s;
}

@keyframes error-flash {

    0%,
    100% {
        background: rgba(255, 0, 0, 0.1);
    }

    50% {
        background: rgba(255, 0, 0, 0.5);
    }
}

#manual-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin: 10px 0;
}

#manual-input:focus {
    outline: none;
    border-color: #3b8ed0;
}

/* Počítadlo výskytov */
.result-item .counter {
    float: right;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Hlavička výsledkov v ALL režime */
.result-header {
    background: #3498db;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
}

/* ===== LEGENDA FARIEB ===== */
.legend {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    color: black;
    font-size: 13px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-color {
    width: 120px;
    padding-top: 7px;
    padding-bottom: 5px;
    height: 30px;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.legend-color.correct {
    background: #32CD32;
}

.legend-color.alternative {
    background: #FFD700;
}

.legend-color.incorrect {
    background: red;
}

.legend-color.complete {
    background: #5D3FD3;
}

.legend-text {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

/* Kompletné ID */
.result-item.complete {
    background: #5D3FD3;
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 15px;
    border-radius: 5px;
    font-weight: bold;
}

.results-box {
    background: white;
    border-radius: 10px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    font-size: 18px;
    text-align: center;
}

.result-item {
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
}

.result-item.correct {
    background: #32CD32;
    color: black;
}

.result-item.alternative {
    background: #FFD700;
    color: #333;
}

.result-item.incorrect {
    background: #FF6347;
    color: black;
}

/* ===== TABUĽKY ===== */
#table-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.table-group {
    background: #ebebeb;
    border-radius: 20px;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
}

.table-group h3 {
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
    color: #333;
    margin-top: 5px;
    margin-bottom: 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th,
td {
    padding: 5px 3px;
    text-align: center;
    border: 2px solid rgba(79, 89, 102, .08);
}

th {
    background: #3498db;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Stĺpec Pozícia - najmenší */
td:nth-child(1),
th:nth-child(1) {
    font-size: 12px;
    font-weight: bold;
    width: 60px;
}

/* Stĺpce ID a Alt */
td:nth-child(2),
td:nth-child(3) {
    font-size: 11px;
}

/* Stĺpec ToFrom */
td:nth-child(4),
th:nth-child(4) {
    font-size: 11px;
    width: 80px;
    text-align: center;
}

/* Zvýraznenie ToFrom pri zhode */
tr.highlight-correct td:nth-child(4),
tr.highlight-alt td:nth-child(4) {
    font-weight: bold;
    background: rgba(255, 255, 255, 0.3);
}

/* Zvýraznené riadky */
tr.highlight-correct {
    background: #32CD32 !important;
    font-weight: bold;
    animation: pulse 0.5s ease-in-out;
}

tr.highlight-alt {
    background: #FFD700 !important;
    font-weight: bold;
    animation: pulse 0.5s ease-in-out;
}

/* Zvýraznenie zhodnej hodnoty v ID stĺpci */
tr.highlight-correct td:nth-child(2) {
    font-weight: bold;
    font-size: 14px;
}

/* Zmenšenie Alt stĺpca pri zhode ID */
tr.highlight-correct td:nth-child(3) {
    font-size: 9px;
    font-weight: normal;
}

/* Zmenšenie ID stĺpca pri zhode Alt */
tr.highlight-alt td:nth-child(2) {
    font-size: 9px;
    font-weight: normal;
}

/* Pre Alt stĺpec - inline styling zo JS zvýrazní len zhodnú hodnotu */
tr.highlight-alt td:nth-child(3) {
    font-weight: normal;
}

/* Animácia */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
    border-width: 2px;
}

#folder-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.folder-btn {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.folder-btn:hover {
    background: #2980b9;
    border-width: 2px;
}

#program-search {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#program-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.program-btn {
    padding: 15px;
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.program-btn:hover {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    border-width: 2px;
}

/* ===== RESPONZÍVNE DIZAJN ===== */

/* Desktop - veľké obrazovky (1200px+) */
@media (min-width: 1200px) {
    .container {
        padding: 0px;
    }

    h1 {
        font-size: 2rem;
    }

    .logo {
        max-width: 250px;
    }

    .controls {
        gap: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 20px;
    }

    #video-container {
        max-width: 400px;
        max-height: 500px;
    }

    .crosshair-box {
        width: 300px;
        height: 300px;
    }

    .table-group {
    }

    table {
        font-size: 14px;
    }

    th,
    td {
        padding: 8px 5px;
    }

    .legend {
        margin-bottom: 5px;
    }

    .legend-color {
        width: 150px;
        font-size: 14px;
        height: 30px;
        padding-top: 7px;
    }
}

/* Tablet - stredné obrazovky (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .logo {
        max-width: 220px;
    }

    .controls {
        gap: 12px;
    }

    .btn {
        padding: 14px 22px;
        font-size: 15px;
    }

    #video-container {
        max-width: 350px;
    }

    .crosshair-box {
        width: 220px;
        height: 220px;
    }

    .table-group {
    }

    table {
        font-size: 11px;
    }

    .legend-color {
        width: 110px;
        font-size: 12px;
    }

    #program-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .modal-content {
        width: 85%;
        margin: 8% auto;
    }
}

/* Malé tablety a veľké mobily (421px - 767px) */
@media (min-width: 421px) and (max-width: 767px) {
    body {
        padding: 8px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .logo {
        max-width: 180px;
    }

    .controls {
        gap: 6px;
    }

    .btn {
        font-size: 11px;
        flex: 1 1 auto;
        min-width: 80px;
        min-height: 30px;

    }

    #video-container {
        max-width: 280px;
    }

    .crosshair-box {
        width: 180px;
        height: 180px;
    }

    .corner {
        width: 25px;
        height: 25px;
        border-width: 3px;
    }

    .crosshair-line.horizontal {
        width: 50px;
    }

    .crosshair-line.vertical {
        height: 50px;
    }

    .scan-instruction {
        font-size: 12px;
        padding: 8px 15px;
    }

    table {
        font-size: 10px;
    }

    th,
    td {
        padding: 4px 2px;
    }

    td:nth-child(1) {
        font-size: 10px;
        width: 50px;
    }

    .table-group {
    }

    .table-group h3 {
        font-size: 16px;
    }

    .result-item {
        font-size: 15px;
        padding: 12px;
    }

    .legend {
        gap: 6px;
        font-size: 11px;
        margin-bottom: 5px;
    }

    .legend-color {
        width: 85px;
        font-size: 11px;
        height: 26px;
        padding-top: 6px;
    }

    #manual-input {
        font-size: 15px;
        padding: 12px;
    }

    .modal-content {
        width: 92%;
        padding: 18px;
    }

    #program-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .program-btn {
        font-size: 13px;
        padding: 12px;
    }
}

/* Malé mobily (max 420px) */
@media (max-width: 420px) {
    body {
        padding: 5px;
    }

    h1 {
        font-size: 1rem;
        margin-top: 0.3rem;
    }

    .logo {
        max-width: 200px;
        margin-bottom: 8px;
    }

    /* TLAČIDLÁ ZOSTÁVAJÚ V RIADKU */
    .controls {
        gap: 4px;
        flex-wrap: wrap;
        margin-bottom: 5px;
    }

    .btn {
        font-size: 10px;
        flex: 1 1 auto;
        min-width: 80px;
        min-height: 30px;

    }

    #video-container {
        max-width: 250px;
        max-height: 350px;
    }

    .crosshair-box {
        width: 150px;
        height: 150px;
    }

    .corner {
        width: 20px;
        height: 20px;
        border-width: 3px;
    }

    .crosshair-line.horizontal {
        width: 40px;
        height: 2px;
    }

    .crosshair-line.vertical {
        height: 40px;
        width: 2px;
    }

    .scan-instruction {
        font-size: 10px;
        padding: 6px 10px;
        margin-top: 15px;
    }

    .scanner-section {
        padding: 15px;
    }

    table {
        font-size: 9px;
    }

    th,
    td {
        padding: 3px 2px;
    }

    td:nth-child(1),
    th:nth-child(1) {
        font-size: 9px;
        width: 45px;
    }

    td:nth-child(4),
    th:nth-child(4) {
        width: 60px;
        font-size: 9px;
    }

    tr.highlight-correct td:nth-child(2) {
        font-size: 11px;
    }

    tr.highlight-correct td:nth-child(3),
    tr.highlight-alt td:nth-child(2) {
        font-size: 8px;
    }

    .table-group {
    }

    .table-group h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    #table-container {
        gap: 8px;
        padding: 8px 0;
    }

    .result-item {
        font-size: 13px;
        padding: 10px;
    }

    .result-item.complete {
        font-size: 15px;
        padding: 12px;
    }

    .results-box {
        font-size: 15px;
    }

    /* LEGENDA ZOSTÁVA V RIADKU */
    .legend {
        gap: 4px;
        font-size: 10px;
        flex-wrap: wrap;
        margin-bottom: 0px;
    }

    .legend-item {
        flex-wrap: wrap;
        gap: 4px;
    }

    .legend-color {
        width: 70px;
        font-size: 12px;
        height: 20px;
        padding-top: 5px;
        padding-bottom: 20px;
        min-width: 90px;
    }

    .legend-text {
        font-size: 11px;
        display: none;
        /* Skryjeme text na mobile pre úsporu miesta */
    }

    #manual-input {
        font-size: 14px;
        padding: 10px;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
        margin: 10% auto;
        max-height: 85vh;
    }

    .close {
        font-size: 24px;
    }

    #folder-buttons {
        gap: 8px;
    }

    .folder-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    #program-search {
        font-size: 14px;
        padding: 8px;
    }

    #program-list {
        grid-template-columns: 1fr;
        gap: 8px;
        max-height: 300px;
    }

    .program-btn {
        font-size: 13px;
        padding: 12px;
    }
}

/* Extra malé mobily (max 389px) */
@media (max-width: 389px) {
    h1 {
        font-size: 0.9rem;
    }

    .logo {
        max-width: 120px;
    }

    .btn {
        font-size: 8px;
        padding: 7px 5px;
    }

    .crosshair-box {
        width: 130px;
        height: 130px;
    }

    .corner {
        width: 18px;
        height: 18px;
    }

    table {
        font-size: 8px;
    }

    .table-group {
    }

    .result-item {
        font-size: 12px;
    }

    .legend-color {
        width: 65px;
        font-size: 7px;
        height: 22px;
    }

    .legend {
        gap: 3px;
    }
}

/* Landscape orientácia pre mobily */
@media (max-height: 500px) and (orientation: landscape) {
    #video-container {
        max-height: 250px;
    }

    .crosshair-box {
        width: 150px;
        height: 150px;
    }

    .modal-content {
        max-height: 90vh;
        margin: 2% auto;
    }

    .scanner-section {
        padding: 10px;
    }

    .btn {
        padding: 6px 8px;
        font-size: 10px;
    }

    .legend-color {
        height: 22px;
        font-size: 8px;
    }
}