/* Clean, modern, and lint-safe stylesheet for Pomato */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
/* Final clean stylesheet for Pomato (no duplicates) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    --bg-0: #0b0f14;
    --bg-1: #0f1720;
    --card: rgba(255,255,255,0.04);
    --muted: #9fb7d6;
    --accent: #ff6b6b;
    --accent-2: #ff5252;
    --app-padding: 26px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    /* background is driven by a CSS variable so we can swap themes per-mode */
    --app-bg: radial-gradient(700px 350px at 10% 10%, rgba(255,107,107,0.03), transparent 6%), radial-gradient(600px 300px at 90% 90%, rgba(66,153,225,0.02), transparent 6%), linear-gradient(180deg, var(--bg-1), var(--bg-0));
    background: var(--app-bg);
    color: #e6eef8;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* stack header above #app */
    align-items: center;
    justify-content: center;
}

/* Mode-specific backgrounds and accent colors */
body.mode-work {
    --app-bg: radial-gradient(700px 360px at 8% 8%, rgba(255,80,80,0.04), transparent 6%), radial-gradient(600px 320px at 92% 92%, rgba(20,30,40,0.03), transparent 6%), linear-gradient(180deg,#071018,#0b0f14);
    --accent: #ff6b6b;
    --accent-2: #ff5252;
    --muted: #9fb7d6;
}

body.mode-short-break {
    --app-bg: radial-gradient(700px 360px at 10% 12%, rgba(255,170,90,0.035), transparent 6%), radial-gradient(600px 320px at 88% 88%, rgba(40,60,80,0.03), transparent 6%), linear-gradient(180deg,#0a1720,#0f1a24);
    --accent: #ff9f43;
    --accent-2: #ff7a24;
    --muted: #b9d0e6;
}

body.mode-long-break {
    --app-bg: radial-gradient(700px 360px at 12% 14%, rgba(90,220,160,0.03), transparent 6%), radial-gradient(600px 320px at 84% 84%, rgba(30,60,70,0.02), transparent 6%), linear-gradient(180deg,#0b1a18,#0f2320);
    --accent: #6be1a5;
    --accent-2: #3bd08a;
    --muted: #cfeee0;
}

.app-wrap, #app { width: 100%; max-width: 820px; padding: var(--app-padding); }
.panel { background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border: 1px solid rgba(255,255,255,0.04); border-radius: 14px; padding: 24px; box-shadow: 0 14px 40px rgba(2,6,23,0.6); }

/* place header above the app content and center it */
header { position: relative; top: auto; left: auto; width: 100%; margin-bottom: 12px; display: flex; justify-content: center; z-index: 30; }
/* ensure header content lines up with #app by matching its max-width and left padding */
header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1px;
    font-weight: 800;
    color: #fff;
    max-width: 820px;
    width: 100%;
    padding-left: 0; /* header-inner handles the app-aligned padding */
    box-sizing: border-box;
    justify-content: flex-start; /* left-align inside the centered header */
}

/* Header: inner container to align title and actions */
.header-inner { width: 100%; max-width: 820px; padding-left: var(--app-padding); box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; }
.header-inner h1 { margin: 0; display:flex; align-items:center; gap:1px; font-weight:800; color:#fff; }
.header-actions { display:flex; gap:8px; align-items:center; }

/* Help button in header */
.help-btn { border-radius: 10px; padding: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02)); color: var(--muted); border: 1px solid rgba(255,255,255,0.04); cursor: pointer; }
.help-btn:hover { transform: translateY(-3px) scale(1.04); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.45); }

/* Info button style (next to log) */
/* .info-btn removed */

/* Styled keycaps for the shortcuts modal */
.shortcuts-kbd { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; }
.shortcuts-kbd kbd { background: rgba(255,255,255,0.04); color: #eaf3ff; padding:6px 8px; border-radius:6px; font-weight:700; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); }

.tabs { display: inline-flex; gap: 8px; padding: 6px; border-radius: 999px; margin-bottom: 20px; }
.tabs button { background: transparent; border: none; color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; transition: all 180ms ease; }
.tabs button.active { background: linear-gradient(90deg, rgba(255,107,107,0.12), rgba(255,82,82,0.08)); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.45); }

.timer { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.time-display { font-size: 13rem; line-height: 1; font-weight: 800; color: #fff; text-shadow: 0 8px 30px rgba(2,6,23,0.6); }
.status { font-size: 1rem; color: var(--muted); opacity: 0.95; }

.controls { display: flex; gap: 12px; margin-top: 8px; }
.controls button { padding: 10px 18px; border-radius: 999px; border: none; color: #fff; background: linear-gradient(90deg, var(--accent), var(--accent-2)); cursor: pointer; font-weight: 700; box-shadow: 0 10px 30px rgba(255,82,82,0.08); transition: transform 140ms ease; }
.controls button:disabled { background: linear-gradient(90deg,#333,#222); opacity: .6; cursor: not-allowed; }
.controls button:hover:not(:disabled) { transform: translateY(-3px); }

.icon-btn { background: transparent; border: 1px solid rgba(255,255,255,0.04); color: var(--muted); padding: 8px; border-radius: 10px; cursor: pointer; transition: transform 120ms ease; }
.icon-btn:hover { transform: translateY(-2px); color: #fff; }

/* richer hover for icon buttons */
.icon-btn:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 30px rgba(0,0,0,0.45); }

/* Modal open animation: modal content is hidden by default then shown when inside a .modal */
.modal-content { opacity: 0; transform: translateY(8px) scale(0.996); transition: opacity 360ms ease, transform 360ms ease; }
.modal .modal-content, .modal.show .modal-content, .modal-content.log-modal, .modal-content.dashboard-modal { opacity: 1; transform: translateY(0) scale(1); }

/* Panels fade/slide in inside dashboard */
.dashboard-modal .panel { opacity: 0; transform: translateY(6px); transition: opacity 420ms ease, transform 420ms ease; }
.dashboard-modal .panel:nth-child(1) { transition-delay: 80ms; }
.dashboard-modal .panel:nth-child(2) { transition-delay: 160ms; }
.dashboard-modal .panel:nth-child(3) { transition-delay: 240ms; }
.dashboard-modal .panel { opacity: 1; transform: translateY(0); }

/* Chart appear animation */
.chart-appear { animation: chartFade 420ms cubic-bezier(.2,.9,.3,1) both; }
@keyframes chartFade { from { opacity: 0; transform: translateY(6px) scale(0.998); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Log items subtle entrance */
.log-item { transform: translateY(0); transition: transform 260ms ease, opacity 260ms ease; opacity: 1; }
.log-item.enter { transform: translateY(6px); opacity: 0; }

.modal { position: fixed; inset: 0; background: rgba(4,6,10,0.78); backdrop-filter: blur(14px) saturate(140%); display: flex; align-items: center; justify-content: center; padding: 28px; z-index: 9999; }
.modal-content {
    position: relative;
    background: linear-gradient(180deg, rgba(12,14,18,0.72), rgba(8,10,14,0.6));
    border-radius: 14px;
    padding: 22px 22px 20px 22px;
    padding-top: 52px; /* leave space for close button */
    border: 1px solid rgba(255,255,255,0.06);
    max-width: 720px;
    width: 100%;
    box-shadow: 0 30px 80px rgba(2,6,23,0.8), inset 0 -8px 24px rgba(255,255,255,0.01);
    backdrop-filter: blur(10px) saturate(140%);
}
.modal-content h2 { margin: 0 0 12px 0; color: #fff; font-size: 1.15rem; }
.modal-content p { margin: 6px 0 12px 0; color: var(--muted); }
.modal-content label { display: block; margin: 10px 0 6px; color: var(--muted); }
.modal-content input[type="text"], .modal-content input[type="number"], .modal-content textarea, .modal-content select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    color: #eaf3ff;
    margin-top: 6px;
    outline: none;
    transition: box-shadow 150ms ease, transform 120ms ease;
}

/* Range slider styling */
.modal-content input[type="range"] {
    width: 100%;
    margin-top: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    height: 28px;
    position: relative;
    z-index: 2;
}
.modal-content input[type="range"]:focus { outline: none; }
.modal-content input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(90deg,var(--accent),var(--accent-2));
    border-radius: 999px;
}
.modal-content input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    margin-top: -5px;
}
.modal-content input[type="range"]::-moz-range-track { height: 8px; background: linear-gradient(90deg,var(--accent),var(--accent-2)); border-radius: 999px; }
.modal-content input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.4); border: none; }

.range-row { display:flex; align-items:center; gap:12px; flex-direction:column; text-align:left; }
.range-row .range-value { font-weight:700; color:var(--muted); background: rgba(255,255,255,0.02); padding:6px 8px; border-radius:8px; margin-left:auto; }
.range-row { width:100%; }
.range-row > input { width:100%; }

/* Decorative track: base thin track plus a thicker blurred overlay at the right end */
.range-row { position: relative; padding-top: 10px; }
.range-row::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%; transform: translateY(-50%);
    height: 8px; border-radius: 999px;
    background: rgba(255,255,255,0.03);
    pointer-events: none;
}

.range-row::after {
    content: '';
    position: absolute;
    right: 0; top: 50%; transform: translateY(-50%);
    width: 48%; height: 14px; border-radius: 999px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(0,0,0,0.02));
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    filter: blur(6px); opacity: 0.55; pointer-events: none;
}

/* Use the accent color to tint the right overlay (gives the thicker-to-right visual) */
.range-row .track-tint {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 0%; height: 12px; border-radius: 999px; pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0.02), var(--accent));
    filter: blur(6px);
    opacity: 0.95;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 0 36px rgba(0,0,0,0.08) inset;
    transition: width 420ms cubic-bezier(.2,.9,.3,1), background 320ms ease, box-shadow 320ms ease;
    z-index: 1;
}

/* Make the native track transparent so decorative layers show through */
.modal-content input[type="range"]::-webkit-slider-runnable-track { background: transparent; }
.modal-content input[type="range"]::-moz-range-track { background: transparent; }

/* Thumb and badge animations */
.modal-content input[type="range"]::-webkit-slider-thumb { transition: transform 120ms ease, box-shadow 120ms ease; }
.modal-content input[type="range"]::-moz-range-thumb { transition: transform 120ms ease, box-shadow 120ms ease; }
.modal-content input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 14px 34px rgba(0,0,0,0.45); }
.modal-content input[type="range"]:active::-moz-range-thumb { transform: scale(1.12); box-shadow: 0 14px 34px rgba(0,0,0,0.45); }

/* Value badge pops when slider is focused/active */
.modal-content input[type="range"]:focus + .range-value,
.modal-content input[type="range"]:active + .range-value {
    transform: translateY(-6px) scale(1.06);
    transition: transform 140ms ease, color 120ms ease, background 180ms ease;
    color: #fff;
    background: linear-gradient(90deg,var(--accent),var(--accent-2));
    box-shadow: 0 8px 26px rgba(0,0,0,0.32);
}
.modal-content input:focus, .modal-content textarea:focus, .modal-content select:focus {
    box-shadow: 0 8px 36px rgba(0,0,0,0.6);
    transform: translateY(-2px);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-content .btn { padding: 10px 18px; border-radius: 999px; border: none; cursor: pointer; font-weight: 700; font-size: 0.95rem; }
.modal-content .btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 12px 36px rgba(255,82,82,0.12); }
.modal-content .btn.primary:hover { transform: translateY(-3px); }
.modal-content .btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.06); color: var(--muted); }
.modal-content .btn.ghost:hover { color: #fff; border-color: rgba(255,255,255,0.12); transform: translateY(-2px); }

/* Make the close button consistent with modal actions */
.close-btn { position: absolute; top: 14px; right: 14px; padding: 8px 12px; border-radius: 10px; background: linear-gradient(90deg,#f44336,#d32f2f); color: #fff; border: none; cursor: pointer; box-shadow: 0 8px 24px rgba(212,63,63,0.12); }
.close-btn:hover { transform: translateY(-3px); }
.dashboard-modal canvas { width: 100% !important; height: 260px !important; }

.log-list { max-height: 420px; overflow-y: auto; margin-top: 12px; padding-right: 6px; }
.log-entry { background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: 10px; border-left: 4px solid var(--accent); display: flex; flex-direction: column; }
.log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.log-status { font-weight: 700; padding: 6px 10px; border-radius: 999px; font-size: 0.78rem; }
.log-status.completed { background: rgba(76,175,80,0.12); color: #bff0c8; }
.log-status.paused { background: rgba(255,107,107,0.08); color: #ffd4d4; }
.log-details { color: var(--muted); font-size: 0.92rem; display: flex; gap: 12px; flex-wrap: wrap; }
.segment-pill { background: rgba(255,255,255,0.02); color: #eaf3ff; padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; }

.progress-bar { height: 12px; background: rgba(255,255,255,0.02); border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,0.03); }
.progress { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 360ms cubic-bezier(.2,.9,.3,1); }
.progress-text { font-size: .82rem; color: #fff; font-weight: 700; position: relative; display: inline-block; margin-top: 8px; }

.save-btn { /* map common modal save button to primary appearance */
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 30px rgba(255,82,82,0.08);
}
.save-btn:hover { transform: translateY(-3px); }
.cancel-btn { /* map cancel to ghost */
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.cancel-btn:hover { color: #fff; border-color: rgba(255,255,255,0.12); transform: translateY(-2px); }
.no-data { color: var(--muted); font-style: italic; text-align: center; padding: 18px 0; }

/* hide native scrollbar while preserving scroll */
.log-list { -ms-overflow-style: none; scrollbar-width: none; }
.log-list::-webkit-scrollbar { display: none; height: 0; width: 0; }

/* Utilities */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--accent); animation: spin 1s linear infinite; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive tweaks */
@media (max-width: 720px) {
    .time-display { font-size: 4.6rem; }
    .tabs { gap: 6px; }
    .controls { gap: 8px; }
    .modal-content { padding: 16px; }
    :root { --app-padding: 16px; }

/* Activity log: make each entry a readable two-column card */
.log-list { display: flex; flex-direction: column; gap: 12px; padding: 8px; }
.log-list::-webkit-scrollbar { height: 8px; display: none; }

.log-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    backdrop-filter: blur(6px) saturate(120%);
}

.log-item .meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}
.log-item .meta .title { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-item .meta .time { font-size: 0.88em; color: var(--muted); }

.log-item .details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 110px;
}
.log-item .details .duration { font-weight: 600; color: var(--accent); }

.segment-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.segment-chip {
    background: linear-gradient(90deg, var(--accent), rgba(255,255,255,0.06));
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78em;
    line-height: 1;
}

@media (max-width: 520px) {
    .log-item { grid-template-columns: 1fr; align-items: flex-start; }
    .log-item .details { align-items: flex-start; width: 100%; }
    .segment-chips { justify-content: flex-start; max-width: 100%; }
}
}

@media (max-width: 600px) {
    :root { --app-padding: 10px; }
    #app { max-width: 100%; }
    header { margin-bottom: 10px; }
    header h1 { font-size: 1.2em; padding-left: 12px; }
    .time-display { font-size: 4em; }
    .tabs { margin-bottom: 15px; }
    .tabs button { padding: 6px 12px; font-size: 0.8em; }
    .controls button { padding: 8px 14px; font-size: 0.9em; }
    .modal-content { padding: 25px; max-width: 90%; }
    .modal-content.dashboard-modal { max-width: 95%; }
    .modal-content.dashboard-modal #chart,
    .modal-content.dashboard-modal #lineChart { height: 200px; }
}

@media (max-width: 480px) {
    header h1 { font-size: 1em; }
    .time-display { font-size: 3em; }
    .tabs button { padding: 5px 10px; font-size: 0.7em; }
    .controls button { padding: 6px 12px; font-size: 0.8em; }
    .modal-content { padding: 20px; }
}


@media (max-width: 480px) {
    header h1 {
        font-size: 1em;
    }
    .time-display {
        font-size: 3em;
    }
    .tabs button {
        padding: 5px 10px;
        font-size: 0.7em;
    }
    .settings {
        gap: 3px;
    }
    .icon-btn {
        padding: 5px;
    }
    .controls button {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    .modal-content {
        padding: 20px;
    }
    .modal-content h2 {
        font-size: 1.2em;
    }
    .modal-content label {
        font-size: 0.9em;
    }
    .modal-content input {
        padding: 10px;
    }
    .modal-content button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}