:root {
    --primary: #bf1922;
    /* Cherry Red */
    --accent: #374151;
    /* Dark Gray */
    --background: #ffffff;
    /* White */
    --block: #f8fafc;
    /* Light gray */
    --text: #374151;
    /* Dark gray */
    --hover: #d95f6b6e;
    /* Vibrant red-pink for hover  #e35d6a;*/

    /* 1. Презаписваме служебните променливи на Bootstrap 5 */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 191, 25, 34;
    /* RGB стойността на #bf1922 */
    --bs-body-bg: var(--background);
    --bs-body-color: var(--text);
}

/* 2. Изрично стилизиране на Bootstrap бутони и текстове с вашите цветове */
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.btn-primary:hover, 
.btn-primary:focus, 
.btn-primary:active {
    background-color: var(--hover) !important;
    border-color: var(--hover) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #ffffff !important;
}

.bg-light {
    background-color: var(--block) !important;
}


html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, sans-serif;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.fixed-top {
    background-color: var(--background); /* Или цвета, който искаш да има отзад */
    z-index: 1030; /* Гарантира, че ще е винаги над всички карточки и бутони */
}

.main-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    max-width: 100vw;
}

.navbar-custom {
    background: var(--primary);
    color: #fff;
    height: 64px;
    min-height: 64px;
    display: flex;
    align-items: center;
}

.navbar-custom .navbar-brand,
.navbar-custom .nav-link {
    color: #fff !important;
}

a,
.link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover,
a:focus,
.link:hover,
.link:focus {
    color: var(--hover) !important;
    text-decoration: underline;
}

.on-dark a,
.on-dark .link {
    color: #fff !important;
}

.on-dark a:hover,
.on-dark .link:hover,
.on-dark a:focus,
.on-dark .link:focus {
    color: #e5e7eb !important;
    /* Very light gray on hover */
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus {
    color: #d1d5db !important;
    text-decoration: none;
}

/* White toggler icon */
.navbar-toggler {
    border: 2px solid transparent !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none !important;
}

.navbar-toggler[aria-expanded="true"],
.navbar-toggler:focus {
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.5) !important;
    /* Optional: white glow */
    outline: none !important;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,1)' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Custom Navbar Dropdown Styles */
.navbar-custom .dropdown-menu {
    background: var(--block);
    border: 1.5px solid var(--accent);
    box-shadow: 0 8px 24px 0 rgba(55, 65, 81, 0.07);
    border-radius: 0.5rem;
    padding: 0.3rem 0;
    min-width: 180px;
}

.navbar-custom .dropdown-item {
    color: var(--primary);
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: background 0.18s, color 0.18s;
    border-radius: 0.4rem;
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus,
.navbar-custom .dropdown-item.active {
    background: var(--accent);
    color: #fff !important;
    text-decoration: none;
}

.navbar-custom .dropdown-divider {
    border-color: var(--accent);
}

@media (max-width: 991.98px) {
    .navbar-custom .dropdown-menu {
        min-width: 150px;
        font-size: 1rem;
    }
}

.main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    min-height: 0;
    margin-top: 110px
}

.block {
    background: var(--block);
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
    padding: 2rem;
    flex: 0 0 auto;
    /* Only as tall as content by default */
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    width: 100%;
    color: var(--primary);
}

.main-content>.block:first-child {
    flex: 1 1 auto;
    /* Fills remaining space, or more if needed for content */
    min-height: 0;
}

.block-accent {
    background: var(--accent);
    color: #fff;
    /* White text on mint green background */
}

.footer-custom {
    background: var(--accent);
    color: #fff;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    width: 100%;
}

/* Custom input and button styles */
.custom-input {
    border: 2px solid var(--accent);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    outline: none;
    color: var(--primary);
    background: #fff;
    font-weight: 500;
    width: 200px;
    max-width: 100%;
    margin-right: 0.5rem;
    transition: border-color 0.2s;
}

.custom-input:focus {
    border-color: var(--primary);
}

.custom-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.custom-btn:hover,
.custom-btn:focus {
    background: var(--hover);
    color: #fff;
}

/* Responsive tweaks */
@media (max-width: 991.98px) {

    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .navbar-custom,
    .footer-custom {
        height: auto;
        min-height: 48px;
        padding: 1rem 0.5rem;
    }

    .block {
        padding: 1rem;
        flex: 1 1 auto;
    }

    .container-fluid,
    .row,
    .col-12 {
        margin: 0;
        padding: 0;
        /*width: 100vw !important;
        max-width: 100vw !important;*/
        box-sizing: border-box;
    }

    .footer-custom {
        font-size: 1rem;
    }
}





.status-bar {
    width: 100%;
    min-height: 38px;
    height: auto;
    /* allow growth for long text */
    display: flex;
    align-items: center;
    justify-content: center;
    /* centers icon + message as group */
    gap: 0.75em;
    flex-wrap: wrap;
    /* allows message to wrap on small screens */
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--block);
    color: var(--primary);
    border-bottom: 1.5px solid var(--accent);
    box-shadow: 0 1px 8px #bf19220a;
    user-select: none;
    overflow: hidden;
    padding: 0.5em 0.75em;
    margin: 0;
    z-index: 0;
    /*was 1010*/
}

/*.status-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    font-size: 1.35em;
    margin-right: 0.5em;
}*/

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.status-bar.flash {
    animation: blink 0.5s ease-in-out 1;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.status-bar.shake {
    animation: shake 0.6s;
}

@keyframes pulse {
    0% {
        background-color: #fef08a;
    }

    /* жълтеникаво */
    50% {
        background-color: #facc15;
    }

    100% {
        background-color: #fef08a;
    }
}

.status-bar.pulse {
    animation: pulse 0.5s ease-in-out 2;
}

.status-message {
    flex: 1 1 0;
    min-width: 0;
    word-break: break-word;
    text-align: center;
}

.status-response-message {
    font-size: 2rem;
    flex: 1 1 0;
    min-width: 0;
    word-break: break-word;
    text-align: center;
}

/* Keep your colored variants for success/danger/info/warning */
.status-success {
    background: #e6faef;
    color: #228c47;
    border-bottom: 2px solid #4ade80;
}

.status-danger {
    background: #fde7e9;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.status-info {
    background: var(--block);
    color: var(--primary);
    border-bottom: 1.5px solid var(--accent);
}

.status-warning {
    background: #fff9e1;
    color: #b57c12;
    border-bottom: 2px solid #fbbf24;
}

.status-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    margin-right: 0.5em;
    border: 2px solid currentColor;
    border-radius: 50%;
    padding: 0;
    /* No extra white ring */
    min-width: 22px;
    min-height: 22px;
    box-sizing: border-box;
    color: inherit;
    background: transparent;
    /* No background */
}

.status-response-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    margin-right: 0.5em;
    padding: 0;
    /* No extra white ring */
    min-width: 22px;
    min-height: 22px;
    box-sizing: border-box;
    color: inherit;
    background: transparent;
    /* No background */
}

.status-success .status-icon {
    border-color: #4ade80;
    color: #228c47;
}

.status-danger .status-icon {
    border-color: #bf1922;
    color: #bf1922;
}

.status-info .status-icon {
    border-color: #374151;
    color: #374151;
}

.status-warning .status-icon {
    border-color: #fbbf24;
    color: #b57c12;
}

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(34, 41, 47, 0.75);
    /* semi-transparent dark overlay */
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    /* Hidden by default */
}

.spinner-overlay .spinner-border {
    width: 3.5rem;
    height: 3.5rem;
    border-width: 0.35em;
    color: var(--primary);
    /* Make spinner blue */
    background: transparent;
}

.bodyOverlay {
    pointer-events: none;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    transition: opacity 350ms;
    opacity: 0.5;
    z-index: 9999;
}

.carousel-indicators {
    bottom: 10px;
    justify-content: center !important;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
}

.carousel-indicators li,
.carousel-indicators [data-bs-target] {
    background-color: var(--primary);
    /* your palette */
    border-radius: 50%;
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.carousel-indicators .active {
    opacity: 1;
}

.carousel-inner,
.carousel-item,
.carousel-item img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    /* images never taller than 75% of viewport height */
    object-fit: contain;
    /* show full image */
}

/* Ensure the dropdown has the same width as the button */
.countrySelect {
    max-height: 200px !important;
    /* Adjust based on the height of your items */
    overflow-y: auto;
    /* Allow vertical scrolling */
    width: 100%;
    /* Ensure the dropdown is as wide as the button */
}

.hr-text {
    display: flex;
    align-items: center;
    width: 100%;
    border: 0;
    background: none;
    font-size: 14px;
    font-weight: bold;
    color: var(--primary);
    margin: 0.5em 0;
}

.hr-text::before,
.hr-text::after {
    content: "";
    flex: 1 1 0;
    height: 1.5px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
}

.hr-text[data-content] {
    padding: 0 1em;
    background: none;
    position: relative;
}

.hr-text[data-content]::before {
    margin-right: 1em;
}

.hr-text[data-content]::after {
    margin-left: 1em;
    /* If you want more/less space, tweak these margins */
}

.hr-text[data-content]:not(:empty)::after,
.hr-text[data-content]:not(:empty)::before {
    display: block;
}

/* Custom Checkbox */
.form-check-input.custom-check {
    border: 2px solid var(--primary);
    background-color: var(--block);
    width: 1.15em;
    height: 1.15em;
    border-radius: 0.35em;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: none;
}

/* Checked state */
.form-check-input.custom-check:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem #bf192230;
}

/* Checkbox tick color */
.form-check-input.custom-check:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4 8l3 3 5-5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
}

/* Focus/active states */
.form-check-input.custom-check:focus {
    border-color: var(--hover);
    outline: none;
    box-shadow: 0 0 0 0.18rem #e35d6a33;
}

@media (max-width: 575.98px) {
    .block {
        padding: 0.5rem !important;
    }

    .widget-btn {
        padding: 0.75rem !important;
        font-size: 1rem;
    }
}

.widget-btn {
    background: var(--block);
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(55, 65, 81, 0.1);
    color: var(--text);
    border: 1.5px solid var(--block);
    padding: 1.25rem;
    text-align: left;
    width: 100%;
    min-width: 0;
    transition: box-shadow 0.2s, background 0.2s;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Fill column height */
}

.widget-btn:hover {
    background: var(--hover);
    color: #fff;
}

.widget-btn .widget-icon {
    font-size: 2rem;
    color: var(--primary);
}

.widget-btn .widget-icon-warning {
    color: darkkhaki;
    font-size: 2rem;
}

.widget-btn .widget-title {
    font-weight: bold;
    font-size: 2rem;
    cursor: pointer;
    word-break: break-word;
    /* long unbreakable words will wrap */
    white-space: normal;
    /* allow wrapping */
    min-width: 0;
    /* allows flex child to shrink/wrap */
    flex-shrink: 1;
    /* allows this to shrink */
}

.widget-title {
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}

.widget-btn .widget-state {
    margin-left: .5rem;
    font-size: 1.5rem;
    font-weight: 500;
}

.widget-btn .widget-temp {
    font-size: 1.5rem;
    font-weight: bold;
    margin: .5rem 0;
}

.widget-btn .temp-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-btn .temp-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.widget-btn .temp-btn:hover {
    background: var(--accent);
}

.section-header-icon {
    display: inline-flex;
    /* Променено на inline-flex, за да заема само колкото му трябва */
    align-items: center;
    /* Центрира иконата и текста по вертикала */
    justify-content: flex-start;
    /* Подравнява ги вляво */
    gap: 0.75em;
    /* Задава чисто разстояние между иконата и текста */
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0;
    /* Препоръчително е да се контролира от Bootstrap (напр. mb-4) */
    letter-spacing: 0.01em;
}

.section-header-icon i {
    display: flex;
    /* Правим самата иконка flex контейнер */
    align-items: center;
    /* Центрира символа вертикално вътре в кръга */
    justify-content: center;
    /* Центрира символа хоризонтално вътре в кръга */
    width: 2.2rem;
    /* Фиксирана ширина */
    height: 2.2rem;
    /* Фиксирана височина, равна на ширината = перфектен кръг */
    font-size: 1.4rem;
    /* Размер на самия символ вътре */
    color: var(--accent);
    background: var(--block);
    border-radius: 50%;
    box-shadow: 0 2px 10px #37415122;
    /* margin-right и padding са премахнати, защото gap и width/height вършат работата идеално */
}

.custom-switch-container {
    display: flex;
    align-items: center;
    gap: 0.75em;
}

.custom-switch-input {
    display: none;
}

.custom-switch-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 0.55em;
}

.custom-switch-slider {
    font-size: 20px;
    background: var(--block);
    border: 2px solid var(--accent);
    border-radius: 1em;
    position: relative;
    transition: background 0.25s, border-color 0.2s;
    box-shadow: 0 2px 8px rgba(55, 65, 81, 0.08);
}

.custom-switch-slider::after {
    content: "";
    position: absolute;
    left: 0.15em;
    top: 0.13em;
    width: 1.08em;
    height: 1.08em;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 1px 4px #bf192230;
    transition: left 0.22s, background 0.22s;
}

/* Checked State */
.custom-switch-input:checked+.custom-switch-label .custom-switch-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-switch-input:checked+.custom-switch-label .custom-switch-slider::after {
    left: 1.2em;
    background: var(--block);
    box-shadow: 0 1px 4px #37415130;
}

.custom-switch-text {
    font-weight: 600;
    font-size: 1.05em;
    color: var(--primary);
    letter-spacing: 0.02em;
    padding-left: 0.2em;
    user-select: none;
}

/* Optional: "On"/"Off" coloring */
.custom-switch-input:checked+.custom-switch-label .custom-switch-text {
    color: var(--block);
}

.custom-switch-slider {
    width: 2.5em;
    height: 1.4em;
    background: var(--block);
    border: 2px solid var(--accent);
    border-radius: 1em;
    position: relative;
    transition: background 0.25s, border-color 0.2s;
    box-shadow: 0 2px 8px rgba(55, 65, 81, 0.08);
    display: flex;
    align-items: center;
}

.custom-switch-slider::after {
    content: "";
    position: absolute;
    left: 0.14em;
    top: 50%;
    transform: translateY(-50%);
    width: 1.08em;
    height: 1.08em;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 1px 4px #bf192230;
    transition: left 0.22s, background 0.22s;
}

/* Checked State */
.custom-switch-input:checked+.custom-switch-label .custom-switch-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.custom-switch-input:checked+.custom-switch-label .custom-switch-slider::after {
    left: 1.22em;
    background: var(--block);
    box-shadow: 0 1px 4px #37415130;
}

.temp-controls {
    display: flex;
    align-items: center;
    gap: 0.7em;
    margin-top: 1em;
    justify-content: center;
}

.temp-btn {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--accent);
    /* thin black/dark gray border */
    border-radius: 50%;
    width: 2.4em;
    height: 2.4em;
    font-size: 1.5em;
    font-weight: 500;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.16s, color 0.16s, border-color 0.16s;
    box-shadow: 0 1px 4px rgba(55, 65, 81, 0.07);
    cursor: pointer;
    outline: none;

    line-height: 1 !important;
    font-size: 1.5em;
    font-weight: 500;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    vertical-align: middle;
}

.temp-btn:hover,
.temp-btn:focus {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.wrapBreak {
    white-space: normal;
    word-break: break-word;
    vertical-align: middle !important;
}

.temp-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    font-size: 1em;
    line-height: 1;
    /* The magic fix: */
    transform: translateY(-3%);
}