/* Custom scrollbar for an elegant feel */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}
.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.glass-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dark .glass-header {
    background: rgba(15, 23, 42, 0.85);
}

.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* View transitions */
.view-section {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.view-section.active {
    display: flex;
    opacity: 1;
}

/* Calendar specific styles */
.event-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.event-card:hover {
    transform: scale(1.02) translateY(-2px);
    z-index: 50 !important;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
}
.dark .event-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.hour-row {
    height: 60px;
    border-bottom: 1px solid #f1f5f9;
}
.dark .hour-row {
    border-bottom: 1px solid #1e293b;
}
.hour-row:last-child {
    border-bottom: none;
}

/* OKR Timeline specific styles */
.okr-bar {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.okr-bar:hover {
    transform: translateY(-1px);
}

/* Drag & Drop */
.task-card { cursor: grab; }
.task-card:active { cursor: grabbing; }

/* Context Slider - elegant right drawer for ADHD focus */
#context-slider {
    width: 360px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px -5px rgba(0, 0, 0, 0.1);
}
.dark #context-slider {
    box-shadow: -10px 0 30px -5px rgba(0, 0, 0, 0.4);
}
#context-slider.translate-x-full {
    transform: translateX(100%);
}

/* Beautiful task rows inside slider */
.kr-task-row {
    transition: all 0.1s ease;
}
.kr-task-row:hover {
    background-color: rgba(241, 245, 249, 0.6);
}
.dark .kr-task-row:hover {
    background-color: rgba(51, 65, 85, 0.4);
}

/* Create Modal */
#create-modal {
    transition: opacity 0.2s ease;
}
#create-modal.hidden {
    display: none;
}

/* Small delightful touches */
.progress-bar {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Drop zone highlights */
.drop-active {
    border-color: #6366f1 !important;
    background-color: rgba(99, 102, 241, 0.06) !important;
}
.dark .drop-active {
    background-color: rgba(99, 102, 241, 0.12) !important;
}

/* Elevated Context Slider (right sliding) - inspired by sidebar_idea */
#context-slider {
    box-shadow: -20px 0 60px -15px rgba(0, 0, 0, 0.15);
}
.dark #context-slider {
    box-shadow: -20px 0 60px -15px rgba(0, 0, 0, 0.5);
}

#context-slider input[type="range"] {
    height: 6px;
    border-radius: 9999px;
    cursor: pointer;
}
#context-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4F47E4;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #4F47E4;
    transition: transform 0.1s ease;
}
.dark #context-slider input[type="range"]::-webkit-slider-thumb {
    background: #6b5fe6;
    border-color: #0f172a;
    box-shadow: 0 0 0 2px #6b5fe6;
}
#context-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #6b5fe6;
}

.kr-task-row {
    transition: all 0.1s ease;
}
.kr-task-row:hover {
    transform: translateY(-1px);
}
.dark .kr-task-row:hover {
    background-color: rgba(51, 65, 85, 0.6);
}

/* Placeholder for contenteditable notes in task sidebar */
.notes-editable.is-empty::before {
    content: attr(data-placeholder);
    color: #64748b; /* slate-500 */
    pointer-events: none;
    display: block;
    font-style: italic;
}
.dark .notes-editable.is-empty::before {
    color: #94a3b8; /* slate-400 */
}
.notes-editable:focus.is-empty::before {
    content: none;
}

/* Placeholder for event agenda bullets in slider */
.event-agenda-text.is-empty::before {
    content: attr(data-placeholder);
    color: #94a3b8; /* slate-400 */
    pointer-events: none;
    font-style: italic;
}
.dark .event-agenda-text.is-empty::before {
    color: #64748b;
}
.event-agenda-text:focus.is-empty::before {
    opacity: 0.55;
}

/* ========== Directions (Life Constellation) ========== */
.directions-map-bg {
    background:
        radial-gradient(ellipse 50% 40% at 15% 10%, rgba(79, 71, 228, 0.12), transparent 60%),
        radial-gradient(ellipse 45% 40% at 90% 85%, rgba(93, 217, 193, 0.1), transparent 55%),
        radial-gradient(ellipse 30% 30% at 50% 50%, rgba(189, 139, 156, 0.06), transparent 70%);
}
.dark .directions-map-bg {
    background:
        radial-gradient(ellipse 50% 40% at 15% 10%, rgba(79, 71, 228, 0.22), transparent 60%),
        radial-gradient(ellipse 45% 40% at 90% 85%, rgba(93, 217, 193, 0.12), transparent 55%),
        radial-gradient(ellipse 30% 30% at 50% 50%, rgba(139, 92, 246, 0.1), transparent 70%);
}
#directions-map {
    background-image: radial-gradient(rgba(148, 163, 184, 0.18) 1px, transparent 1px);
    background-size: 22px 22px;
}
.dark #directions-map {
    background-image: radial-gradient(rgba(71, 85, 105, 0.45) 1px, transparent 1px);
}
.dir-node {
    touch-action: none;
    user-select: none;
}

/* Orbit avatar ring glow — tight around the circle, light diffusion */
@keyframes orbitGlowGreen {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
        box-shadow:
            0 0 0 2px rgba(16, 185, 129, 0.55),
            0 0 8px 2px rgba(16, 185, 129, 0.45),
            0 0 14px 3px rgba(16, 185, 129, 0.22);
    }
    50% {
        opacity: 1;
        transform: scale(1.04);
        box-shadow:
            0 0 0 2px rgba(52, 211, 153, 0.7),
            0 0 10px 3px rgba(16, 185, 129, 0.55),
            0 0 16px 4px rgba(16, 185, 129, 0.28);
    }
}
@keyframes orbitGlowYellow {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
        box-shadow:
            0 0 0 2px rgba(245, 158, 11, 0.55),
            0 0 8px 2px rgba(245, 158, 11, 0.45),
            0 0 14px 3px rgba(245, 158, 11, 0.22);
    }
    50% {
        opacity: 1;
        transform: scale(1.04);
        box-shadow:
            0 0 0 2px rgba(251, 191, 36, 0.7),
            0 0 10px 3px rgba(245, 158, 11, 0.55),
            0 0 16px 4px rgba(245, 158, 11, 0.28);
    }
}
@keyframes orbitGlowRed {
    0%, 100% {
        opacity: 0.92;
        transform: scale(1);
        box-shadow:
            0 0 0 2px rgba(239, 68, 68, 0.6),
            0 0 8px 2px rgba(239, 68, 68, 0.48),
            0 0 14px 3px rgba(239, 68, 68, 0.24);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
        box-shadow:
            0 0 0 2px rgba(248, 113, 113, 0.75),
            0 0 10px 3px rgba(239, 68, 68, 0.58),
            0 0 16px 4px rgba(239, 68, 68, 0.3);
    }
}
.orbit-pulse {
    border: none;
    background: transparent;
    pointer-events: none;
    /* Match avatar size so glow hugs the circle */
    inset: 0 !important;
    border-radius: 9999px;
}
.orbit-pulse-green {
    animation: orbitGlowGreen 2.8s ease-in-out infinite;
}
.orbit-pulse-yellow {
    animation: orbitGlowYellow 2.4s ease-in-out infinite;
}
.orbit-pulse-red {
    animation: orbitGlowRed 2s ease-in-out infinite;
}

/* ========== People contact (message / call) — teal accent ========== */
.people-contact-btn {
    position: relative;
    color: inherit;
    transform: scale(1);
    transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.people-contact-btn:active {
    transform: scale(0.9);
}
.people-contact-btn.people-contact-active {
    border-color: rgba(93, 217, 193, 0.65);
    color: #5dd9c1;
    background: rgba(93, 217, 193, 0.14);
    box-shadow: 0 0 0 3px rgba(93, 217, 193, 0.18);
}
.dark .people-contact-btn.people-contact-active {
    border-color: rgba(93, 217, 193, 0.55);
    color: #7ee3d0;
    background: rgba(93, 217, 193, 0.16);
    box-shadow: 0 0 0 3px rgba(93, 217, 193, 0.14);
}
@keyframes peopleContactPress {
    0%   { transform: scale(1); }
    35%  { transform: scale(0.86); }
    70%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}
.people-contact-btn.people-contact-press {
    animation: peopleContactPress 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.people-contact-btn.people-contact-press::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 0.9rem;
    border: 2px solid rgba(93, 217, 193, 0.55);
    animation: peopleContactRing 0.45s ease-out forwards;
    pointer-events: none;
}
@keyframes peopleContactRing {
    0%   { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.25); opacity: 0; }
}

/* ========== Habits Realm (Snail tracker) ========== */
.habits-table {
    border-collapse: collapse;
    border: 1px solid #e2e8f0; /* slate-200 */
    font-size: 0.8125rem;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    overflow: hidden;
    border-radius: 0.75rem;
    width: 100%;
}
.dark .habits-table {
    border-color: #334155; /* slate-700 */
}

.habits-th {
    border: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    text-align: center;
    color: #64748b; /* slate-500 */
    background: #f8fafc; /* slate-50 */
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.dark .habits-th {
    border-color: #334155;
    color: #94a3b8;
    background: #1e293b;
}

.habits-cell {
    border: 1px solid #e2e8f0;
    height: 2rem;
    vertical-align: middle;
}
.dark .habits-cell {
    border-color: #334155;
}

.habits-yesno {
    min-width: 3.5rem;
}

.habits-yes-mark {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #4f47e4;
    letter-spacing: 0.02em;
}
.dark .habits-yes-mark {
    color: #818cf8;
}
.habits-yes-mark-on-fill {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}
.dark .habits-yes-mark-on-fill {
    color: #ffffff;
}

.habits-input {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #334155; /* slate-700 */
}
.habits-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}
.habits-input:focus {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 0.25rem;
    box-shadow: inset 0 0 0 1px rgba(79, 71, 228, 0.35);
}
.dark .habits-input {
    color: #f1f5f9;
}
.dark .habits-input::placeholder {
    color: rgba(241, 245, 249, 0.45);
}

/* foreignObject daily name inputs */
.habits-fo-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
.habits-daily-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 0 6px;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    font-style: normal !important;
}
/* Saturated row fills: white text */
.habits-daily-input-on-fill {
    color: #ffffff !important;
    font-weight: 600 !important;
}
.habits-daily-input-on-fill::placeholder {
    color: rgba(255, 255, 255, 0.55) !important;
}
.habits-daily-input-on-fill:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* Weekly checks grid */
.habits-week-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 2rem;
    min-width: 5.5rem;
}
.habits-week-check {
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #e2e8f0; /* match table cell borders */
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.12s ease;
}
.habits-week-check:last-child {
    border-right: none;
}
.dark .habits-week-check {
    border-right-color: #334155; /* slate-700 — same as .habits-cell in dark */
}
.habits-week-check:hover {
    background: rgba(255, 255, 255, 0.18);
}
.habits-week-check.is-on {
    background: rgba(15, 23, 42, 0.2);
}
.habits-week-check-on-fill {
    color: #ffffff;
}

.habits-snail-inner {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
}
.habits-snail-svg {
    display: block;
    max-width: 100%;
    height: auto;
    overflow: hidden; /* never paint over monthly tables above */
}

.habits-arc-path {
    transition: opacity 0.12s ease, filter 0.12s ease;
}
.habits-cell-hit:hover .habits-arc-path {
    opacity: 0.92;
    filter: brightness(1.08) saturate(1.08);
}

/* Current day column in the snail */
.habits-today-cell {
    filter: brightness(1.06) saturate(1.05);
}
.habits-today-label {
    /* brand fill applied inline; keep edges crisp */
}

/* Tick: cell brightens in place (filter only — no transform) */
@keyframes habitsCellFlash {
    0%   { filter: brightness(2.1) saturate(1.5); }
    35%  { filter: brightness(1.55) saturate(1.35); }
    100% { filter: brightness(1) saturate(1); }
}
.habits-cell-flash {
    animation: habitsCellFlash 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.habits-tool-btn {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    border-radius: 0.75rem;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    background: transparent;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.dark .habits-tool-btn {
    border-color: #475569;
    color: #94a3b8;
}
.habits-tool-btn:hover {
    color: #4F47E4;
    border-color: rgba(79, 71, 228, 0.5);
    background: rgba(79, 71, 228, 0.06);
}
.habits-tool-primary {
    border-style: solid;
    border-color: #4F47E4;
    color: #4F47E4;
    background: rgba(79, 71, 228, 0.08);
}
.habits-tool-primary:hover {
    background: rgba(79, 71, 228, 0.14);
    color: #4339d1;
    border-color: #4339d1;
}
.dark .habits-tool-primary {
    border-color: #818cf8;
    color: #a5b4fc;
    background: rgba(79, 71, 228, 0.15);
}
.habits-tool-muted:hover {
    color: #e11d48;
    border-color: rgba(225, 29, 72, 0.4);
    background: rgba(225, 29, 72, 0.05);
}

/* Custom scrollbar for slider content */
#slider-content {
    scrollbar-width: thin;
}

/* Satisfying checkboxes for task completion (calm + rewarding) */
input[type="checkbox"] {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
input[type="checkbox"]:checked {
    accent-color: #059669;
}
.daily-todo-item input[type="checkbox"]:checked {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
