html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
    background-color: #f8f9fa;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.min-w-0 {
    min-width: 0;
}

/* ------------------------------------------------ */
/* SENSOR CARDS */
/* ------------------------------------------------ */

.sensor-card {
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 16px 16px 12px 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
    min-height: 265px;
    display: flex;
    flex-direction: column;
}

    .sensor-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    }

    .sensor-card.ok {
        border-left: 6px solid #198754;
        background-color: rgba(25, 135, 84, 0.06);
    }

    .sensor-card.warn {
        border-left: 6px solid #ffc107;
        background-color: rgba(255, 193, 7, 0.10);
    }

    .sensor-card.crit {
        border-left: 6px solid #dc3545;
        background-color: rgba(220, 53, 69, 0.08);
    }

    .sensor-card.offline {
        border-left: 6px solid #6c757d;
        background-color: rgba(108, 117, 125, 0.08);
    }

    .sensor-card.no-data {
        border-left: 6px solid #343a40;
        background-color: rgba(33, 37, 41, 0.05);
    }

.sensor-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: #212529;
    line-height: 1.2;
}

.sensor-subtitle {
    color: #6c757d;
    font-size: 0.84rem;
    margin-bottom: 1px;
    line-height: 1.15;
}

.sensor-meta-label {
    font-size: 0.72rem;
    color: #6c757d;
    margin-bottom: 1px;
    font-weight: 600;
    line-height: 1.1;
}

.sensor-meta-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.15;
}

.sensor-value {
    margin-top: 3px;
    font-size: 2.35rem;
    font-weight: 900;
    line-height: 1;
    color: #212529;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.badge.sensor-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1px;
    border-radius: 10px;
}

/* ------------------------------------------------ */
/* SENSOR CARD ALERT ANIMATIONS */
/* ------------------------------------------------ */

@keyframes pulseDanger {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.35);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

@keyframes pulseGray {
    0% {
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0.35);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(108, 117, 125, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0);
    }
}

.sensor-card.crit {
    animation: pulseDanger 1.8s infinite;
}

.sensor-card.offline {
    animation: pulseGray 2.2s infinite;
}

/* ------------------------------------------------ */
/* SUMMARY FILTER MINI CARDS */
/* ------------------------------------------------ */

.summary-filter-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
    border-radius: 14px;
    border: 2px solid transparent !important;
    background: #fff;
    user-select: none;
}

    .summary-filter-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }

    .summary-filter-card.active {
        transform: translateY(-1px);
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
        border-width: 2px !important;
    }

    .summary-filter-card .card-body {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .summary-filter-card .text-muted.small {
        font-size: 0.78rem !important;
        font-weight: 600;
        letter-spacing: 0.2px;
    }

    .summary-filter-card .fs-4,
    .summary-filter-card .fs-3 {
        line-height: 1.1;
    }

.summary-total {
    border-color: #0d6efd !important;
}

.summary-ok {
    border-color: #198754 !important;
}

.summary-warn {
    border-color: #ffc107 !important;
}

.summary-crit {
    border-color: #dc3545 !important;
}

.summary-offline {
    border-color: #6c757d !important;
}

.summary-nodata {
    border-color: #212529 !important;
}

.summary-total.active {
    background-color: rgba(13, 110, 253, 0.06);
}

.summary-ok.active {
    background-color: rgba(25, 135, 84, 0.06);
}

.summary-warn.active {
    background-color: rgba(255, 193, 7, 0.10);
}

.summary-crit.active {
    background-color: rgba(220, 53, 69, 0.06);
}

.summary-offline.active {
    background-color: rgba(108, 117, 125, 0.08);
}

.summary-nodata.active {
    background-color: rgba(33, 37, 41, 0.06);
}

.summary-total .text-muted.small {
    color: #0d6efd !important;
}

.summary-ok .text-muted.small {
    color: #198754 !important;
}

.summary-warn .text-muted.small {
    color: #b58100 !important;
}

.summary-crit .text-muted.small {
    color: #dc3545 !important;
}

.summary-offline .text-muted.small {
    color: #6c757d !important;
}

.summary-nodata .text-muted.small {
    color: #212529 !important;
}

.summary-total .summary-value {
    color: #0d6efd !important;
}

.summary-ok .summary-value {
    color: #198754 !important;
}

.summary-warn .summary-value {
    color: #b58100 !important;
}

.summary-crit .summary-value {
    color: #dc3545 !important;
}

.summary-offline .summary-value {
    color: #6c757d !important;
}

.summary-nodata .summary-value {
    color: #212529 !important;
}

.summary-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
}

.summary-filter-card:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(37, 140, 251, 0.25);
}

/* ------------------------------------------------ */
/* DASHBOARD HELPERS */
/* ------------------------------------------------ */

#summary-cards .card,
#sensor-grid .card {
    overflow: hidden;
}

#no-results-message,
#no-sensors-message .alert {
    border-radius: 14px;
}

#searchInput {
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

    #searchInput:focus {
        border-color: #86b7fe;
    }

#filtersPanel.filters-hidden {
    display: none;
}

.sensor-subtitle i,
.sensor-meta-label i,
.text-muted i,
.btn i {
    vertical-align: -1px;
}

@media (max-width: 768px) {
    #toggleFiltersBtn {
        width: 100%;
    }
}

/* ------------------------------------------------ */
/* CARD HOME INDEX */
/* ------------------------------------------------ */

.dashboard-menu-card {
    border-radius: 18px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .dashboard-menu-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    }

.menu-card-icon {
    font-size: 2rem;
    line-height: 1;
}

/* ------------------------------------------------ */
/* SENSOR TREND */
/* ------------------------------------------------ */

.sensor-trend-wrap {
    position: relative;
    width: 100%;
    height: 96px;
    margin-top: 0.55rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.sensor-trend-chart {
    width: 100% !important;
    height: 96px !important;
    display: block;
}

/* ------------------------------------------------ */
/* SENSOR VALUE + TREND */
/* ------------------------------------------------ */

.sensor-value-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.sensor-trend-indicator {
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    margin-top: 2px;
}

    .sensor-trend-indicator.up {
        color: #198754;
    }

    .sensor-trend-indicator.down {
        color: #dc3545;
    }

    .sensor-trend-indicator.flat {
        color: #6c757d;
    }

/* ------------------------------------------------ */
/* MOBILE / COMPACT SENSOR DASHBOARD */
/* ------------------------------------------------ */

#sensor-grid .sensor-col {
    margin-bottom: 0;
}

#sensor-grid .btn.btn-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.82rem;
}

@media (max-width: 576px) {
    .sensor-card {
        padding: 12px 12px 10px 12px;
        border-radius: 14px;
        min-height: 248px;
    }

    .sensor-title {
        font-size: 0.98rem;
    }

    .sensor-subtitle {
        font-size: 0.8rem;
    }

    .sensor-meta-label {
        font-size: 0.7rem;
    }

    .sensor-meta-value {
        font-size: 0.84rem;
    }

    .sensor-value {
        font-size: 2.1rem;
    }

    .badge.sensor-status-badge {
        font-size: 0.68rem;
        padding: 0.34rem 0.52rem !important;
    }

    .sensor-trend-wrap {
        height: 80px;
    }

    .sensor-trend-chart {
        height: 80px !important;
    }

    .sensor-trend-indicator {
        font-size: 0.95rem;
        margin-top: 1px;
    }

    #sensor-grid .btn.btn-sm {
        padding: 0.22rem 0.5rem;
        font-size: 0.78rem;
    }
}
