/* 
 * FermQnit Theme
 * HlavnÃ­ CSS promÄnnÃ© a komponentovÃ© tÅÃ­dy
 */

:root {
    --color-primary: #1d1f23;
    --color-primary-light: #2d2f33;
    --color-accent: #f6a623;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    --color-surface: #ffffff;
    --color-surface-alt: #f8f9fa;
    --color-text: #1d1f23;
    --color-text-light: #6c757d;
    --color-text-on-dark: #efefef;
    --color-sidebar-bg: linear-gradient(black, rgb(44,44,44) 0%, rgb(74,73,73));
    --color-sidebar-bg-fallback: rgb(135,136,139);
    --radius: 12px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --font-primary: 'Nunito', sans-serif;
    --transition: 0.25s ease;
}

/* === ZÃ¡kladnÃ­ reset === */
body {
    font-family: var(--font-primary);
    color: var(--color-text);
    background: #eaeaea;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    transition: var(--transition);
}
a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

/* === Sidebar === */
.sidebar-nav {
    min-width: 0;
    padding-right: 0;
    padding-left: 0;
}

/* Zachovat původní vzhled položek menu v sidebaru */
.sidebar-nav .list-group-item {
    border: none !important;
    background-color: rgba(255,255,255,0) !important;
    max-width: none !important;
    color: rgb(27,35,101) !important;
}
.sidebar-nav .list-group-item i,
.sidebar-nav .list-group-item span {
    color: #efefef !important;
    font-size: 15px !important;
}
.sidebar-nav .list-group-item i {
    margin: 10px !important;
}
.sidebar-nav .list-group-item:hover {
    background-color: rgba(255,255,255,0.05) !important;
}

@media (max-width: 767.98px) {
    /* Sidebar se na mobilu nepoužívá – navigaci zajišťuje spodní lišta (bottom-nav) */
    .sidebar-nav {
        display: none !important;
    }
    /* hamburger je na mobilu zbytečný – navigaci zajišťuje spodní lišta (bottom-nav) */
    .navbar-toggler {
        display: none !important;
    }
    /* zabránit drobnému horizontálnímu přejezdu (záporné margins .row) */
    body {
        overflow-x: hidden;
    }
}

/* === Karty zaÅÃ­zenÃ­ (dashboard) === */
.card-device {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    overflow: visible;
}
.card-device .dropdown-menu {
    right: 0;
    left: auto;
}
.card-device:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.card-device .card-body {
    padding: 1.25rem;
}
.card-device.border-left-success {
    border-left: 4px solid var(--color-success) !important;
}
.card-device.border-left-danger {
    border-left: 4px solid var(--color-danger) !important;
}
.card-device.border-left-warning {
    border-left: 4px solid var(--color-warning) !important;
}
/* === Bottom Navigation (mobile) === */
@media (max-width: 767.98px) {
    body { padding-bottom: 60px; }
}
.bottom-nav {
    z-index: 1030;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
}
.bottom-nav a {
    opacity: 0.7;
    transition: var(--transition);
}
.bottom-nav a:hover, .bottom-nav a.active {
    opacity: 1;
    color: var(--color-accent) !important;
}

/* === Tlačítka === */
.btn-dark-theme {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 14px;
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
}
.btn-dark-theme:hover,
.btn-dark-theme:focus {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(29,31,35,0.25);
}
.btn-dark-theme:active {
    background-color: #000 !important;
}

.btn-group-resolution .btn {
    margin: 5px;
    background-color: var(--color-primary);
    border-color: rgba(255,255,255,0);
    color: #fff;
    border-radius: var(--radius-sm);
}
.btn-group-resolution .btn:hover {
    background-color: var(--color-primary-light);
}

/* === Dropdown === */
.dropdown-menu-custom {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
}
.dropdown-menu-custom .dropdown-item {
    padding: 0.5rem 1.25rem;
    font-size: 14px;
    transition: var(--transition);
}
.dropdown-menu-custom .dropdown-item:hover {
    background-color: var(--color-surface-alt);
    color: var(--color-primary);
}

/* === Navigační lišta nahoře === */
.navbar-top {
    background: var(--color-surface);
    box-shadow: var(--shadow);
    border-radius: 0;
    padding: 0.5rem 1rem;
}

/* === Footer === */
footer.sticky-footer {
    padding: 1rem 0;
    background: var(--color-surface);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
}

/* === Hodnoty v kartách === */
.value-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}
.value-row .value-label {
    color: var(--color-text-light);
}
.value-row .value-number {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

/* === Online/Offline badge === */
.online-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
}
.online-badge.online {
    color: var(--color-success);
    background: rgba(40,167,69,0.1);
}
.online-badge.offline {
    color: var(--color-danger);
    background: rgba(220,53,69,0.1);
}

/* === Graf === */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}
@media (max-width: 575.98px) {
    .chart-container {
        min-height: 220px;
    }
}

/* === Graf: layout graf + legenda po straně === */
.chart-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    height: 420px;
    width: 100%;
}
.chart-layout .chart-area {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    position: relative;
}

/* === Selektory senzorů (legenda grafu) === */
.sensor-selector {
    flex: 0 0 190px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px;
    background: var(--color-surface-alt, #f8f9fa);
    border: 1px solid #e8e8e8;
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.08));
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}
.sensor-selector::before {
    content: "Sensors";
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #555;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-accent, #f6a623);
    margin-bottom: 4px;
    flex-shrink: 0;
}
.sensor-selector .sensor-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #333;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    opacity: 0.4;
}
.sensor-selector .sensor-check.active {
    opacity: 1;
    background: #fff;
    border-color: #e8e8e8;
    border-left: 4px solid var(--sensor-color, #888);
    box-shadow: 0 2px 6px rgba(0,0,0,0.10);
    color: var(--color-text, #1d1f23);
}
.sensor-selector .sensor-check:hover {
    background: #fff;
    border-color: #ddd;
    transform: translateX(3px);
}
.sensor-selector .sensor-check.active:hover {
    border-left-color: var(--sensor-color, #888);
    box-shadow: 0 3px 9px rgba(0,0,0,0.14);
}
.sensor-selector .sensor-check input[type="checkbox"] {
    display: none;
}
.sensor-selector .sensor-color-dot {
    width: 20px;
    height: 5px;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--sensor-color, #888);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
/* neaktivni - prazdny swatch */
.sensor-check:not(.active) .sensor-color-dot {
    background: transparent !important;
    border: 2px solid #bbb;
    box-shadow: none;
}
.sensor-selector .sensor-check span.sensor-label {
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* mobil - vše pod sebou */
@media (max-width: 767.98px) {
    .chart-layout {
        flex-direction: column;
        height: auto;
    }
    .chart-layout .chart-area {
        height: 260px;
    }
    .sensor-selector {
        flex: none;
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 12px;
    }
    .sensor-selector::before {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #eee;
    }
    .sensor-selector .sensor-check {
        width: auto;
        flex: 0 1 auto;
        padding: 6px 10px;
    }
    .sensor-selector .sensor-check.active {
        border-left-width: 3px;
    }
}

/* === Inputy === */
input[contenteditable] {
    border: solid 1px var(--color-accent);
    padding: 5px;
    border-radius: var(--radius-sm);
}

/* === Headline s tužkou === */
.headline-editable {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}
.headline-editable .fa-pencil {
    padding: 10px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    cursor: pointer;
    transition: var(--transition);
}
.headline-editable .fa-pencil:hover {
    color: var(--color-accent);
}

/* === Butony pro step v detailu === */
.btn-step {
    background-color: var(--color-primary);
    border: none;
    color: #fff;
    border-radius: var(--radius-sm);
    min-width: 40px;
    transition: var(--transition);
}
.btn-step:hover {
    background-color: var(--color-primary-light);
}

/* === Scroll-to-top === */
.scroll-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: none;
    background: var(--color-primary);
    color: #fff;
    text-align: center;
    line-height: 2.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1000;
}
.scroll-to-top:hover {
    background: var(--color-accent);
    color: #fff;
}

/* === Responsive utilities === */
@media (max-width: 575.98px) {
    .hide-xs { display: none !important; }
}
@media (min-width: 576px) {
    .show-xs-only { display: none !important; }
}

/* === MQTT log === */
#mqtt_log_textarea {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--color-primary);
    color: #0f0;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px;
    resize: none;
}

/* === Tabulka receptů === */
.table-recipes tbody tr {
    cursor: pointer;
    transition: var(--transition);
}
.table-recipes tbody tr:hover {
    background-color: rgba(246,166,35,0.08);
}
.table-recipes tbody tr.selected {
    background-color: rgba(40,167,69,0.15);
}

/* === Settings === */
.settings-section {
    padding: 1.5rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.settings-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* === Auto-refresh indicator === */
.refresh-indicator {
    font-size: 0.75rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.refresh-indicator .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
