/* ===========================================
   3. APP COMPONENTS (Complete)
   =========================================== */

/* --- APP SHELL & LAYOUT --- */
.app-shell {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--card);
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Desktop: Centered container with comfortable max-width */
@media (min-width: 768px) {
    .app-shell {
        max-width: 600px;
        margin: 0 auto;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
    }
}

.content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: padding-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    contain: layout style paint;
    /* Helps contain shadows and effects */
    /* Allow content to scroll under fixed dock - no extra padding needed */
    padding-bottom: 16px;
    /* Just normal padding, dock is fixed so content scrolls under */
}

/* Desktop: Slightly increased padding while keeping compact */
@media (min-width: 768px) {
    .content {
        padding: 20px 24px;
    }
}

/* --- HEADER --- */
.app-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

/* Desktop: Slightly increased header padding */
@media (min-width: 768px) {
    .app-header {
        padding: 18px 24px;
    }
}

.brand {
    font-family: 'Fredoka', sans-serif;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Brand subtitle - hide on narrow screens (iPhones) */
.brand-subtitle {
    display: block;
}

@media (max-width: 360px) {
    .brand-subtitle {
        display: none;
    }
}

/* Desktop: Larger brand text */
@media (min-width: 768px) {
    .brand {
        font-size: 24px;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Desktop: More spacing in header */
@media (min-width: 768px) {
    .header-right {
        gap: 20px;
    }
}

.status-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
    position: relative;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.xp-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.xp-bar-bg {
    width: 80px;
    height: 4px;
    background: var(--input-bg);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff9f43);
    transition: width 0.3s ease;
}

/* --- NAVIGATION (Clean Dock) --- */
/* Note: Most styling is handled inline in the component for flexibility */
.nav-bar {
    /* Base styles - component handles most styling inline */
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Light theme adjustments */
[data-theme="light"] .nav-bar {
    background: rgba(255, 255, 255, 0.9) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.nav-item {
    width: 65px;
}

.nav-icon {
    font-size: 22px;
}
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-light);
    font-size: 9px;
    cursor: pointer;
    width: 60px;
    height: 100%;
    opacity: 0.5;
    filter: grayscale(100%);
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
    opacity: 1;
    filter: none;
    transform: scale(1.05);
}

.nav-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
}

.nav-item span:last-child {
    display: block;
    opacity: inherit;
}

/* --- TASKS --- */
.task-row {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    gap: 14px;
    background: var(--card);
    cursor: pointer;
    touch-action: pan-y;
    transition: background 0.2s;
}

/* Desktop: Subtle hover improvement */
@media (min-width: 768px) {
    .task-row:hover {
        background: var(--input-bg);
    }
}

.task-row:active {
    background: var(--input-bg);
}

/* --- REUSABLE BUTTON COMPONENT --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md, 8px);
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
    user-select: none;
    line-height: 1;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn:disabled,
.btn-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.btn:active {
    transform: scale(0.97);
}

/* SIZES */
.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-xs);
    height: 28px;
}

.btn-md {
    padding: 10px 20px;
    font-size: var(--text-sm);
    height: 40px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: var(--text-base);
    height: 50px;
}

.btn-icon {
    padding: 10px;
    width: 40px;
    height: 40px;
}

.btn-full {
    width: 100%;
    display: flex;
}

/* SPINNER & ICON */
.btn-spinner {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.btn span.btn-icon {
    margin-right: 8px;
    display: flex;
    align-items: center;
}

/* VARIANTS - SOLID */
.btn-solid.btn-color-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-solid.btn-color-primary:hover {
    background: var(--primary-hover);
}

.btn-solid.btn-color-secondary {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-solid.btn-color-secondary:hover {
    background: var(--border);
}

.btn-solid.btn-color-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 10px var(--success-glow);
}

.btn-solid.btn-color-success:hover {
    background: var(--success-hover);
}

.btn-solid.btn-color-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 10px var(--danger-light);
}

.btn-solid.btn-color-danger:hover {
    background: var(--danger-hover);
}

.btn-solid.btn-color-warning {
    background: var(--warning);
    color: black;
    box-shadow: 0 4px 10px var(--warning-light);
}

.btn-solid.btn-color-warning:hover {
    background: var(--warning-hover);
}

.btn-solid.btn-color-info {
    background: var(--info);
    color: white;
    box-shadow: 0 4px 10px var(--info-light);
}

.btn-solid.btn-color-info:hover {
    background: var(--info-hover);
}

.btn-solid.btn-color-special {
    background: linear-gradient(135deg, var(--info), var(--primary));
    color: white;
}

.btn-solid.btn-color-special:hover {
    opacity: 0.9;
}

/* VARIANTS - OUTLINE */
.btn-outline.btn-color-primary {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline.btn-color-primary:hover {
    background: var(--primary-light);
}

.btn-outline.btn-color-secondary {
    border-color: var(--border);
    color: var(--text-light);
    background: transparent;
}

.btn-outline.btn-color-secondary:hover {
    background: var(--input-bg);
    color: var(--text);
}

.btn-outline.btn-color-success {
    border-color: var(--success);
    color: var(--success);
    background: transparent;
}

.btn-outline.btn-color-success:hover {
    background: var(--success-light);
}

.btn-outline.btn-color-danger {
    border-color: var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-outline.btn-color-danger:hover {
    background: var(--danger-light);
}

/* VARIANTS - GHOST */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.btn-ghost.btn-color-primary {
    color: var(--primary);
}

.btn-ghost.btn-color-primary:hover {
    background: var(--primary-light);
}

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

.btn-ghost.btn-color-secondary:hover {
    background: var(--input-bg);
    color: var(--text);
}

.btn-ghost.btn-color-danger {
    color: var(--danger);
}

.btn-ghost.btn-color-danger:hover {
    background: var(--danger-light);
}

/* LEGACY COMPATIBILITY (Refactored) */
/* Task Checkbox - Custom styled circular checkbox */
.task-check {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.task-check:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb, 255, 107, 53), 0.1);
}

.task-check:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.task-check:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.task-check:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 255, 107, 53), 0.2);
}

/* --- VIEW SWITCHER & SEGMENTED CONTROL --- */
.view-switcher {
    display: flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
}

.vs-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.vs-btn.active {
    background: var(--bg);
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Segmented Control */
.segmented-control {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    margin: 12px 0 16px;
    overflow: hidden;
}

.sc-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-family: inherit;
    font-weight: 800;
    font-size: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    line-height: 1;
    flex: 1;
    min-width: 0;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.sc-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

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

.sc-btn.active {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

[data-theme="light"] .segmented-control {
    background: #f2f2f2;
}

[data-theme="light"] .sc-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

[data-theme="light"] .sc-btn.active {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* --- CALENDAR --- */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.cal-day.has-tasks {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.05);
}

/* --- GOALS --- */
.goal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.goal-card:hover {
    background: var(--input-bg);
}

.goal-progress-bar {
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
    transition: width 0.4s ease;
}

/* Desktop: Subtle improvements to goal cards */
@media (min-width: 768px) {
    .goal-card {
        border-radius: 14px;
    }
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s;
}

/* Light theme modal overlay */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    background: var(--card);
    width: 95%;
    max-width: 480px;
    border-radius: 20px;
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
    z-index: var(--z-modal);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Hide webkit scrollbar for modal */
.modal::-webkit-scrollbar {
    display: none;
}

/* Desktop: Slightly larger modals */
@media (min-width: 768px) {
    .modal {
        max-width: 550px;
        padding: 28px;
    }
}

/* Global Add Drawer */
.global-add-drawer {
    background: var(--card);
    border-bottom: 2px solid var(--primary);
    padding: 16px;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideDownDrawer 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Desktop: Drawer stays aligned with app shell */
@media (min-width: 768px) {
    .global-add-drawer {
        max-width: 600px;
        border-radius: 0 0 12px 12px;
    }
}

@keyframes slideDownDrawer {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* --- TUMBLER & SPIN --- */
/* Motion blur applied to scrolling strip - vertical directional blur */
.tumbler-strip-spinning {
    filter: url(#motion-blur-vertical);
    will-change: transform, filter;
    transition: filter 0.3s ease-out;
}

.tumbler-strip-spinning-fast {
    filter: url(#motion-blur-vertical-strong);
}

.tumbler-box {
    position: relative;
    height: 200px;
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--tumbler-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Top and bottom blur masks for tumbler */
.tumbler-box::before,
.tumbler-box::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 55px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tumbler-box::before {
    top: 0;
    background: linear-gradient(to bottom,
            var(--card) 0%,
            color-mix(in srgb, var(--card) 95%, transparent) 40%,
            color-mix(in srgb, var(--card) 80%, transparent) 70%,
            transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    mask: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.95) 20%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
    -webkit-mask: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.95) 20%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
    border-radius: 12px 12px 0 0;
}

.tumbler-box::after {
    bottom: 0;
    background: linear-gradient(to top,
            var(--card) 0%,
            color-mix(in srgb, var(--card) 95%, transparent) 40%,
            color-mix(in srgb, var(--card) 80%, transparent) 70%,
            transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    mask: linear-gradient(to top, black 0%, rgba(0, 0, 0, 0.95) 20%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
    -webkit-mask: linear-gradient(to top, black 0%, rgba(0, 0, 0, 0.95) 20%, rgba(0, 0, 0, 0.7) 60%, transparent 100%);
    border-radius: 0 0 12px 12px;
}

/* Fallback for browsers that don't support color-mix */
@supports not (color-mix(in srgb, var(--card) 85%, transparent)) {
    .tumbler-box::before {
        background: linear-gradient(to bottom,
                var(--card) 0%,
                rgba(30, 30, 30, 0.95) 40%,
                rgba(30, 30, 30, 0.8) 70%,
                rgba(30, 30, 30, 0.4) 85%,
                transparent 100%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .tumbler-box::after {
        background: linear-gradient(to top,
                var(--card) 0%,
                rgba(30, 30, 30, 0.95) 40%,
                rgba(30, 30, 30, 0.8) 70%,
                rgba(30, 30, 30, 0.4) 85%,
                transparent 100%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    [data-theme="light"] .tumbler-box::before {
        background: linear-gradient(to bottom,
                var(--card) 0%,
                rgba(255, 255, 255, 0.95) 40%,
                rgba(255, 255, 255, 0.8) 70%,
                rgba(255, 255, 255, 0.4) 85%,
                transparent 100%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    [data-theme="light"] .tumbler-box::after {
        background: linear-gradient(to top,
                var(--card) 0%,
                rgba(255, 255, 255, 0.95) 40%,
                rgba(255, 255, 255, 0.8) 70%,
                rgba(255, 255, 255, 0.4) 85%,
                transparent 100%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

.tumbler-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 50px;
    transform: translateY(-50%);
    border-top: 2px solid var(--tumbler-highlight);
    border-bottom: 2px solid var(--tumbler-highlight);
    pointer-events: none;
    z-index: 10;
    background: rgba(255, 255, 255, 0.05);
    /* Softer overlay - no blur, just subtle darkening */
    box-shadow:
        0 0 20px rgba(255, 107, 53, 0.15),
        0 0 0 999px rgba(18, 18, 18, 0.3);
    transition: box-shadow 0.3s ease;
    /* Ensure no blur filters on the highlight itself */
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Ensure items in the highlight zone are never blurred */
.tumbler-box .tumbler-strip-spinning>div,
.tumbler-box .tumbler-strip-spinning-fast>div,
.tumbler-box>div>div {
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.tumbler-highlight::before {
    content: '▶';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tumbler-highlight);
    font-size: 20px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.tumbler-highlight::after {
    content: '◀';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tumbler-highlight);
    font-size: 20px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Light theme tumbler highlights */
[data-theme="light"] .tumbler-highlight::before,
[data-theme="light"] .tumbler-highlight::after {
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.6), 0 0 20px rgba(255, 107, 53, 0.3);
}

.tumbler-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    will-change: transform;
    transform: translateZ(0);
}

.t-item {
    height: 50px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-weight: 600;
    color: var(--text);
    opacity: 0.8;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.t-tag {
    background: var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
}

.spin-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    cursor: pointer;
    transition: transform 0.1s;
}

.spin-btn:active {
    transform: scale(0.96);
}

.spin-btn:disabled {
    background: #555;
    box-shadow: none;
    cursor: not-allowed;
}

.timer-btn {
    background: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #111;
}

/* --- DUEL / FIGHTERS --- */
.duel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    gap: 20px;
    position: relative;
    padding: 40px 0;
    overflow: visible;
    /* Allow fighters to animate outside bounds */
    contain: none;
    /* Don't contain effects - allow overflow */
}

/* Screen Shake Effect */
.duel-container.screen-shake {
    animation: screenShake 0.3s ease-out;
}

@keyframes screenShake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-2px, -1px) rotate(-0.5deg);
    }

    20% {
        transform: translate(2px, 1px) rotate(0.5deg);
    }

    30% {
        transform: translate(-1px, 2px) rotate(-0.3deg);
    }

    40% {
        transform: translate(1px, -2px) rotate(0.3deg);
    }

    50% {
        transform: translate(-2px, 1px) rotate(-0.2deg);
    }

    60% {
        transform: translate(2px, -1px) rotate(0.2deg);
    }

    70% {
        transform: translate(-1px, -1px) rotate(-0.1deg);
    }

    80% {
        transform: translate(1px, 1px) rotate(0.1deg);
    }

    90% {
        transform: translate(-1px, 0) rotate(0deg);
    }
}

/* Combo Streak Display */
.combo-display {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fredoka', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #ff6b35;
    text-shadow:
        0 0 10px #ff6b35,
        0 0 20px #ff6b35,
        0 0 30px #ff6b35,
        2px 2px 0 rgba(0, 0, 0, 0.8);
    z-index: 1000;
    pointer-events: none;
    animation: comboPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes comboPop {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translateX(-50%) scale(1.2);
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Progress Bar with Sparks - Hidden for now */
.duel-progress-container {
    display: none;
    /* Hide the progress bar */
}

.duel-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #ff9f43, #ff6b35);
    background-size: 200% 100%;
    animation: progressShine 0.5s linear infinite, progressFill 0.2s ease-out;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

.duel-progress-sparks {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: sparkMove 0.3s linear infinite;
}

@keyframes progressShine {
    0% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 200% 0%;
    }
}

@keyframes progressFill {
    0% {
        width: 0%;
    }
}

@keyframes sparkMove {
    0% {
        transform: translateX(-100px);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateX(100px);
        opacity: 0;
    }
}

/* Particle Effects */
.duel-particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ff6b35;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 0 4px #ff6b35;
}

/* Urgent/Overdue Heartbeat Pulse */
.duel-card.urgent-pulse {
    animation: heartbeatPulse 1.5s ease-in-out infinite;
}

@keyframes heartbeatPulse {

    0%,
    100% {
        box-shadow:
            0 0 0 0 rgba(255, 107, 53, 0.4),
            0 0 0 0 rgba(255, 107, 53, 0.4);
    }

    50% {
        box-shadow:
            0 0 0 4px rgba(255, 107, 53, 0),
            0 0 0 8px rgba(255, 107, 53, 0);
    }
}

.duel-card {
    background: linear-gradient(135deg, var(--card) 0%, var(--input-bg) 100%);
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 12px;
    padding: 14px;
    /* Equal padding on all sides */
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    overflow: visible;
    min-height: 100px;
    max-height: none;
    max-width: 280px;
    width: 100%;
    margin: 0 auto 24px;
    cursor: pointer;
    text-align: left;
    justify-content: flex-start;
    transition: border-color 0.3s ease, transform 0.3s ease;
    isolation: isolate;
    /* Creates new stacking context to contain shadows */
}

/* Desktop: Subtle duel card improvements */
@media (min-width: 768px) {
    .duel-card {
        border-radius: 14px;
    }
}

.duel-card:hover {
    border-color: var(--primary);
    border-top: none;
    transform: translateY(-4px) scale(1.02);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tactile Physics - Bounce on Click */
.duel-card:active {
    transform: translateY(-2px) scale(0.98);
    transition: transform 0.1s ease-out;
}

/* Motion Blur Effect for Winner */
.duel-card.winner {
    filter: blur(0px);
    animation: winnerGlow 0.8s ease-out forwards, motionBlur 0.3s ease-out;
}

@keyframes motionBlur {
    0% {
        filter: blur(2px);
    }

    100% {
        filter: blur(0px);
    }
}

.duel-card.winner {
    border-color: var(--success);
    border-width: 3px;
    border-top: none;
    box-shadow:
        0 0 0 2px rgba(0, 184, 148, 0.4),
        0 0 20px rgba(0, 184, 148, 0.5),
        0 0 40px rgba(0, 184, 148, 0.3);
    animation: winnerGlow 0.8s ease-out forwards;
}

@keyframes winnerGlow {
    0% {
        border-color: var(--border);
        border-top: none;
        box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4);
    }

    50% {
        border-color: var(--success);
        border-top: none;
        box-shadow:
            0 0 0 3px rgba(0, 184, 148, 0.6),
            0 0 30px rgba(0, 184, 148, 0.7),
            0 0 60px rgba(0, 184, 148, 0.4);
    }

    100% {
        border-color: var(--success);
        border-top: none;
        box-shadow:
            0 0 0 2px rgba(0, 184, 148, 0.4),
            0 0 20px rgba(0, 184, 148, 0.5),
            0 0 40px rgba(0, 184, 148, 0.3);
    }
}

/* LOSER CARD GLOW */
.duel-card.loser {
    border-color: var(--danger);
    border-width: 3px;
    border-top: none;
    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.5),
        0 0 25px rgba(255, 107, 53, 0.6),
        0 0 50px rgba(255, 107, 53, 0.4);
    animation: loserGlow 0.35s ease-out forwards, loserCardShrink 0.35s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes loserGlow {
    0% {
        border-color: var(--border);
        border-top: none;
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
    }

    50% {
        border-color: var(--danger);
        border-top: none;
        box-shadow:
            0 0 0 4px rgba(255, 107, 53, 0.7),
            0 0 35px rgba(255, 107, 53, 0.8),
            0 0 70px rgba(255, 107, 53, 0.5);
    }

    100% {
        border-color: var(--danger);
        border-top: none;
        box-shadow:
            0 0 0 3px rgba(255, 107, 53, 0.5),
            0 0 25px rgba(255, 107, 53, 0.6),
            0 0 50px rgba(255, 107, 53, 0.4);
    }
}

@keyframes loserCardShrink {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.98);
    }

    100% {
        transform: scale(1);
    }
}

/* Duel Action Badges - Quick, snappy, ADHD-friendly - Wider */
/* Quick fading emoji for winners */
.duel-emoji-fx {
    position: absolute;
    top: -40px;
    right: -5px;
    font-size: 32px;
    pointer-events: none;
    z-index: 10;
    animation: emojiPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    line-height: 1;
}

@keyframes emojiPop {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.5) rotate(-10deg);
    }

    30% {
        opacity: 1;
        transform: translateY(-10px) scale(1.3) rotate(5deg);
    }

    60% {
        opacity: 1;
        transform: translateY(-15px) scale(1.2) rotate(-2deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.8) rotate(10deg);
    }
}

.duel-action-winner {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.5), 0 0 20px rgba(0, 184, 148, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: actionPop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.duel-action-loser {
    background: linear-gradient(135deg, #636e72 0%, #b2bec3 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 110, 114, 0.5), 0 0 20px rgba(99, 110, 114, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: actionPopLoser 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes actionPop {
    0% {
        opacity: 0;
        transform: translateY(5px) scale(0.5) rotate(0deg);
    }

    20% {
        opacity: 1;
        transform: translateY(-2px) scale(1.1) rotate(0deg);
    }

    60% {
        opacity: 1;
        transform: translateY(-2px) scale(1) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.9) rotate(0deg);
    }
}

@keyframes actionPopLoser {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(5px) scale(0.5) rotate(0deg);
    }

    10% {
        opacity: 1;
        transform: translateX(-50%) translateY(-2px) scale(1.1) rotate(0deg);
    }

    80% {
        opacity: 1;
        transform: translateX(-50%) translateY(-2px) scale(1) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px) scale(0.9) rotate(0deg);
    }
}

/* --- SYNC & CLOUD --- */
.sync-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sync-btn:hover {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

.sync-btn.synced {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.sync-btn.syncing {
    border-color: #a4b64f;
    background: rgba(164, 182, 79, 0.1);
    color: #a4b64f;
}

.sync-btn.error {
    border-color: var(--danger);
    background: rgba(255, 118, 117, 0.1);
    color: var(--danger);
}

.sync-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.sync-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* FIX: Restrict Google Logo Size */
.google-signin-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* --- LOADING & EMPTY STATES --- */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.skeleton {
    background: linear-gradient(90deg, var(--input-bg) 25%, var(--border) 50%, var(--input-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    height: 20px;
    margin: 8px 0;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: left;
    color: var(--text-light);
    min-height: 300px;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.empty-state-subtext {
    font-size: 13px;
    opacity: 0.7;
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}


/* --- MISC COMPONENTS --- */
.result-card {
    background: linear-gradient(135deg, #ff6b35 0%, #ff9f43 100%);
    border-radius: 20px;
    padding: 24px;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.3);
    animation: popIn 0.5s;
    text-align: left;
}

.rc-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rc-meta {
    font-size: 14px;
    opacity: 0.95;
    margin-bottom: 24px;
    font-weight: 500;
}

.rc-actions {
    display: flex;
    gap: 10px;
}

.toast-container {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    /* Stacks vertically */
    gap: 8px;
    align-items: flex-end;
    /* Aligns to right */
    justify-content: flex-end;
    pointer-events: none;
}

/* Desktop: Better toast positioning */
@media (min-width: 768px) {
    .toast-container {
        bottom: 90px;
        right: 24px;
    }
}

.toast {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #333;
    animation: slideUpFade 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast.undo {
    background: rgba(255, 107, 53, 0.95);
    cursor: pointer;
    user-select: none;
    pointer-events: all;
}

.toast.undo:active {
    transform: scale(0.95);
}

/* --- SLIDER (Dynamic Color) --- */
.f-range {
    --max-weight: 10;
    height: 6px;
    border-radius: 999px;
    outline: none;
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin-bottom: 16px;
}

.f-range::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    cursor: pointer;
    background: linear-gradient(to right, hsl(120, 70%, 50%) 0%, hsl(60, 90%, 50%) 50%, hsl(0, 70%, 50%) 100%);
}

.f-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    --hue: calc(120 - (var(--current-weight, 1) - 1) / (var(--max-weight, 10) - 1) * 120);
    background: hsl(var(--hue), 80%, 55%);
}

/* Bulk Mode Container */
.bulk-mode-container {
    background: var(--card);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.bulk-mode-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
}

.btn-bulk-import {
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    color: white;
    border: none;
    font-weight: 700;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
}

/* --- MISSING SYNC MODAL INTERNALS --- */
.sync-modal-content {
    text-align: center;
    padding: 20px 0;
}

.sync-modal-content h3 {
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 12px;
}

.sync-modal-content p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.sync-status-card {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-status-card img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sync-status-info {
    flex: 1;
}

.sync-status-info .name {
    font-weight: 600;
    font-size: 14px;
}

.sync-status-info .email {
    font-size: 12px;
    color: var(--text-light);
}

.sync-status-info .last-sync {
    font-size: 11px;
    color: var(--success);
    margin-top: 4px;
}

.sync-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.sync-actions button {
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sync-now {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-sync-now:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-signout {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-signout:hover {
    background: rgba(255, 118, 117, 0.1);
}

/* --- MISSING ACCESSIBILITY RINGS --- */
.btn-orange:focus-visible,
.btn-focus:focus-visible,
.spin-btn:focus-visible,
.task-check:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ===========================================
   MISSING SYNC STYLES & MODAL
   =========================================== */

/* 1. Ghost Variant (Idle State) */
.sync-btn-ghost {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s;
    color: var(--text-light);
    /* Fixed variable name */
}

.sync-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* 2. Pulse Animation (Syncing State) */
@keyframes cloudSubtlePulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.sync-pulse {
    animation: cloudSubtlePulse 3s infinite ease-in-out;
}

/* Avatar sync pulse - desaturates and pulses */
@keyframes avatarSyncPulse {
    0% {
        filter: grayscale(100%) brightness(0.7);
        opacity: 0.5;
    }

    50% {
        filter: grayscale(30%) brightness(1);
        opacity: 1;
    }

    100% {
        filter: grayscale(100%) brightness(0.7);
        opacity: 0.5;
    }
}

.avatar-syncing {
    animation: avatarSyncPulse 1.5s infinite ease-in-out;
    border-radius: 50%;
}

.sync-btn-ghost .avatar-syncing {
    width: 22px;
    height: 22px;
    object-fit: cover;
}

/* 3. Small Spinner (For Button) */
.spinner-small {
    display: inline-block;
    border-radius: 50%;
    border-style: solid;
    border-width: 2px;
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
    width: 14px;
    height: 14px;
}

/* 4. Sync Modal Internals */
.sync-modal-content {
    text-align: center;
    padding: 20px 0;
}

.sync-modal-content h3 {
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 12px;
}

.sync-modal-content p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.sync-status-card {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-status-card img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sync-status-info {
    flex: 1;
    text-align: left;
}

.sync-status-info .name {
    font-weight: 600;
    font-size: 14px;
    display: block;
}

.sync-status-info .email {
    font-size: 12px;
    color: var(--text-light);
    display: block;
}

.sync-status-info .last-sync {
    font-size: 11px;
    color: var(--success);
    margin-top: 4px;
    display: block;
}

.sync-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.sync-actions button {
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sync-now {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-sync-now:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-signout {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-signout:hover {
    background: rgba(255, 118, 117, 0.1);
}

/* ===========================================
   PHASE 4: FOCUS MODE STYLES
   =========================================== */

.focus-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.focus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.focus-tag {
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 700;
    color: var(--text-light);
    opacity: 0.7;
}

.focus-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.focus-task-title {
    font-size: 28px;
    text-align: center;
    font-family: 'Fredoka', sans-serif;
    margin-bottom: 30px;
    line-height: 1.3;
}

/* Timer Box Logic */
.timer-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px 60px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 400px;
}

.timer-box.active {
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.15);
    /* The Orange Glow */
}

.timer-display {
    font-size: 72px;
    font-family: 'monospace';
    font-weight: 700;
    color: var(--text);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 10px;
    color: var(--text-light);
}

/* Progress Bar */
.focus-progress-container {
    width: 100%;
    height: 8px;
    background: var(--input-bg);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.focus-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 1s linear;
}

.focus-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 40px;
}

/* Controls */
.focus-controls {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
}

.btn-focus-action {
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    flex: 1;
    max-width: 140px;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-dim {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-icon-text {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

/* ===========================================
   MISSING AI & UTILITY STYLES
   =========================================== */

/* Small AI Sparkle Button */
.btn-ai-small {
    background: none !important;
    /* Removes default button background */
    border: none !important;
    /* Removes default button border */
    padding: 2px 4px !important;
    margin: 0;
    color: var(--primary);
    /* Uses your brand orange */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.btn-ai-small:hover {
    opacity: 1;
    transform: scale(1.2) rotate(15deg);
    text-shadow: 0 0 8px var(--primary-glow);
}

.btn-ai-small:active {
    transform: scale(0.9);
}
}

/* Spinner for small buttons */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}

/* GPS Pulse Animation */
@keyframes gps-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.gps-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: gps-spin 0.8s linear infinite;
}

/* Base Chip Styling */
.person-chip {
    background: var(--primary);
    color: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 900;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Edit Mode Visual Cue */
.person-chip .chip-name {
    transition: opacity 0.2s ease;
}

.person-chip .chip-name:hover {
    opacity: 0.8;
}

/* Remove Button Styling */
.chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-weight: 900;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.chip-remove:hover {
    background: rgba(0, 0, 0, 0.2);
    opacity: 1;
}

/* Special styling for when manageMode is active */
[data-manage-mode="true"] .person-chip {
    box-shadow: 0 0 0 2px var(--danger-light);
    animation: gentle-pulse 2s infinite;
}

@keyframes gentle-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}
/* ===========================================
   NEW BUTTON COMPONENT STYLES
   =========================================== */

/* Base Button Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    border-radius: var(--border-radius-md, 8px);
    font-family: var(--font-body, inherit);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.1;
    transition:
        background-color 140ms ease,
        border-color 140ms ease,
        box-shadow 140ms ease,
        transform 90ms ease,
        filter 140ms ease;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: none;
}

.btn:focus-visible {
    box-shadow:
        0 0 0 3px var(--btn-focus-ring, rgba(255, 255, 255, 0.22)),
        0 8px 18px rgba(0, 0, 0, 0.25);
}

.btn:disabled,
.btn.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn:active {
    transform: scale(0.96);
}

.btn-full {
    width: 100%;
    display: flex;
}

/* --- SIZES --- */
.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.btn-md {
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
}

.btn-lg {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
}

.btn-icon {
    height: 40px;
    width: 40px;
    padding: 0;
    border-radius: 8px;
}

.btn-icon.btn-sm {
    height: 32px;
    width: 32px;
}

.btn-icon.btn-lg {
    height: 48px;
    width: 48px;
}

/* --- VARIANTS --- */

/* Solid Variant */
.btn-solid {
    background: var(--bg-color); /* Fallback */
    color: white;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-solid:hover {
    filter: brightness(1.06) saturate(1.03);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.btn-solid:active {
    transform: scale(0.96);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .btn-solid {
    border-color: rgba(0, 0, 0, 0.08);
}

/* Outline Variant */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color); /* Fallback */
    color: var(--text-color); /* Fallback */
}

.btn-outline:hover {
    background: var(--bg-hover); /* Fallback */
}

/* Ghost Variant */
.btn-ghost {
    background: transparent;
    color: var(--text-color); /* Fallback */
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Link Variant */
.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 0;
    height: auto;
    box-shadow: none;
}

.btn-link:hover {
    text-decoration: underline;
    transform: none;
}

/* --- COLORS (Semantic) --- */

/* Primary */
.btn-color-primary {
    --btn-focus-ring: rgba(var(--primary-rgb, 255, 107, 53), 0.35);
}

.btn-color-primary.btn-solid {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
        var(--primary);
    color: white;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 0 18px var(--primary-glow);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.btn-color-primary.btn-outline {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-color-primary.btn-outline:hover {
    background: rgba(var(--primary-rgb, 255, 107, 53), 0.1);
}

.btn-color-primary.btn-ghost {
    color: var(--primary);
}

.btn-color-primary.btn-ghost:hover {
    background: rgba(var(--primary-rgb, 255, 107, 53), 0.1);
}

/* Secondary */
.btn-color-secondary {
    --btn-focus-ring: rgba(255, 255, 255, 0.22);
}

.btn-color-secondary.btn-solid {
    background: var(--secondary);
    color: white;
}

.btn-color-secondary.btn-outline {
    border-color: var(--border);
    color: var(--text-light);
}

.btn-color-secondary.btn-outline:hover {
    border-color: var(--text-light);
    color: var(--text);
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

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

.btn-color-secondary.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

/* Success */
.btn-color-success {
    --btn-focus-ring: rgba(var(--success-rgb, 16, 185, 129), 0.33);
}

.btn-color-success.btn-solid {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px var(--success-glow);
}

.btn-color-success.btn-outline {
    border-color: var(--success);
    color: var(--success);
}

.btn-color-success.btn-outline:hover {
    background: rgba(var(--success-rgb, 46, 204, 113), 0.1);
}

/* Danger */
.btn-color-danger {
    --btn-focus-ring: rgba(var(--danger-rgb, 239, 68, 68), 0.33);
}

.btn-color-danger.btn-solid {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-color-danger.btn-outline {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-color-danger.btn-outline:hover {
    background: rgba(var(--danger-rgb, 255, 118, 117), 0.1);
}

/* Warning */
.btn-color-warning {
    --btn-focus-ring: rgba(var(--warning-rgb, 245, 158, 11), 0.33);
}

.btn-color-warning.btn-solid {
    background: var(--warning);
    color: black;
    box-shadow: 0 4px 12px var(--warning-glow);
}

.btn-color-warning.btn-outline {
    border-color: var(--warning);
    color: var(--warning);
}

/* Info */
.btn-color-info {
    --btn-focus-ring: rgba(var(--info-rgb, 139, 92, 246), 0.33);
}

.btn-color-info.btn-solid {
    background: var(--info);
    color: white;
    box-shadow: 0 4px 12px var(--info-glow);
}

.btn-color-info.btn-outline {
    border-color: var(--info);
    color: var(--info);
}

/* Special (Gradient) */
.btn-color-special {
    --btn-focus-ring: rgba(var(--primary-rgb, 255, 107, 53), 0.28);
}

.btn-color-special.btn-solid {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
}

.btn-color-special.btn-outline {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-width: 2px;
}

/* Loading Spinner */
.btn-spinner {
    animation: spin 1s linear infinite;
}

.btn-loading {
    opacity: 0.8;
    pointer-events: none;
}

/* Icon Spacing */
.btn-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn > .lucide {
    margin-right: 2px;
}

.btn.btn-icon > .lucide {
    margin-right: 0;
}

