:root {
    --bg-color: #0f1115;
    --panel-bg: #1a1d23;
    --panel-border: #2d323e;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    --header-height: 70px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

[data-theme="light"] {
    --bg-color: #f8fafc;
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease;
}

.hidden { display: none !important; }

/* Header */
.main-header {
    height: var(--header-height);
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky; top: 0; z-index: 100;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-img { height: 35px; width: auto; object-fit: contain; }

/* Theme-based logo visibility */
.light-logo { display: none; }
[data-theme="light"] .light-logo { display: block; }
[data-theme="light"] .dark-logo { display: none; }

.live-clock { text-align: center; }
.clock-date { font-size: 0.8rem; color: var(--text-muted); }
.clock-time { font-size: 1.5rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--accent-color); }

.header-right { display: flex; align-items: center; gap: 10px; }
.sync-status {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    background: var(--bg-color); border: 1px solid var(--panel-border);
    border-radius: 20px; font-size: 0.75rem; font-weight: 700;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.sync-status.online .status-dot { background: var(--success-color); box-shadow: 0 0 8px var(--success-color); }

/* Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr 380px;
    gap: 24px;
    padding: 24px;
    max-width: 1800px;
    margin: 0 auto;
}

.panel { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--card-shadow); }
.panel-header { padding: 20px; border-bottom: 1px solid var(--panel-border); display: flex; justify-content: space-between; align-items: center; }
.panel-header h2 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }

/* Buttons */
.btn {
    padding: 10px 20px; border-radius: var(--radius-md); font-weight: 600; cursor: pointer; border: none;
    transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.9rem;
}
.btn-primary { background: var(--accent-color); color: white; }
.btn-success { background: var(--success-color); color: white; }
.btn-outline { border: 1px solid var(--panel-border); background: transparent; color: var(--text-main); }
.btn-danger-outline { border: 1px solid var(--danger-color); color: var(--danger-color); background: transparent; }
.btn-danger-outline:hover { background: var(--danger-color); color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 30px; font-size: 1.1rem; }
.icon-btn { background: transparent; border: 1px solid var(--panel-border); color: var(--text-muted); width: 38px; height: 38px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Queue & Completed */
.add-task-form { padding: 20px; background: rgba(0,0,0,0.1); border-bottom: 1px solid var(--panel-border); }
input[type="text"], input[type="url"], input[type="number"], input[type="datetime-local"] {
    width: 100%; padding: 12px; background: var(--bg-color); border: 1px solid var(--panel-border); 
    border-radius: var(--radius-md); color: var(--text-main); margin-bottom: 10px; outline: none; font-family: inherit;
}

.queue-container { flex: 1; overflow-y: auto; padding: 20px; }
.task-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.task-item { background: var(--bg-color); border: 1px solid var(--panel-border); border-radius: var(--radius-md); padding: 15px; }
.task-item.active { border-color: var(--accent-color); background: rgba(59,130,246,0.05); }

.completed-item { background: #1a1d23; border: 1px solid #2d323e; }
.check-icon { font-size: 1.2rem; filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.3)); }
.link-icon { font-size: 0.75rem; color: #4a90e2; text-decoration: none; margin-left: 10px; font-weight: normal; }
.task-time-range { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }

.task-card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.task-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-actions { display: flex; gap: 5px; }

/* Active Panel */
.active-task-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 60px 40px; text-align: center; }
.main-timer { 
    font-size: 8rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; margin: 15px 0; 
    color: var(--accent-color); text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}
.active-task-type { padding: 4px 16px; border-radius: 20px; background: var(--accent-color); font-size: 0.8rem; font-weight: 800; margin-bottom: 10px; box-shadow: 0 0 15px rgba(59, 130, 246, 0.4); }
.active-content h1 { font-size: 2.2rem; font-weight: 800; font-family: var(--font-heading); margin-bottom: 5px; }
.timer-meta { display: flex; justify-content: center; gap: 20px; color: var(--text-muted); font-size: 0.9rem; }
.active-controls { display: flex; gap: 15px; margin-top: 30px; }

/* Performance Stats Panel (Right) */
.performance-card { background: var(--bg-color); border: 1px solid var(--panel-border); border-radius: var(--radius-md); overflow: hidden; }
.performance-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.performance-table th { background: rgba(255,255,255,0.02); padding: 12px 15px; text-align: left; font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--panel-border); }
.performance-table td { padding: 15px; border-bottom: 1px solid var(--panel-border); vertical-align: middle; }
.text-right { text-align: right !important; }
.val-bold { font-weight: 800; font-family: var(--font-heading); margin-bottom: 4px; }
.val-mono { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--accent-color); }

.activity-info { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.p-dot { background: var(--accent-color); box-shadow: 0 0 6px var(--accent-color); }
.rt-dot { background: var(--success-color); box-shadow: 0 0 6px var(--success-color); }

.mini-bar-bg { height: 4px; background: rgba(255,255,255,0.05); border-radius: 2px; overflow: hidden; width: 60px; margin-left: auto; }
.mini-bar-fill { height: 100%; transition: width 0.4s; }
.p-fill { background: var(--accent-color); }
.rt-fill { background: var(--success-color); }

.total-time-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 30px 25px;
    text-align: center;
    margin-top: 10px;
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}
.hero-label { display: block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: var(--accent-color); margin-bottom: 8px; letter-spacing: 0.05em; }
.hero-value { font-size: 3.5rem; font-weight: 800; font-family: var(--font-heading); color: var(--text-main); line-height: 1; }

.panel-actions { padding: 25px; display: flex; justify-content: center; gap: 15px; border-top: 1px solid var(--panel-border); }

/* Footer & Tabs - FIXED FOR VISIBILITY */
.bottom-section { padding: 40px 24px; max-width: 1800px; margin: 40px auto; border-top: 1px solid var(--panel-border); clear: both; }
.tabs { display: flex; gap: 25px; margin-bottom: 25px; border-bottom: 1px solid var(--panel-border); }
.tab-btn { padding: 12px 0; background: transparent; border: none; color: var(--text-muted); font-weight: 700; cursor: pointer; position: relative; font-size: 1rem; }
.tab-btn.active { color: var(--text-main); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 0; width: 100%; height: 3px; background: var(--accent-color); }

.tab-content { display: none; padding-top: 20px; }
.tab-content.active { display: block !important; }

.analytics-content { padding: 15px; background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; font-size: 0.95rem; }
.analytics-item { margin-bottom: 12px; }
.analytics-item-header { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 700; margin-bottom: 5px; }
.analytics-bar-bg { height: 6px; background: var(--bg-color); border-radius: 3px; overflow: hidden; }
.analytics-bar-fill { height: 100%; transition: width 0.5s ease; }

.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.history-card { background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 12px; padding: 20px; box-shadow: var(--card-shadow); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1000; display: none; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 20px; width: 90%; max-width: 450px; z-index: 1001; display: none; overflow: hidden; }
.modal-header { padding: 15px 20px; border-bottom: 1px solid var(--panel-border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 15px 20px; border-top: 1px solid var(--panel-border); display: flex; justify-content: flex-end; }

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .panel-active { order: -1; }
}

@media (max-width: 600px) {
    .main-header { padding: 0 15px; }
    .logo-img { height: 28px; }
    .clock-date { display: none; }
    .clock-time { font-size: 1.2rem; }
    .sync-status span { display: none; }
    .sync-status { padding: 8px; border-radius: 50%; }
    .header-right { gap: 5px; }
    .main-timer { font-size: 5rem; }
}
