/* ============================================================================
   Theme Colors - CSS Variables
   ============================================================================ */

:root {
    /* Light theme - default */
    --brand: #00e676;
    --brand-strong: #00c36a;
    --brand-soft: #e9fbf1;
    --text-primary: #111814;
    --text-secondary: #6b7280;
    --text-muted: #94a3b8;
    --bg-primary: #f6f8f7;
    --bg-secondary: #ffffff;
    --border: #e5e7eb;
    --border-soft: rgba(148, 163, 184, 0.15);
    --shadow-soft: 0 14px 34px -22px rgba(15, 23, 42, 0.35);

    /* Semantic colors for light theme */
    --card-bg: #ffffff;
    --card-border: rgba(148, 163, 184, 0.15);
    --btn-outline-bg: #ffffff;
    --btn-outline-text: #111814;
    --btn-outline-border: rgba(148, 163, 184, 0.3);
    --chip-bg: #ffffff;
    --chip-text: #111827;
    --chip-border: rgba(148, 163, 184, 0.35);
    --input-bg: #ffffff;
    --input-border: rgba(148, 163, 184, 0.25);
    --input-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.2);
    --input-placeholder: #94a3b8;
    --timer-bg: #ffffff;
    --timer-border: rgba(148, 163, 184, 0.2);
    --timer-text: #111827;
    --timer-label: #94a3b8;
    --segmented-bg: rgba(148, 163, 184, 0.16);
    --segmented-btn-text: #64748b;
    --segmented-active-bg: #ffffff;
    --segmented-active-text: #0b9f5b;
    --segmented-shadow: 0 10px 20px -16px rgba(15, 23, 42, 0.3);
    --period-toggle-bg: #ffffff;
    --period-toggle-text: #475569;
    --period-toggle-border: rgba(148, 163, 184, 0.25);

    /* Status colors */
    --status-completed-bg: rgba(0, 230, 118, 0.15);
    --status-completed-text: #087f47;
    --status-progress-bg: rgba(20, 184, 166, 0.18);
    --status-progress-text: #0f766e;
    --status-planned-bg: rgba(59, 130, 246, 0.12);
    --status-planned-text: #1d4ed8;
    --status-draft-bg: rgba(148, 163, 184, 0.2);
    --status-draft-text: #475569;

    /* Chart colors */
    --chart-line: #00e676;
    --chart-fill: rgba(0, 230, 118, 0.12);
    --chart-text: #475569;
    --chart-grid: rgba(148, 163, 184, 0.25);
    --chart-tooltip-bg: rgba(15, 23, 42, 0.9);
    --chart-tooltip-text: #e5e7eb;

    /* Telegram integration */
    --tg-theme-button-color: #00e676;

    /* Brand colors (aliases for consistency) */
    --ink: #111814;
    --muted: #6b7280;
    --bg: #f6f8f7;
    --surface: #ffffff;
}

/* Dark theme */
.dark {
    /* Dark theme colors */
    --brand: #13ec80;
    --brand-strong: #10b981;
    --brand-soft: rgba(19, 236, 128, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --bg-primary: #0a0c0b;
    --bg-secondary: #161b18;
    --border: rgba(255, 255, 255, 0.05);
    --border-soft: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 14px 34px -22px rgba(0, 0, 0, 0.5);

    /* Semantic colors for dark theme */
    --card-bg: #161b18;
    --card-border: rgba(255, 255, 255, 0.05);
    --btn-outline-bg: rgba(255, 255, 255, 0.05);
    --btn-outline-text: #ffffff;
    --btn-outline-border: rgba(255, 255, 255, 0.1);
    --chip-bg: rgba(255, 255, 255, 0.05);
    --chip-text: rgba(255, 255, 255, 0.9);
    --chip-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.3);
    --input-placeholder: rgba(255, 255, 255, 0.4);
    --timer-bg: rgba(255, 255, 255, 0.05);
    --timer-border: rgba(255, 255, 255, 0.1);
    --timer-text: #ffffff;
    --timer-label: rgba(255, 255, 255, 0.4);
    --segmented-bg: rgba(255, 255, 255, 0.08);
    --segmented-btn-text: rgba(255, 255, 255, 0.5);
    --segmented-active-bg: rgba(255, 255, 255, 0.1);
    --segmented-active-text: #13ec80;
    --segmented-shadow: 0 10px 20px -16px rgba(0, 0, 0, 0.3);
    --period-toggle-bg: rgba(255, 255, 255, 0.05);
    --period-toggle-text: rgba(255, 255, 255, 0.7);
    --period-toggle-border: rgba(255, 255, 255, 0.1);

    /* Status colors for dark theme */
    --status-completed-bg: rgba(19, 236, 128, 0.15);
    --status-completed-text: #86efac;
    --status-progress-bg: rgba(20, 184, 166, 0.15);
    --status-progress-text: #7ee8c3;
    --status-planned-bg: rgba(59, 130, 246, 0.15);
    --status-planned-text: #93c5fd;
    --status-draft-bg: rgba(255, 255, 255, 0.1);
    --status-draft-text: rgba(255, 255, 255, 0.6);

    /* Chart colors for dark theme */
    --chart-line: #13ec80;
    --chart-fill: rgba(19, 236, 128, 0.15);
    --chart-text: rgba(255, 255, 255, 0.7);
    --chart-grid: rgba(255, 255, 255, 0.1);
    --chart-tooltip-bg: rgba(22, 27, 24, 0.95);
    --chart-tooltip-text: #ffffff;

    /* Telegram integration */
    --tg-theme-button-color: #13ec80;

    /* Brand color aliases for consistency */
    --ink: #ffffff;
    --muted: rgba(255, 255, 255, 0.5);
    --bg: #0a0c0b;
    --surface: #161b18;
}

/* ============================================================================
   Base Styles
   ============================================================================ */

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: "Manrope", "Inter", system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

#app {
    min-height: 100vh;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ============================================================================
   Component Styles
   ============================================================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-soft);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card-soft {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 1.25rem;
}

.dark .card-soft {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: var(--brand);
    color: #0b3d22;
    border-radius: 1.25rem;
    font-weight: 700;
    box-shadow: 0 18px 32px -18px rgba(0, 230, 118, 0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dark .btn-primary {
    color: #0a0c0b;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border: 1px solid rgba(0, 195, 106, 0.25);
    border-radius: 1.25rem;
    font-weight: 600;
    transition: transform 0.15s ease;
}

.dark .btn-secondary {
    border-color: rgba(19, 236, 128, 0.25);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-outline {
    background: var(--btn-outline-bg);
    color: var(--btn-outline-text);
    border: 1px solid var(--btn-outline-border);
    border-radius: 1.25rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-text);
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #0b3d22;
}

.dark .chip.is-active {
    color: #0a0c0b;
}

.input-shell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    box-shadow: var(--input-shadow);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.input-shell input,
.input-shell select {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.input-shell input::placeholder {
    color: var(--input-placeholder);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.muted {
    color: var(--text-muted);
}

.timer-card {
    background: var(--timer-bg);
    border: 1px solid var(--timer-border);
    border-radius: 1rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    box-shadow: 0 12px 26px -20px rgba(15, 23, 42, 0.35);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.timer-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--timer-text);
    letter-spacing: 0.04em;
}

.timer-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--timer-label);
    margin-top: 0.25rem;
}

.status-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.status-completed {
    background: var(--status-completed-bg);
    color: var(--status-completed-text);
}

.status-progress {
    background: var(--status-progress-bg);
    color: var(--status-progress-text);
}

.status-planned {
    background: var(--status-planned-bg);
    color: var(--status-planned-text);
}

.status-draft {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--segmented-bg);
    padding: 0.35rem;
    border-radius: 999px;
    gap: 0.35rem;
    transition: background-color 0.2s ease;
}

.segmented button {
    border-radius: 999px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--segmented-btn-text);
    background: transparent;
    border: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.segmented button.is-active {
    background: var(--segmented-active-bg);
    color: var(--segmented-active-text);
    box-shadow: var(--segmented-shadow);
}

.period-toggle {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.period-toggle button {
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--period-toggle-bg);
    border: 1px solid var(--period-toggle-border);
    color: var(--period-toggle-text);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.period-toggle button.is-active {
    background: var(--brand-soft);
    border-color: rgba(0, 195, 106, 0.4);
    color: var(--brand-strong);
}

.dark .period-toggle button.is-active {
    border-color: rgba(19, 236, 128, 0.4);
    color: #13ec80;
}

/* Calendar view toggle buttons */
#btn-week,
#btn-twoweeks,
#btn-month {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.6rem !important;
    white-space: nowrap;
}

.segmented-compact {
    padding: 0.25rem;
    gap: 0.2rem;
}

.segmented-2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ============================================================================
   Semantic Color Utility Classes
   ============================================================================ */

/* Text colors */
.text-primary {
    color: var(--text-primary);
}

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

.text-muted {
    color: var(--text-muted);
}

.text-brand {
    color: var(--brand);
}

/* Background colors */
.bg-primary {
    background: var(--bg-primary);
}

.bg-secondary {
    background: var(--bg-secondary);
}

.bg-brand {
    background: var(--brand);
}

/* Border colors */
.border-primary {
    border-color: var(--border);
}

/* Tailwind slate color overrides for dark mode */
.dark .text-slate-500 {
    color: rgba(255, 255, 255, 0.6);
}

.dark .text-slate-400 {
    color: rgba(255, 255, 255, 0.4);
}

.dark .text-slate-600 {
    color: rgba(255, 255, 255, 0.7);
}

.dark .border-slate-200 {
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .border-slate-100 {
    border-color: rgba(255, 255, 255, 0.08);
}

.dark .hover\:text-emerald-600:hover {
    color: #13ec80;
}

.dark .text-emerald-500 {
    color: #13ec80;
}

.dark .bg-emerald-500 {
    background: #13ec80;
}

.dark .text-teal-500 {
    color: #14b8a6;
}

.dark .bg-teal-500 {
    background: #14b8a6;
}

.dark .text-slate-900 {
    color: #ffffff;
}

.dark .bg-white {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.dark .text-white {
    color: #ffffff;
}
