/* قالب کنترل فرمان واحد و داینامیک برای همه انواع تجهیز (بخاری/آبیاری/تغذیه/...).
   رنگ و آیکون هر نوع از طریق --accent (که از SensorType.BgColor/Icon همان EquipmentType می‌آید) تزریق می‌شود؛
   هیچ نامی از نوع خاصی در این کلاس‌ها هاردکد نشده است. */

.eq-panel {
    --accent: #10b981;
    background: var(--bs-body-bg, #fff);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.eq-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent) 18%, transparent),
        color-mix(in srgb, var(--accent) 4%, transparent));
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.eq-panel-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--accent);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.eq-panel-titles {
    flex: 1;
    min-width: 0;
}

.eq-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.15rem;
}

.eq-panel-titles h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.eq-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    opacity: 0.75;
}

.eq-meta i {
    margin-inline-end: 0.25rem;
}

.eq-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: color-mix(in srgb, #16a34a 14%, transparent);
    color: #15803d;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.eq-live-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    animation: eq-pulse 1.6s infinite;
}

@keyframes eq-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.eq-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.15rem 1.25rem;
}

.eq-section-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.eq-section-head h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.eq-section-head i {
    color: var(--accent);
}

.eq-section-hint,
.eq-empty {
    margin: 0;
    padding: 1rem;
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--bs-secondary-bg, #f8fafc) 90%, transparent);
    color: var(--bs-secondary-color, #64748b);
    font-size: 0.9rem;
    text-align: center;
}

.eq-empty {
    margin: 1rem;
    display: grid;
    gap: 0.5rem;
    place-items: center;
}

.eq-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.75rem;
}

.eq-kpi {
    border: 1px solid color-mix(in srgb, var(--pc, var(--accent)) 25%, transparent);
    border-radius: 0.85rem;
    padding: 0.85rem;
    background: color-mix(in srgb, var(--pc, var(--accent)) 6%, transparent);
}

.eq-kpi-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    margin-bottom: 0.55rem;
}

.eq-kpi-top i {
    color: var(--pc, var(--accent));
}

.eq-kpi-name {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-kpi-top small {
    opacity: 0.55;
}

.eq-kpi-value {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.eq-kpi-value strong {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.eq-kpi-value span,
.eq-kpi-topic {
    font-size: 0.75rem;
    opacity: 0.65;
}

.eq-kpi-nodata {
    font-size: 0.85rem;
    opacity: 0.6;
}

.eq-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.eq-control-card {
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    background: var(--bs-body-bg, #fff);
}

.eq-control-card.is-sending {
    opacity: 0.75;
}

.eq-control-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.eq-control-title {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.eq-control-title i {
    margin-top: 0.15rem;
    color: var(--accent);
}

.eq-control-title strong {
    display: block;
    font-size: 0.95rem;
}

.eq-control-title span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.65;
}

.eq-control-current {
    text-align: end;
    font-size: 0.8rem;
}

.eq-control-current span {
    display: block;
    opacity: 0.6;
}

.eq-toggle-row,
.eq-numeric-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.eq-switch {
    position: relative;
    display: inline-block;
    width: 3.1rem;
    height: 1.7rem;
}

.eq-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.eq-switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #cbd5e1;
    border-radius: 999px;
    transition: 0.2s;
}

.eq-switch-slider::before {
    content: "";
    position: absolute;
    height: 1.3rem;
    width: 1.3rem;
    left: 0.2rem;
    top: 0.2rem;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.eq-switch input:checked + .eq-switch-slider {
    background: var(--accent);
}

.eq-switch input:checked + .eq-switch-slider::before {
    transform: translateX(1.4rem);
}

[dir="rtl"] .eq-switch input:checked + .eq-switch-slider::before {
    transform: translateX(-1.4rem);
}

.eq-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 0.65rem;
    overflow: hidden;
}

.eq-stepper button {
    border: 0;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: inherit;
    width: 2.25rem;
    cursor: pointer;
}

.eq-stepper input {
    width: 4.5rem;
    border: 0;
    border-inline: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    text-align: center;
    background: transparent;
    color: inherit;
}

.eq-range {
    flex: 1;
    min-width: 8rem;
    accent-color: var(--accent);
}

.eq-send {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 0.65rem;
    padding: 0.55rem 0.9rem;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-inline-start: auto;
}

.eq-send:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ───── نوار تب‌های داینامیک انواع تجهیز ───── */
.eq-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.eq-type-tab {
    --accent: #10b981;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    color: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
}

.eq-type-tab i {
    color: var(--accent);
}

.eq-type-tab .eq-type-tab-count {
    display: inline-grid;
    place-items: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 20%, transparent);
    font-size: 0.72rem;
}

.eq-type-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.eq-type-tab.active i,
.eq-type-tab.active .eq-type-tab-count {
    color: #fff;
}

@media (max-width: 767.98px) {
    .eq-panel-header {
        flex-wrap: wrap;
    }

    .eq-send {
        width: 100%;
        justify-content: center;
        margin-inline-start: 0;
    }

    .eq-numeric-row,
    .eq-toggle-row {
        width: 100%;
    }

    .eq-range {
        width: 100%;
    }
}
