/* NightWatch — page-specific styles (loaded after styles.css). */

.nw-container { max-width: 1100px; }

.nw-header { text-align: center; margin: 28px 0 24px; }
.nw-header h1 { font-size: 1.85rem; color: var(--gray-900); }
.nw-header .subtitle { color: var(--gray-500); margin-top: 4px; }
.nw-header-links {
    margin-top: 12px;
    display: flex; justify-content: center; gap: 24px;
    font-size: 0.9rem;
}
.nw-header-links a { color: var(--primary); text-decoration: none; }
.nw-header-links a:hover { text-decoration: underline; }

.nw-tz-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ---- Error banner --------------------------------------------------- */
.nw-error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* ---- Env cards (dashboard) ----------------------------------------- */
.nw-env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.nw-env-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    border-left: 4px solid var(--gray-300);
}
.nw-env-card.status-running { border-left-color: var(--success); }
.nw-env-card.status-stopped { border-left-color: var(--gray-400); }
.nw-env-card.status-transitioning { border-left-color: #f59e0b; }
.nw-env-card.skeleton { opacity: 0.6; }

.nw-env-card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.nw-env-card-head h2 { font-size: 1.5rem; color: var(--gray-900); }

.nw-status-pill {
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    background: var(--gray-200);
    color: var(--gray-700);
}
.nw-status-pill.status-running { background: #dcfce7; color: var(--success); }
.nw-status-pill.status-stopped { background: var(--gray-200); color: var(--gray-600); }
.nw-status-pill.status-transitioning { background: #fef3c7; color: #d97706; }

.nw-env-meta { font-size: 0.92rem; color: var(--gray-600); }
.nw-env-meta p { margin-bottom: 6px; }

.nw-countdown {
    margin-top: 10px;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--gray-800);
    letter-spacing: 0.04em;
}
.nw-countdown.countdown-warning {
    color: var(--danger);
    animation: pulse 1.5s infinite;
}

.nw-env-actions {
    margin-top: 16px;
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.nw-env-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.nw-busy-label {
    font-size: 0.85rem; color: var(--gray-500); font-style: italic;
    animation: nw-pulse 1.2s ease-in-out infinite;
}
@keyframes nw-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- Recent actions table ------------------------------------------ */
.nw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.nw-table th, .nw-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}
.nw-table thead th {
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    background: var(--gray-50);
}
.nw-table tbody tr:hover { background: var(--gray-50); }

.nw-recent { overflow-x: auto; }

/* ---- Hours-picker modal -------------------------------------------- */
.nw-modal {
    position: fixed; inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.nw-modal-card {
    background: white;
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 460px; width: 90%;
    box-shadow: var(--shadow-lg);
}
.nw-modal-card h3 { margin-bottom: 4px; }
.nw-modal-sub { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 16px; }
.nw-hours-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 14px;
}
.nw-hours-picker button {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    padding: 10px 0;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
}
.nw-hours-picker button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.nw-modal-projection {
    font-size: 0.88rem;
    color: var(--gray-600);
    margin-bottom: 18px;
}
.nw-modal-projection code {
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.nw-modal-actions {
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---- Schedule editor ------------------------------------------------ */
.nw-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
}
.nw-tab {
    background: none; border: none;
    padding: 10px 24px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
}
.nw-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.nw-schedule-grid { margin-bottom: 18px; }
.nw-day-row {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    align-items: flex-start;
}
.nw-day-row:last-child { border-bottom: none; }
.nw-day-label {
    width: 56px;
    font-weight: 600;
    color: var(--gray-700);
    padding-top: 6px;
}
.nw-day-periods {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}
.nw-day-empty {
    color: var(--gray-400);
    font-size: 0.88rem;
    font-style: italic;
    padding-top: 4px;
}
.nw-period-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.nw-period-row input[type="time"] {
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9rem;
}
.nw-period-row input[type="text"] {
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.85rem;
    width: 200px;
}
.nw-next-day-badge {
    font-size: 0.75rem; font-weight: 600; color: var(--orange, #d97706);
    background: #fef3c7; border-radius: 3px; padding: 1px 5px;
    white-space: nowrap;
}
.nw-next-day-badge.hidden { display: none; }
.nw-period-remove {
    background: none;
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.nw-period-remove:hover { color: var(--danger); border-color: var(--danger); }

.nw-schedule-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}
.nw-schedule-meta {
    font-size: 0.85rem;
    color: var(--gray-500);
}
.nw-schedule-meta code {
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ---- Audit page ----------------------------------------------------- */
.nw-audit-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}
.nw-audit-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--gray-600);
}
.nw-audit-filters input,
.nw-audit-filters select {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9rem;
}
.nw-audit-filters input[type="email"] { min-width: 220px; }

.nw-pagination {
    margin-top: 12px;
    text-align: center;
}

.nw-action-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
}
.nw-action-pill.action-start { background: #dcfce7; color: var(--success); }
.nw-action-pill.action-stop  { background: var(--gray-200); color: var(--gray-700); }
.nw-action-pill.action-extend { background: #dbeafe; color: var(--primary); }
.nw-action-pill.action-auto_shutdown { background: #ede9fe; color: #6d28d9; }
.nw-action-pill.action-warning_sent { background: #fef3c7; color: #b45309; }
.nw-action-pill.action-schedule_edit { background: #cffafe; color: #0e7490; }
.nw-action-pill.action-error { background: #fee2e2; color: var(--danger); }

.nw-details {
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--gray-700);
    background: var(--gray-50);
    padding: 4px 8px;
    border-radius: 4px;
    max-width: 380px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
