html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
}

/* Login Page Styles */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.login-container h1 {
    text-align: center;
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
}
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Padding zahrnutý v šířce */
}
.login-container button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: #0056b3;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    box-sizing: border-box; /* Padding zahrnutý v šířce */
}
.login-container button:hover {
    background-color: #004494;
}

.flash-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    text-align: center;
}
.flash-message.success { background-color: #d4edda; color: #155724; }
.flash-message.danger { background-color: #f8d7da; color: #721c24; }
.flash-message.info { background-color: #d1ecf1; color: #0c5460; }


/* Main Page Layout */
.container {
    max-width: 95%; /* Adjusted for FullHD */
    margin: 0 auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    color: #0056b3;
    margin-bottom: 30px;
}

.markdown-content {
    margin-top: 20px; /* Added spacing */
    padding: 15px 25px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
    line-height: 1.6;
    color: #333; /* Explicitly set text color */
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 15px;
}

.markdown-content code {
    background-color: #e9e9e9;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.markdown-content pre {
    background-color: #e9e9e9;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

.usage-info {
    margin-top: 20px;
    padding: 15px 25px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
    line-height: 1.6;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
    gap: 15px;
    margin-top: 25px; /* Spacing after filters */
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.controls label {
    margin-right: 10px;
    font-weight: bold;
}

.controls select,
.controls button {
    padding: 8px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #e9e9e9;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

.controls button:hover {
    background-color: #d6d6d6;
}

.controls button:active {
    background-color: #c0c0c0;
}


/* Search Controls */
.search-controls {
    display: flex;
    gap: 8px;
    flex: 1 1 auto; /* Allow to grow and take available space */
    min-width: 300px;
}

.search-controls input {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    flex: 1; /* Input takes most of the space */
    min-width: 150px;
}

/* Depth Controls */
.depth-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

/* Search Notification */
.search-notification {
    margin: 20px 0;
    padding: 15px 20px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-notification.success {
    background-color: #d4edda;
    border-color: #28a745;
    border-left-color: #28a745;
}

.search-notification.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    border-left-color: #dc3545;
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

#notification-message {
    flex: 1;
    font-size: 0.95em;
    color: #856404;
}

.search-notification.success #notification-message {
    color: #155724;
}

.search-notification.error #notification-message {
    color: #721c24;
}

#search-all-depths-btn {
    padding: 8px 15px;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

#search-all-depths-btn:hover {
    background-color: #004494;
}

.close-notification {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #856404;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-notification:hover {
    color: #533f03;
}

.depth-link {
    color: #0056b3;
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
}

.depth-link:hover {
    color: #004494;
}


/* Diagram Container */
#diagram-container {
    border: 1px solid #ddd;
    background-color: #fff;
    overflow: hidden; /* Needed for zoom to work visually */
    position: relative; /* For positioning SVG */
    min-height: 75vh; /* Adjusted for FullHD */
    display: flex;
    justify-content: center;
    align-items: center;
}

#diagram-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    transform-origin: 0 0; /* Important for consistent zoom behavior */
    cursor: grab;
}

/* Oprava zobrazení textu v SVG - zabránit zalomení textu na více řádků */
#diagram-container svg foreignObject div {
    white-space: nowrap !important;
    overflow: visible !important;
}

#diagram-container svg .nodeLabel p,
#diagram-container svg .edgeLabel p,
#diagram-container svg .cluster-label p {
    white-space: nowrap !important;
    overflow: visible !important;
}


/* Tooltip Styles */
#tooltip {
    position: absolute;
    display: none;
    padding: 12px;
    background-color: #333;
    color: white;
    border-radius: 8px;
    border: 2px solid transparent;
    pointer-events: auto; /* Povolit interakci - pro scrollování */
    font-size: 0.85em;
    max-width: 600px; /* Zvětšeno pro grid layout */
    max-height: 80vh; /* Maximální výška 80% viewportu */
    overflow-y: auto; /* Scroll když je obsah příliš dlouhý */
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    cursor: default; /* Normální kurzor nad tooltipem */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Pinned tooltip - zafixovaný kliknutím */
#tooltip.pinned {
    border-color: #ffd700;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3), 0 4px 12px rgba(0,0,0,0.4);
}

#tooltip.pinned::before {
    content: 'ZAFIXOVÁNO - klikněte mimo pro zavření';
    display: block;
    background-color: #444;
    margin: -12px -12px 12px -12px;
    padding: 8px 12px;
    border-radius: 6px 6px 0 0;
    font-size: 0.85em;
    color: #ffd700;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid #555;
    letter-spacing: 0.5px;
}

/* Scrollbar styling pro tooltip */
#tooltip::-webkit-scrollbar {
    width: 8px;
}

#tooltip::-webkit-scrollbar-track {
    background: #444;
    border-radius: 4px;
}

#tooltip::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
}

#tooltip::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Grid layout pro více circuits */
.tooltip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

/* Jednotlivý circuit v gridu */
.tooltip-circuit {
    background-color: #444;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #555;
}

.tooltip-circuit-title {
    font-weight: bold;
    font-size: 1em;
    color: #ffd700;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #555;
}

.tooltip-circuit-field {
    margin: 5px 0;
    line-height: 1.4;
}

.tooltip-label {
    color: #aaa;
    font-weight: 600;
}

.tooltip-circuit-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #555;
    color: #ddd;
    font-style: italic;
    font-size: 0.9em;
}

.tooltip-circuit-note strong {
    color: #ffd700;
    font-style: normal;
}

/* Note tooltip styles (modré) */
.tooltip-note {
    background-color: #2c3e50;
    padding: 12px;
    border-radius: 6px;
    border: 2px solid #3498db;
    margin-bottom: 8px;
}

.tooltip-note-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #3498db;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #3498db;
}

.tooltip-note-content {
    color: #ecf0f1;
    line-height: 1.5;
    font-size: 0.95em;
}

/* Circuit Tech tooltip styles (zelené) */
.tooltip-circuit-tech {
    background-color: #1e3a1e;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #27ae60;
}

.tooltip-circuit-tech-title {
    font-weight: bold;
    font-size: 1em;
    color: #2ecc71;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #27ae60;
}

.tooltip-circuit-tech-field {
    margin: 5px 0;
    line-height: 1.4;
    color: #d5f4e6;
}

.tooltip-circuit-tech-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #27ae60;
    color: #d5f4e6;
    font-style: italic;
    font-size: 0.9em;
}

.tooltip-circuit-tech-note strong {
    color: #2ecc71;
    font-style: normal;
}

[data-info]:hover {
    cursor: pointer !important; /* Force override */
    opacity: 0.7;
    transition: opacity 0.2s ease;
}


/* Highlight Animation */
@keyframes blink-highlight {
    0% {
        stroke: #e51c14; /* Highlight color (red) */
        stroke-width: 4px;
    }
    49% { /* Just before mid-point */
        stroke: #e51c14;
        stroke-width: 4px;
    }
    50% { /* Mid-point of duration */
        stroke: #28253D; /* Original stroke color */
        stroke-width: 2px;
    }
    99% { /* Just before end of duration */
        stroke: #28253D;
        stroke-width: 2px;
    }
    100% {
        stroke: #e51c14; /* Highlight color (red) */
        stroke-width: 4px;
    }
}

/* Highlight style for SVG elements */
.highlight path,
.highlight rect,
.highlight circle,
.highlight polygon,
path.highlight,
rect.highlight,
circle.highlight,
polygon.highlight {
    animation: blink-highlight 1.5s ease-in-out 3 forwards; /* 1.5s duration, 3 repetitions, stays red */
}

.highlight text {
    fill: #e51c14 !important;
    font-weight: bold;
}


/* Logout Banner */
.logout-banner {
    position: absolute;
    top: 10px;
    right: 20px;
    background-color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 0.9em;
    display: flex;
    align-items: center;
}

.logout-banner span {
    margin-right: 15px;
    color: #555;
}

.logout-banner a {
    color: #0056b3;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.logout-banner a:hover {
    background-color: #e9f5ff;
}


/* Search Filters */
.search-filters {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.search-filters details {
    cursor: pointer;
}

.search-filters summary {
    font-weight: bold;
    font-size: 1.05em;
    padding: 5px 0;
    user-select: none;
    color: #0056b3;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.search-filters summary:hover {
    color: #004494;
}

/* Přesunout marker (šipku) dovnitř summary */
.search-filters summary::marker,
.search-filters summary::-webkit-details-marker {
    display: inline-block;
    margin-right: 8px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    padding: 10px 0;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-option:hover {
    background-color: #e9f5ff;
    border-color: #0056b3;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-option span {
    user-select: none;
    font-size: 0.95em;
}

.filter-option input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #0056b3;
}

/* Search Examples Section */
.search-examples {
    background-color: #e9f5ff;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #0056b3;
}

.search-examples p {
    margin: 0 0 10px 0;
    color: #004494;
}

.search-examples ul {
    margin: 5px 0;
    padding-left: 20px;
}

.search-examples li {
    margin: 8px 0;
    line-height: 1.5;
}

.search-examples ul ul {
    margin-top: 5px;
    padding-left: 25px;
}

.search-examples em {
    color: #0056b3;
    font-weight: 600;
}

/* Filter Sections */
.filter-section {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.filter-section-title {
    font-weight: bold;
    font-size: 0.95em;
    color: #0056b3;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9f5ff;
}

/* Radio buttons styling */
.filter-option input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #0056b3;
}

/* Adjust grid for new layout */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

/* Responsive design for filters */
@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .search-examples {
        font-size: 0.9em;
    }

    /* Tooltip responsive */
    #tooltip {
        max-width: 90vw;
        max-height: 60vh;
        font-size: 0.8em;
    }

    .tooltip-grid {
        grid-template-columns: 1fr; /* Jeden sloupec na mobilu */
    }
}

/* Collapsible Filters Arrow Animation */
.search-filters summary {
    list-style: none; /* Odstranění výchozího markeru, pokud budeme chtít vlastní */
    list-style-type: none;
    position: relative;
    padding-left: 20px; /* Prostor pro naši vlastní šipku */
}

.search-filters summary::-webkit-details-marker {
    display: none; /* Skryjeme výchozí šipku v Chrome/Safari */
}
.search-filters summary::marker {
    display: none; /* Skryjeme výchozí šipku v Firefoxu */
}

.search-filters summary::before {
    content: '▶'; /* Naše vlastní šipka */
    position: absolute;
    left: 0;
    top: 5px; /* Vyladit podle potřeby */
    font-size: 0.8em;
    color: #0056b3;
    transform-origin: center;
    transition: transform 0.2s ease-in-out;
}

.search-filters details[open] > summary::before {
    transform: rotate(90deg);
}

/* Collapsible Info-Container */
.info-wrapper {
    position: relative; /* Vrátím relative zpět sem */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; /* Added to ensure full width */
}

.info-wrapper.collapsed #info-container {
    max-height: 120px; /* Omezení výšky, cca 5-6 řádků */
    overflow: hidden;
    position: relative; /* Přidáno */
    width: 100%; /* Ensure full width when collapsed */
}

#info-container {
    width: 100%; /* Ensure full width in general */
}

.info-wrapper.collapsed #info-container::after { /* Pseudo-element pro fade-out přesunu sem */
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px; /* Výška fade-out efektu */
    background: linear-gradient(to bottom, transparent, #fff); /* Změna barvy pozadí na #fff */
    pointer-events: none; /* Aby neblokoval text pod ním */
    z-index: 1; /* Aby byl nad obsahem, ale pod tlačítkem */
}

#expand-info-btn {
    display: block; /* Aby margin auto fungoval */
    margin: 10px auto 0 auto; /* Centrování a horní odsazení */
    padding: 8px 15px; /* Sjednoceno s .controls button */
    border: 1px solid #ccc; /* Změna barvy borderu */
    background-color: #e9e9e9; /* Změna barvy pozadí */
    color: #333; /* Změna barvy textu na černou/tmavě šedou */
    border-radius: 4px; /* Sjednoceno s .controls button */
    cursor: pointer;
    font-size: 1em; /* Sjednoceno s .controls button */
    font-weight: 600; /* Zvýšena váha písma */
    transition: all 0.2s ease;
}

#expand-info-btn:hover {
    background-color: #d6d6d6; /* Tmavší odstín pro hover */
    color: #333;
}
