/**
 * Room Heating Module - Frontend Styles
 */

/* Container */
.hhrh-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.hhrh-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.hhrh-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.hhrh-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.hhrh-title .material-symbols-outlined {
    font-size: 24px;
    color: #f97316;
}

.hhrh-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hhrh-header-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.hhrh-header-btn:hover {
    background: #e5e7eb;
}

.hhrh-header-btn .material-symbols-outlined {
    font-size: 20px;
    color: #6b7280;
}

.hhrh-connection-status {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    background: #dcfce7;
    color: #16a34a;
}

.hhrh-connection-status.error {
    background: #fee2e2;
    color: #dc2626;
}

.hhrh-connection-status .material-symbols-outlined {
    font-size: 18px;
}

.hhrh-connection-status.hhrh-syncing .material-symbols-outlined {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* Last Update Indicator */
.hhrh-last-update {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
}

.hhrh-last-update .material-symbols-outlined {
    font-size: 16px;
}

/* Controls */
.hhrh-controls {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.hhrh-controls-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hhrh-controls-section label {
    font-weight: 500;
    color: #4b5563;
}

.hhrh-view-toggle,
.hhrh-filter-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.hhrh-view-toggle:hover,
.hhrh-filter-btn:hover {
    background: #f3f4f6;
}

.hhrh-view-toggle.active,
.hhrh-filter-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.hhrh-view-toggle .material-symbols-outlined,
.hhrh-filter-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Loading */
.hhrh-loading {
    text-align: center;
    padding: 60px 20px;
}

.hhrh-spinner {
    font-size: 48px !important;
    color: #f97316;
    animation: hhrh-spin 1s linear infinite;
}

@keyframes hhrh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error */
.hhrh-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc2626;
}

.hhrh-error .material-symbols-outlined {
    font-size: 48px;
    color: #dc2626;
}

/* Messages */
.hhrh-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.hhrh-message .material-symbols-outlined {
    font-size: 32px;
}

.hhrh-message h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.hhrh-message p {
    margin: 0 0 15px 0;
}

.hhrh-message-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
}

.hhrh-message-warning .material-symbols-outlined {
    color: #f59e0b;
}

.hhrh-message-error {
    background: #fee2e2;
    border: 1px solid #f87171;
    color: #991b1b;
}

.hhrh-message-error .material-symbols-outlined {
    color: #dc2626;
}

/* Rooms Grid */
.hhrh-rooms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Room Cards */
.hhrh-room-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hhrh-room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hhrh-room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.hhrh-room-number {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.hhrh-room-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.hhrh-room-status .material-symbols-outlined {
    font-size: 16px;
}

.hhrh-status-heating {
    background: #fed7aa;
    color: #9a3412;
}

.hhrh-status-heating .material-symbols-outlined {
    color: #f97316;
}

.hhrh-status-idle {
    background: #dbeafe;
    color: #1e40af;
}

.hhrh-status-idle .material-symbols-outlined {
    color: #3b82f6;
}

.hhrh-status-error {
    background: #fef08a;
    color: #854d0e;
}

.hhrh-status-error .material-symbols-outlined {
    color: #eab308;
}

/* Room Card Body */
.hhrh-room-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hhrh-room-temp {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.hhrh-temp-value {
    font-size: 24px;
    font-weight: 700;
    color: #f97316;
}

.hhrh-temp-label {
    font-size: 14px;
    color: #6b7280;
}

.hhrh-room-trvs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hhrh-trv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
}

.hhrh-trv-item i.mdi {
    font-size: 18px;
}

.hhrh-radiator-active {
    color: #dc2626;
}

.hhrh-radiator-idle {
    color: #3b82f6;
}

.hhrh-trv-location {
    font-weight: 500;
    flex: 1;
}

.hhrh-trv-target {
    font-weight: 600;
    color: #1f2937;
}

.hhrh-room-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #f3f4f6;
}

.hhrh-room-state {
    font-size: 11px;
    color: #6b7280;
    text-transform: capitalize;
    padding: 4px 8px;
    border-radius: 4px;
}

.hhrh-room-state-vacant {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.hhrh-room-state-booked {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.hhrh-room-state-heating-up {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.hhrh-room-state-occupied {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.hhrh-room-state-cooling-down {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

/* Category Groups */
.hhrh-category-group {
    margin-bottom: 30px;
}

.hhrh-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.hhrh-category-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.hhrh-category-count {
    font-size: 14px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Modal */
.hhrh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hhrh-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.hhrh-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.hhrh-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1f2937;
}

/* Room Status Info */
.hhrh-room-status-info {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
}

.hhrh-status-label {
    font-size: 14px;
    font-weight: 600;
}

.hhrh-status-timing {
    font-size: 11px;
    font-weight: 400;
    margin-top: 2px;
    opacity: 0.9;
}

.hhrh-status-vacant {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.hhrh-status-booked {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.hhrh-status-heating-up {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.hhrh-status-occupied {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.hhrh-status-cooling-down {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

.hhrh-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    border-radius: 6px;
    transition: background 0.2s;
}

.hhrh-modal-close:hover {
    background: #f3f4f6;
}

.hhrh-modal-close .material-symbols-outlined {
    font-size: 24px;
    color: #6b7280;
}

.hhrh-modal-body {
    padding: 20px;
}

/* TRV Controls */
.hhrh-trv-controls {
    display: grid;
    gap: 20px;
}

/* Set All Valves Control */
.hhrh-set-all-control {
    background: #f9fafb;
    border: 3px solid #6b7280;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 8px;
    text-align: center;
}

.hhrh-set-all-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.hhrh-set-all-label .material-symbols-outlined {
    font-size: 24px;
}

.hhrh-set-all-control .hhrh-temp-control {
    justify-content: center;
}

.hhrh-trv-control {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s;
}

/* Red border and glow when valve is open */
.hhrh-trv-heating {
    border: 2px solid #dc2626;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5), 0 0 40px rgba(220, 38, 38, 0.2);
}

.hhrh-trv-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hhrh-trv-location-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hhrh-trv-location-title .material-symbols-outlined {
    color: #f97316;
}

.hhrh-trv-location-title i.mdi {
    font-size: 20px;
}

/* Indicators container */
.hhrh-trv-indicators {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* WiFi indicator */
.hhrh-trv-wifi {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 500;
}

.hhrh-trv-wifi .material-symbols-outlined {
    font-size: 16px;
}

.hhrh-wifi-good {
    background: #d1fae5;
    color: #065f46;
}

.hhrh-wifi-fair {
    background: #fef3c7;
    color: #92400e;
}

.hhrh-wifi-poor {
    background: #fee2e2;
    color: #991b1b;
}

/* Valve position indicator */
.hhrh-trv-valve {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 500;
}

.hhrh-trv-valve .material-symbols-outlined {
    font-size: 16px;
}

/* Grey when valve is closed (0%) */
.hhrh-valve-closed {
    background: #f3f4f6;
    color: #6b7280;
}

/* Red when valve is open (>0%) */
.hhrh-valve-open {
    background: #fee2e2;
    color: #991b1b;
}

/* Battery indicator in TRV header */
.hhrh-trv-battery {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 500;
}

.hhrh-trv-battery svg {
    width: 16px;
    height: 16px;
}

.hhrh-trv-health {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
}

.hhrh-trv-temps {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
}

.hhrh-temp-display {
    text-align: center;
}

.hhrh-temp-display-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.hhrh-temp-display-value {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
}

/* Pending target temperature display */
.hhrh-target-actual {
    color: #9ca3af;
    text-decoration: line-through;
    font-size: 32px;
    font-weight: 700;
}

.hhrh-target-pending {
    color: #f59e0b;
    font-size: 18px;
    font-weight: 600;
    margin-left: 8px;
}

.hhrh-pending-time {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 400;
    margin-top: 4px;
}

/* Room card pending target display */
.hhrh-card-target-actual {
    color: #9ca3af;
    text-decoration: line-through;
    margin-right: 4px;
}

.hhrh-card-target-pending {
    color: #f59e0b;
    font-weight: 600;
}

/* Pending command warning icons */
.hhrh-pending-warning {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

.hhrh-pending-warning .material-symbols-outlined {
    font-size: 16px;
}

.hhrh-pending-warn {
    color: #f59e0b;
}

.hhrh-pending-critical {
    color: #ef4444;
}

.hhrh-temp-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.hhrh-temp-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hhrh-temp-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.hhrh-temp-btn:active {
    background: #d1d5db;
}

.hhrh-temp-input {
    width: 70px;
    padding: 8px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    line-height: normal;
    vertical-align: middle;
}

/* Remove default number input spinner buttons for cleaner look */
.hhrh-temp-input::-webkit-outer-spin-button,
.hhrh-temp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hhrh-temp-input[type=number] {
    -moz-appearance: textfield;
}

.hhrh-temp-input.hhrh-temp-modified {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.hhrh-btn-apply {
    background: #f97316;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.hhrh-btn-apply:hover {
    background: #ea580c;
}

.hhrh-btn-apply:disabled,
.hhrh-btn-apply.hhrh-btn-loading {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
}

.hhrh-temp-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.5;
}

.hhrh-temp-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Calibration Error Message */
.hhrh-calibration-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-size: 13px;
    font-weight: 500;
}

.hhrh-calibration-error .material-symbols-outlined {
    font-size: 20px;
    color: #dc2626;
}

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

    .hhrh-controls {
        flex-direction: column;
        gap: 15px;
    }

    .hhrh-modal {
        max-height: 95vh;
    }
}

/* Battery Indicators */
.hhrh-trv-battery {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: #6b7280;
    margin-left: auto;
}

.hhrh-trv-battery svg {
    width: 20px;
    height: 20px;
}

.hhrh-trv-battery.hhrh-battery-ok svg path {
    fill: #16a34a;
}

.hhrh-trv-battery.hhrh-battery-warning svg path {
    fill: #f59e0b;
}

.hhrh-trv-battery.hhrh-battery-critical svg path {
    fill: #dc2626;
}

.hhrh-battery-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.hhrh-battery-badge svg {
    width: 16px;
    height: 16px;
}

.hhrh-battery-ok {
    background: #d1fae5;
    color: #065f46;
}

.hhrh-battery-ok svg path {
    fill: #065f46;
}

.hhrh-battery-warning {
    background: #fef3c7;
    color: #92400e;
}

.hhrh-battery-warning svg path {
    fill: #92400e;
}

.hhrh-battery-critical {
    background: #fee2e2;
    color: #991b1b;
}

.hhrh-battery-critical svg path {
    fill: #991b1b;
}

.hhrh-battery-alert {
    font-size: 16px !important;
}

.hhrh-battery-percent {
    font-weight: 600;
}

/* Notification Modal */
.hhrh-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hhrh-notification {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    padding: 20px;
    gap: 15px;
    position: relative;
    animation: hhrh-notification-slide-in 0.3s ease-out;
}

@keyframes hhrh-notification-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hhrh-notification-icon {
    flex-shrink: 0;
}

.hhrh-notification-icon .material-symbols-outlined {
    font-size: 48px;
}

.hhrh-notification-icon.success .material-symbols-outlined {
    color: #16a34a;
}

.hhrh-notification-icon.error .material-symbols-outlined {
    color: #dc2626;
}

.hhrh-notification-icon.warning .material-symbols-outlined {
    color: #f59e0b;
}

.hhrh-notification-icon.info .material-symbols-outlined {
    color: #3b82f6;
}

.hhrh-notification-content {
    flex: 1;
}

.hhrh-notification-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #1f2937;
}

.hhrh-notification-content p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.hhrh-notification-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.hhrh-notification-close:hover {
    background: #f3f4f6;
}

.hhrh-notification-close .material-symbols-outlined {
    font-size: 20px;
    color: #6b7280;
}
