/* ========== Color Palette ========== */
:root {
    --ink: #12181B;
    --ink-soft: #1B2327;
    --ink-line: #2B353A;
    --paper: #FFFFFF;
    --paper-dim: #F0F2F5;
    --line: #E2E8F0;
    --text: #1E293B;
    --text-dim: #64748B;
    --theme-primary: #10B981; /* Emerald Green */
    --theme-primary-deep: #059669;
    --moss: #3B82F6; /* Blue for contrast */
    --rose: #EF4444;
    --cream: #F8FAFC;
    --time-progress: #10B981;   /* ring fill — emerald green */
    --time-track: #CBD5E1;      /* ring empty — light grey */
}

[data-theme="dark"] {
    --ink: #F8FAFC;
    --ink-soft: #F1F5F9;
    --ink-line: #E2E8F0;
    --paper: #0F172A;
    --paper-dim: #1E293B;
    --line: #334155;
    --text: #F8FAFC;
    --text-dim: #94A3B8;
    --theme-primary: #10B981; /* Green stays vibrant */
    --theme-primary-deep: #34D399; /* Lighter for dark mode contrast */
    --moss: #60A5FA;
    --rose: #F87171;
    --cream: #0B0F19; /* Very dark background */
    --time-progress: #34D399;   /* ring fill — brighter emerald for dark bg */
    --time-track: #1E293B;      /* ring empty — very dark slate */
}

/* ========== Typography ========== */
@font-face {
    font-family: 'Fraunces';
    src: local('Fraunces'), local('Fraunces');
}

@font-face {
    font-family: 'Inter';
    src: local('Inter'), local('Inter');
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: local('IBM Plex Mono'), local('IBM Plex Mono');
}

:root {
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--cream);
}

body {
    min-height: 100vh;
    display: flex;
    overflow: hidden; /* no overall scroll, layout manages it */
}

/* ========== App Container ========== */
#app {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* ========== Buttons ========== */
button {
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s, border 0.15s;
}

button:hover:not(:disabled) {
    opacity: 0.85;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

/* ========== Inputs ========== */
input {
    font-family: inherit;
    outline: none;
}

input:focus {
    border-color: var(--ember) !important;
}

/* ========== Dark Number Input Controls (Global) ========== */
input[type="number"] {
    color-scheme: dark;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    color-scheme: dark;
    background-color: transparent;
    cursor: pointer;
}


/* ========== Animations ========== */
@keyframes popCheck {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }
    60% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.72;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hx-check-on {
    animation: popCheck 0.16s ease-out;
}

.hx-flame {
    animation: flicker 2.4s ease-in-out infinite;
}

@keyframes hxRowFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hx-row-new {
    animation: hxRowFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes hxRowFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }
}

.hx-row-deleting {
    animation: hxRowFadeOut 0.22s ease-out forwards;
    pointer-events: none;
}

@keyframes hxExpandDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hx-expand-down {
    animation: hxExpandDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ========== Prefers Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== Global Custom Scrollbar Styling ========== */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #10B981 transparent;
}

/* Chrome, Edge, Safari, Opera */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #059669 0%, #10B981 50%, #14B8A6 100%);
    border-radius: 10px;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    border: 1px solid rgba(16, 185, 129, 0.2);
    transition: all 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #10B981 0%, #34D399 50%, #2DD4BF 100%);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.75);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ========== Row Hover ========== */
.hx-row:hover .hx-trash {
    opacity: 1;
}

.hx-row:hover .hx-edit {
    opacity: 1;
}

.hx-row {
    position: relative;
}

.hx-edit,
.hx-trash {
    transition: all 0.15s ease-out;
}

.hx-edit:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

.hx-trash:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}

/* ========== Utility Classes ========== */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-10 {
    gap: 10px;
}

.gap-12 {
    gap: 12px;
}

.gap-14 {
    gap: 14px;
}

.gap-16 {
    gap: 16px;
}

.gap-18 {
    gap: 18px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.hidden {
    display: none;
}

/* ========== Flip Clock Styles ========== */
.hx-flip-unit {
    position: relative;
    width: 110px;
    height: 100px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    font-family: var(--font-mono, 'IBM Plex Mono', 'JetBrains Mono', monospace);
    font-size: 58px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 400px;
    user-select: none;
}

.hx-flip-unit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    z-index: 5;
}

.hx-flip-num {
    position: relative;
    z-index: 2;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.hx-flip-unit.animate .hx-flip-num {
    animation: hxNumFlip 0.35s ease-in-out;
}

@keyframes hxNumFlip {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(-90deg);
        opacity: 0.2;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

@media (max-width: 520px) {
    .hx-flip-unit {
        width: 72px;
        height: 70px;
        font-size: 36px;
        border-radius: 10px;
    }
}

