/* ==========================================================================
   SMART OVEN - GUEST SINGLE-PAGE PORTAL & MODAL
   ========================================================================== */

:root {
    --guest-terracotta: #c25e2e;
    --guest-terracotta-dark: #a0491f;
    --guest-clay: #d97706;
    --guest-bg: #fdfbf7;
    --guest-card: #ffffff;
    --guest-border: #e8dfd6;
    --guest-text: #2c241e;
    --guest-muted: #6b5e54;
    --guest-green: #10b981;
    --guest-blue: #0284c7;
    --guest-red: #ef4444;
}

body.guest-page {
    background: linear-gradient(180deg, #fbf7f2 0%, #f4ede4 100%) !important;
    color: var(--guest-text) !important;
    min-height: 100vh;
    padding-top: calc(var(--shared-nav-height, 70px) + 16px) !important;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", Tahoma, sans-serif !important;
}

.guest-container {
    width: min(calc(100% - 2rem), 1280px);
    margin: 0 auto;
    padding-bottom: 3.5rem;
}

/* Hero Header */
.guest-hero {
    background: linear-gradient(135deg, #2a1b12 0%, #1e130d 100%);
    border: 1px solid rgba(217, 119, 6, 0.25);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    color: #ffffff;
}

.guest-hero__content h1 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffedd5;
}

.guest-hero__content p {
    font-size: 15px;
    color: #cbd5e1;
    margin: 0;
    line-height: 1.5;
}

.guest-hero__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.guest-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
}

.guest-pill--online {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.guest-pill--offline {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.guest-pill--door-closed {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.guest-pill--door-open {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.guest-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.pulse-dot {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* 4 Telemetry Grid Cards */
.guest-telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.telemetry-card {
    background: var(--guest-card);
    border: 1px solid var(--guest-border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.telemetry-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.telemetry-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.telemetry-card--temp::before { background: linear-gradient(90deg, #ea580c, #ef4444); }
.telemetry-card--hum::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.telemetry-card--lux::before { background: linear-gradient(90deg, #eab308, #f59e0b); }
.telemetry-card--actuators::before { background: linear-gradient(90deg, #10b981, #059669); }

.telemetry-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.telemetry-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--guest-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.telemetry-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.telemetry-card--temp .telemetry-card__icon { background: #fff7ed; color: #ea580c; }
.telemetry-card--hum .telemetry-card__icon { background: #f0f9ff; color: #0284c7; }
.telemetry-card--lux .telemetry-card__icon { background: #fefce8; color: #ca8a04; }
.telemetry-card--actuators .telemetry-card__icon { background: #ecfdf5; color: #059669; }

.telemetry-card__value-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.telemetry-card__value {
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
    color: var(--guest-text);
}

.telemetry-card__unit {
    font-size: 18px;
    font-weight: 600;
    color: var(--guest-muted);
}

.telemetry-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-top: 1px dashed #f1e9e0;
    padding-top: 10px;
    color: var(--guest-muted);
}

.telemetry-badge {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.telemetry-badge--ok { background: #dcfce7; color: #15803d; }
.telemetry-badge--warn { background: #fef3c7; color: #b45309; }
.telemetry-badge--bad { background: #fee2e2; color: #b91c1c; }

/* Actuator List */
.actuator-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.actuator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--guest-text);
}

.actuator-pill {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.actuator-pill--on { background: #dcfce7; color: #16a34a; }
.actuator-pill--off { background: #f1f5f9; color: #64748b; }

/* Historical Chart Section */
.guest-chart-card {
    background: var(--guest-card);
    border: 1px solid var(--guest-border);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.guest-chart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.guest-chart-title h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--guest-text);
    margin: 0 0 4px;
}

.guest-chart-title p {
    font-size: 13.5px;
    color: var(--guest-muted);
    margin: 0;
}

.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f4ede4;
    padding: 4px;
    border-radius: 12px;
}

.period-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--guest-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-btn:hover {
    color: var(--guest-text);
    background: rgba(255, 255, 255, 0.6);
}

.period-btn.is-active {
    background: var(--guest-card);
    color: var(--guest-terracotta);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.custom-range-bar {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 14px;
    background: #fbf7f2;
    border: 1px solid var(--guest-border);
    border-radius: 10px;
}

.custom-range-bar.is-visible { display: flex; }

.custom-range-bar input[type="date"] {
    padding: 5px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
}

.custom-range-bar button {
    padding: 6px 14px;
    background: var(--guest-terracotta);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Stat Summary Pills */
.chart-stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.stat-summary-pill {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fbf7f2;
    border: 1px solid #eee5db;
}

.stat-summary-pill__label {
    font-size: 11.5px;
    color: var(--guest-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.stat-summary-pill__val {
    font-size: 16px;
    font-weight: 800;
    color: var(--guest-text);
    margin-top: 2px;
}

.stat-summary-pill--temp .stat-summary-pill__val { color: #ea580c; }
.stat-summary-pill--hum .stat-summary-pill__val { color: #0284c7; }

/* Canvas Container */
.canvas-wrap {
    position: relative;
    width: 100%;
    height: 340px;
    background: #ffffff;
    border-radius: 12px;
}

.canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Community Footer Card */
.guest-community-banner {
    background: linear-gradient(135deg, #fdf8f4 0%, #f7eee4 100%);
    border: 1px solid #eedecf;
    border-radius: 18px;
    padding: 20px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-size: 14px;
    color: #5c4b3f;
}

.guest-community-banner__badge {
    background: #c25e2e;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ==========================================================================
   MODAL LOGIN POPUP SYSTEM
   ========================================================================== */

.login-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 12, 8, 0.68);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.login-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.login-modal-card {
    background: #ffffff;
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-top: 6px solid #c25e2e;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 32px 36px 36px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    position: relative;
    transform: scale(0.92) translateY(15px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-modal-backdrop.is-open .login-modal-card {
    transform: scale(1) translateY(0);
}

.login-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.15s ease;
}

.login-modal__close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.login-modal__header {
    text-align: center;
    margin-bottom: 24px;
}

.login-modal__header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #2c241e;
    margin: 0 0 6px;
}

.login-modal__header p {
    font-size: 14px;
    color: #6b5e54;
    margin: 0;
}

.login-modal__alert {
    padding: 12px 14px;
    border-radius: 10px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 18px;
}

.login-modal__form-group {
    margin-bottom: 18px;
}

.login-modal__form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}

.login-modal__form-group input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    color: #1f2937;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-modal__form-group input:focus {
    border-color: #c25e2e;
    box-shadow: 0 0 0 3px rgba(194, 94, 46, 0.15);
}

.password-input-wrap {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
}

.login-modal__submit {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #c25e2e, #a84b1d);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(194, 94, 46, 0.35);
    transition: all 0.2s ease;
    margin-top: 6px;
}

.login-modal__submit:hover {
    background: linear-gradient(135deg, #a84b1d, #8f3e16);
    box-shadow: 0 6px 18px rgba(194, 94, 46, 0.45);
    transform: translateY(-1px);
}

.login-modal__footer-links {
    text-align: center;
    margin-top: 18px;
    font-size: 13.5px;
    color: #64748b;
}

.login-modal__footer-links a {
    color: #c25e2e;
    font-weight: 700;
    text-decoration: none;
}

.login-modal__footer-links a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .guest-hero {
        padding: 18px 20px;
    }
    .guest-hero__content h1 {
        font-size: 22px;
    }
    .canvas-wrap {
        height: 260px;
    }
    .guest-community-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
