/* =====================================================
   TEMPERATURE MONITORING — temps.css
   Shared styles for login.html and index.html
   ===================================================== */

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Nav: no link should appear active on temperature pages ── */
.nav-link.active {
    color: white !important;
    font-weight: 500 !important;
}

/* ── Login page ── */
.temps-login-section {
    min-height: calc(100vh - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    background: var(--bg-dark);
}

.temps-login-card {
    background: var(--surface-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 26rem;
}

.temps-login-icon {
    width: 3rem;
    height: 3rem;
    background: rgba(25, 76, 179, 0.15);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.temps-login-icon .material-symbols-outlined {
    font-size: 1.5rem;
    color: var(--primary);
}

.temps-login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0 0 1.75rem;
}

.temps-login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Loading & error states ── */
.temps-loading,
.temps-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}

.temps-loading .material-symbols-outlined {
    font-size: 2.5rem;
    color: var(--primary);
    animation: temps-spin 1.2s linear infinite;
}

.temps-error .material-symbols-outlined {
    font-size: 2.5rem;
    color: #f59e0b;
}

.temps-error p {
    color: var(--text-slate);
    font-size: 0.95rem;
    max-width: 32rem;
}

@keyframes temps-spin { to { transform: rotate(360deg); } }

/* ── Main layout ── */
.temps-main {
    min-height: calc(100vh - 4rem);
    padding-bottom: 3rem;
}

/* ── Page header ── */
.temps-page-header {
    padding: 2.5rem 0 1.5rem;
    border-bottom: 1px solid var(--border-dark);
    margin-bottom: 2rem;
}

.temps-page-header h1 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 800;
    color: white;
    margin: 0 0 0.4rem;
    line-height: 1.2;
}

.temps-page-header p {
    color: var(--text-slate);
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
}

.temps-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.temps-last-updated {
    font-size: 0.75rem;
    color: var(--text-slate);
}

/* ── Sign-out button ── */
.temps-signout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-slate);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.temps-signout-btn:hover {
    border-color: var(--primary);
    color: white;
}

.temps-signout-btn .material-symbols-outlined {
    font-size: 1rem;
}

/* ── Section spacing ── */
.temps-main > .container {
    padding-top: 1.5rem;
}

.temps-main > .container h2 {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Room tiles ── */
.temps-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    padding-bottom: 2.5rem;
}

.temps-tile {
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-left: 4px solid var(--border-dark);
    border-radius: 0.75rem;
    padding: 1.25rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* State colours */
.temps-tile.status-green  { border-left-color: #10b981; }
.temps-tile.status-amber  { border-left-color: #f59e0b; }
.temps-tile.status-red    { border-left-color: #ef4444; }
.temps-tile.status-grey   { border-left-color: #6b7280; }

.temps-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.temps-tile-room {
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
}

.temps-tile-type {
    font-size: 0.7rem;
    color: var(--text-slate);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.temps-tile-temp {
    font-size: 2.4rem;
    font-weight: 800;
    color: white;
    line-height: 1;
    margin: 0.2rem 0 0.1rem;
    letter-spacing: -0.02em;
}

.temps-tile-vs {
    font-size: 0.78rem;
    color: var(--text-slate);
}

.temps-tile-meta {
    font-size: 0.72rem;
    color: var(--text-slate);
    margin-top: 0.1rem;
}

.temps-tile-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-slate);
    margin-top: 0.1rem;
}

.temps-tile-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(45, 55, 72, 0.6);
}

.status-green .temps-tile-status { color: #10b981; }
.status-amber .temps-tile-status { color: #f59e0b; }
.status-red   .temps-tile-status { color: #ef4444; }
.status-grey  .temps-tile-status { color: #6b7280; }

.temps-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-green .temps-status-dot { background: #10b981; }
.status-amber .temps-status-dot { background: #f59e0b; }
.status-red   .temps-status-dot { background: #ef4444; }
.status-grey  .temps-status-dot { background: #6b7280; }

/* ── Chart section ── */
.temps-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.temps-chart-header h2 {
    margin-bottom: 0 !important;
}

.temps-time-toggle {
    display: flex;
    gap: 0.375rem;
}

.temps-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--text-slate);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.7rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.temps-toggle-btn.active,
.temps-toggle-btn:hover {
    border-color: var(--primary);
    color: white;
    background: rgba(25, 76, 179, 0.15);
}

.temps-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    padding-bottom: 2.5rem;
}

.temps-no-data-msg {
    color: var(--text-slate);
    font-size: 0.875rem;
    padding: 1rem 0 2rem;
}

.temps-chart-wrapper {
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: 0.75rem;
    padding: 1rem 1rem 0.75rem;
}

.temps-chart-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.temps-chart-type {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-slate);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Chart legend */
.temps-chart-legend {
    display: flex;
    gap: 0.875rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.temps-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    color: var(--text-slate);
}

.temps-legend-line {
    width: 18px;
    height: 2px;
    flex-shrink: 0;
}

.temps-legend-line.solid  { background: #60a5fa; }
.temps-legend-line.dashed { background: repeating-linear-gradient(90deg, #f59e0b 0 6px, transparent 6px 10px); }
.temps-legend-line.dotted { background: repeating-linear-gradient(90deg, #ef4444 0 2px, transparent 2px 5px); }

/* ── Sensor health table ── */
.temps-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2.5rem;
}

.temps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 600px;
}

.temps-table th {
    text-align: left;
    color: var(--text-slate);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.68rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-dark);
    white-space: nowrap;
}

.temps-table td {
    padding: 0.65rem 1rem;
    color: var(--text-white);
    border-bottom: 1px solid rgba(45, 55, 72, 0.45);
    white-space: nowrap;
}

.temps-table tr:last-child td { border-bottom: none; }

.temps-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.signal-weak { color: #f59e0b !important; }
.battery-low { color: #ef4444 !important; }

/* ── Mobile ── */
@media (max-width: 640px) {
    .temps-page-header { padding: 1.5rem 0 1rem; }

    .temps-tiles-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .temps-tile-temp { font-size: 2rem; }

    .temps-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .temps-tiles-grid { grid-template-columns: 1fr; }
}

/* ── TV / wide screens ── */
@media (min-width: 1600px) {
    .temps-tiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .temps-tile-temp { font-size: 3rem; }

    .temps-charts-grid {
        grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    }
}
