/* css/docs.css - Styl pro technickou dokumentaci (Tmavý motiv) */

:root {
    --surface: #1e1e1e;
    --border: #333333;
    --text: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary: #4a90e2;
}

/* =========================================
   1. VYHLEDÁVÁNÍ A HLAVIČKY
   ========================================= */

.search-container {
    text-align: center;
    margin-bottom: 40px;
}

.search-container input {
    width: 100%;
    max-width: 600px;
    padding: 15px 25px;
    border-radius: 30px;
    border: 1px solid var(--primary);
    background: #1a1a1a;
    color: white;
    font-size: 1.1em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    outline: none;
    transition: all 0.3s;
}

.search-container input:focus {
    border-color: #e67e22;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.line-header {
    border-bottom: 2px solid #444;
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-top: 40px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.3em;
}

/* =========================================
   2. AKORDEON (SEZNAM DOKUMENTŮ)
   ========================================= */

.accordion-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.accordion-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.accordion-header {
    background: #252525;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #333;
}

/* Levá část hlavičky (šipka, název, verze) */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.accordion-arrow {
    font-size: 1.2em;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.accordion-item.open .accordion-arrow {
    transform: rotate(90deg);
}

.doc-title {
    margin: 0;
    color: #fff;
    font-size: 1.1em;
    font-weight: bold;
}

.doc-version {
    background: #444;
    color: #ccc;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-family: 'Consolas', monospace;
    border: 1px solid #555;
}

/* Pravá část hlavičky (datum, status) */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.doc-date {
    color: #666;
    font-size: 0.85em;
    font-style: italic;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: bold;
    color: #111;
    font-size: 0.8em;
    text-transform: uppercase;
}
.status-ok { background: #2ecc71; }
.status-warning { background: #f1c40f; }
.status-broken { background: #e74c3c; color: white; }


/* =========================================
   3. OBSAH DOKUMENTU (UVNITŘ AKORDEONU)
   ========================================= */

.accordion-content {
    display: none; /* Skryto defaultně */
    padding: 25px;
    border-top: 1px solid #333;
    background: #1a1a1a;
}

.doc-grid {
    display: grid;
    grid-template-columns: 300px 1fr; /* Levý sloupec fixní, pravý zbytek */
    gap: 30px;
}

/* Náhled obrázku */
.doc-image-wrapper {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #444;
    background: #000;
}

.doc-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.doc-image-wrapper:hover img {
    transform: scale(1.05);
    opacity: 0.7;
}

.zoom-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    font-weight: bold;
    font-size: 0.9em;
}

.doc-image-wrapper:hover .zoom-hint {
    opacity: 1;
}

/* Tlačítko stáhnout PDF */
.btn-download {
    background: #27ae60;
    color: white;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    transition: background 0.2s;
    border: 1px solid #2ecc71;
}

.btn-download:hover {
    background: #219150;
}

/* Textové detaily */
.doc-details h4 {
    margin-top: 0;
    color: var(--primary);
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.doc-text-box {
    background: #222;
    padding: 15px;
    border-radius: 6px;
    font-size: 0.95em;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 25px;
    border: 1px solid #333;
}

.box-problem {
    border-left: 4px solid #e74c3c;
    background: rgba(231, 76, 60, 0.05);
}

/* Akční tlačítka (Upravit, Smazat) */
.doc-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    border-top: 1px dashed #333;
    padding-top: 20px;
}

.btn-edit-small {
    background: #34495e;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-edit-small:hover { background: #4a90e2; }

.btn-delete-small {
    background: #c0392b;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-delete-small:hover { background: #e74c3c; }


/* =========================================
   4. LIGHTBOX (VYSKAKOVACÍ OKNO PRO FOTKY)
   ========================================= */

.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s;
    border: 1px solid #444;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 2001;
}

.lightbox-close:hover {
    color: #e74c3c;
}

@keyframes zoomIn {
    from {transform:scale(0.8); opacity: 0;}
    to {transform:scale(1); opacity: 1;}
}


/* =========================================
   5. FORMULÁŘ (PŘIDÁNÍ/ÚPRAVA)
   ========================================= */

.docs-form {
    background: var(--surface);
    padding: 25px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 40px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.docs-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 0.9em;
    color: var(--text-muted);
}

.docs-form input[type="text"],
.docs-form select,
.docs-form textarea {
    width: 100%;
    padding: 10px;
    background-color: #2d2d2d;
    border: 1px solid #444;
    color: white;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s;
}

.docs-form input:focus,
.docs-form select:focus,
.docs-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Styl pro file input */
.docs-form input[type="file"] {
    background: #222;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    color: #aaa;
    border: 1px dashed #555;
    width: 100%;
    box-sizing: border-box;
}

.docs-form input[type="file"]::-webkit-file-upload-button {
    background: #444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    font-weight: bold;
}

/* Tlačítka formuláře */
.btn-submit {
    background-color: var(--primary);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
}
.btn-submit:hover { opacity: 0.9; }


/* =========================================
   6. RESPONZIVITA
   ========================================= */

@media (max-width: 768px) {
    .doc-grid {
        grid-template-columns: 1fr; /* Na mobilu pod sebou */
    }
    
    .header-right {
        display: none; /* Na mobilu schováme datum */
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .doc-image-wrapper img {
        max-height: 200px;
        object-fit: contain;
        background: #000;
    }
}

/* =========================================
   VIZUÁLNÍ SCHÉMA PLC (GENERÁTOR) - OPRAVENO
   ========================================= */

.plc-diagram-container {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    overflow-x: auto; /* Zabrání rozbití stránky, vytvoří scrollování */
}

/* Obal pro samotné schéma, drží to pohromadě */
.plc-diagram-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: max-content; /* Zabrání smrsknutí na mobilu */
}

/* Sekce (Nahoře, Uprostřed, Dole) */
.plc-row-h { 
    display: flex; 
    justify-content: center; 
    gap: 10px; 
    margin: 15px 0; 
}
.plc-middle { 
    display: flex; 
    justify-content: center; 
    align-items: center; /* OPRAVA: Změněno ze stretch na center, zabrání natahování desky */
    gap: 20px; 
    margin: 10px 0; 
}
.plc-col-v { 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    gap: 15px; 
}

/* Samotná "Modrá deska" PLC */
.plc-board {
    background: linear-gradient(135deg, #1e4b6b, #15334a);
    border: 2px solid #2980b9;
    border-radius: 6px;
    padding: 40px 30px;
    text-align: center;
    color: #ecf0f1;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.6), 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 220px;
    min-height: 250px; /* Garantuje, že deska bude mít vždy hezký tvar */
}

.plc-board::before {
    content: 'Starmon PLC';
    font-size: 0.75em;
    color: rgba(255,255,255,0.5);
    position: absolute;
    top: 10px; left: 10px;
    letter-spacing: 1px;
    font-weight: bold;
}

.plc-board-chip {
    width: 60px; height: 60px;
    background: #111;
    border-radius: 4px;
    border: 1px solid #333;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

/* Terminály (Konektory) */
.plc-port {
    background: #2d2d2d;
    border: 1px solid #555;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.85em;
    text-align: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    min-width: 120px;
    max-width: 200px;
    word-wrap: break-word; /* Dlouhý text zalomí na další řádek */
}

/* Kolejové svorky (Nahoře/Dole) */
.plc-port-track {
    border-bottom: 3px solid #f1c40f;
    color: #f1c40f;
}

/* Návěstidla svorky (Vlevo/Vpravo) */
.plc-port-signal {
    border-right: 3px solid #e74c3c;
    color: #e74c3c;
}
.plc-col-v:first-child .plc-port-signal { 
    border-right: none; 
    border-left: 3px solid #e74c3c; 
}

/* Znázornění drátů pro návěstidla (OPRAVENÝ NÁZEV TŘÍDY) */
.plc-wire-info { 
    font-size: 0.75em; 
    color: #888; 
    display: block; 
    margin-top: 6px;
    margin-bottom: 4px;
}

.plc-wire-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    background: #111;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #333;
}
.wire-dot { width: 8px; height: 8px; border-radius: 50%; }
.wire-dot.active { background: #2ecc71; box-shadow: 0 0 5px #2ecc71;}
.wire-dot.inactive { background: #444; }


/* Skrývání formuláře pro PLC */
.plc-form-fields {
    display: none;
    background: rgba(41, 128, 185, 0.05);
    border: 1px dashed #2980b9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* Doplňky pro rozdělené PLC porty */
.plc-input-group {
    background: #151515;
    border: 1px solid #333;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}
.plc-input-group label { color: #ccc; font-size: 0.85em; }
.plc-input-group .header-label { font-size: 1em; margin-bottom: 10px; display: block; }
.plc-input-split { display: flex; gap: 10px; margin-top: 10px; }

/* Vzhled na vizuální desce */
.plc-port-header {
    background: #111;
    padding: 5px;
    border-radius: 3px;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 1.1em;
    color: #fff;
}
.plc-port-split { display: flex; gap: 15px; justify-content: center; text-align: left; font-size: 0.9em; }
.plc-port-col { display: flex; flex-direction: column; gap: 2px; }
.plc-port-col-title { color: #888; font-size: 0.8em; text-transform: uppercase; border-bottom: 1px solid #444; padding-bottom: 2px; margin-bottom: 4px; }