/* premium-light-mode.css */
:root {
    /* Colors - Adapted from Resource Tracker */
    --bg-app: #f3f4f6;
    /* Light Grey */
    --bg-panel: #ffffff;
    /* White */
    --bg-panel-hover: #f9fafb;
    --border-panel: #e5e7eb;
    /* Grey 200 */

    --text-primary: #111827;
    /* Grey 900 */
    --text-secondary: #6b7280;
    /* Grey 500 */
    --text-muted: #9ca3af;
    /* Grey 400 */

    --accent-primary: #2563eb;
    /* Blue 600 */
    --accent-primary-hover: #1d4ed8;
    /* Blue 700 */

    --accent-success: #10b981;
    /* Emerald 500 */
    --accent-danger: #ef4444;
    /* Red 500 */
    --accent-warning: #f59e0b;
    /* Amber 500 */

    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;

    /* Fonts */
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling for the "dashboard" feel */
    display: flex;
    flex-direction: column;
}

/* Typography Utilities */
h1,
h2,
h3 {
    font-weight: 600;
}

h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: var(--space-md);
    gap: var(--space-md);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand h1 {
    font-size: 1.25rem;
}

.system-clocks {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.clock-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.clock-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.clock-time {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-panel);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    /* 2 Columns: Tools | Main */
    gap: var(--space-md);
    flex: 1;
    min-height: 0;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 12px;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

/* Button Icon Small for Headers */
.btn-icon-small {
    background: var(--bg-panel-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-panel);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon-small:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Tools Panel (Left) */
.tools-panel {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow: hidden;
    /* Manage internal scroll */
}

/* Right Column Container */
.right-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
}

/* Main Timer Panel */
.main-timer-panel {
    flex: 0 0 250px;
    /* Fixed height for timer */
    align-items: center;
    justify-content: center;
    position: relative;
    background: white;
    /* Changed from dark gradient */
}

.timer-status {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-panel);
}

.status-dot.active {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
}

.timer-display-container {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.giant-timer {
    font-family: var(--font-mono);
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
    color: var(--text-primary);
    /* Dark text for light mode */
    text-shadow: none;
}

.timer-label {
    margin-top: var(--space-sm);
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 2px;
}

.main-controls {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* Aux Panel section layout */
.panel-section {
    padding: var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.panel-section h2 {
    font-size: 0.8rem;
    margin-bottom: var(--space-sm);
}

.panel-divider {
    height: 1px;
    background: var(--border-panel);
    flex-shrink: 0;
}

.aux-timer-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.aux-timer-card {
    flex-direction: row;
    gap: var(--space-md);
}

/* Alarm Cards */
.alarm-card {
    background: var(--bg-panel-hover);
    border: 1px solid var(--border-panel);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alarm-card.triggered {
    /* Legacy fallback */
    border-color: var(--accent-danger);
}

.alarm-card.alarm-firing {
    background: #fee2e2;
    /* Light red bg */
    border-color: var(--accent-danger);
    animation: pulse-red 1s infinite;
    cursor: pointer;
}

.alarm-card.alarm-acknowledged {
    background: #fef3c7;
    /* Light amber bg */
    border-color: var(--accent-warning);
    border-style: dashed;
}

.alarm-card.alarm-acknowledged .alarm-time,
.alarm-card.alarm-acknowledged .alarm-label {
    color: #b45309;
    /* Darker amber text */
}

@keyframes pulse-red {
    0% {
        background-color: #fee2e2;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        border-color: rgba(239, 68, 68, 1);
    }

    50% {
        background-color: #fecaca;
        box-shadow: 0 0 8px 0 rgba(239, 68, 68, 0.4);
        border-color: rgba(239, 68, 68, 0.5);
    }

    100% {
        background-color: #fee2e2;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 1);
    }
}

.alarm-info {
    display: flex;
    flex-direction: column;
}

.alarm-time {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

/* Cursor for editable elements */
.clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
}

.clickable:hover {
    color: var(--accent-primary);
}

/* Alarms Panel (Right Top) */
.alarms-panel {
    grid-column: 3;
    grid-row: 1;
}

.alarms-list {
    flex: 1;
    overflow-y: auto;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: var(--space-lg) 0;
    font-style: italic;
}

/* Logs Panel (Bottom Center/Right) */
.logs-panel {
    flex: 1;
    /* Takes remaining height */
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.log-container {
    flex: 1;
    background: var(--bg-panel-hover);
    border-radius: 6px;
    padding: var(--space-sm);
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border: 1px solid var(--border-panel);
    margin-bottom: var(--space-sm);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.log-entry {
    display: flex;
    gap: var(--space-md);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-panel);
}

.log-time {
    color: var(--text-secondary);
}

.log-message {
    color: var(--text-primary);
}

.log-type-system {
    color: var(--accent-warning);
}

.log-type-alarm {
    color: var(--accent-danger);
}

.log-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Buttons & Inputs */
.btn {
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-ui);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-panel);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    box-shadow: none;
}

.btn-ghost:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-app);
    color: var(--text-primary);
}

.btn-icon.delete-confirm {
    background: #fee2e2 !important;
    color: var(--accent-danger) !important;
    animation: pulse-delete 0.5s 1;
}

@keyframes pulse-delete {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.hidden {
    display: none !important;
}

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

.modal {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: var(--space-lg);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal h3 {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

input,
textarea {
    width: 100%;
    background: #f9fafb;
    border: 1px solid var(--border-panel);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-ui);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Tabs */
.tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-panel);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
}

/* Time Input Group */
.time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input-group input {
    width: 60px;
    text-align: center;
}

/* Responsive */
/* Aux Timer Cards */
.aux-timer-card {
    background: white;
    border: 1px solid var(--border-panel);
    border-radius: 8px;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.aux-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aux-label-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 2px;
    width: 120px;
    font-weight: 500;
}

.aux-label-input:focus {
    background: #f3f4f6;
    color: var(--text-primary);
}

.aux-display {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

.aux-controls {
    display: flex;
    gap: 4px;
}

.aux-controls .btn-icon {
    width: 28px;
    height: 28px;
    background: #f3f4f6;
}

.aux-controls .btn-icon:hover {
    background: var(--accent-primary);
    color: white;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
        display: block;
        /* Stack everything */
    }

    body {
        overflow: auto;
    }

    .panel {
        margin-bottom: var(--space-md);
    }

}

@keyframes flash {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px var(--accent-warning);
    }

    100% {
        opacity: 0.5;
    }
}