/* CSS Custom Properties & Reset */
:root {
    --bg-color: #0d1117;
    --surface-color: #161b22;
    --primary-color: #1bd96a;
    --primary-dim: rgba(27, 217, 106, 0.15);
    --text-main: #ffffff;
    --text-muted: #8b949e;
    --border-color: rgba(255, 255, 255, 0.08);
    --font-family: 'Outfit', sans-serif;
    --nav-height: 80px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(27, 217, 106, 0.2);
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(27, 217, 106, 0.4);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(27, 217, 106, 0.2) transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    /* Prevent body scroll, handle scroll in views */
    display: flex;
    justify-content: center;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: var(--bg-color);
}

#app {
    width: 100%;
    max-width: 100%;
    /* Fluid width for responsive design */
    height: 100svh;
    position: relative;
    z-index: 1;
    /* Define stacking context above canvas */
    display: flex;
    flex-direction: column;
    background-color: transparent;
    box-shadow: none;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
}

.fade-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Views Container */
#views-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px) scale(0.98);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-height) + 20px);
    /* Space for floating nav */
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Glass Header */
.glass-header {
    width: 100%;
    padding: 24px 20px;
    background: transparent;
    /* Clean background for better particle visibility */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    /* Consistent gap between h2 and p */
}

.glass-header .subtitle {
    color: var(--primary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Floating Bottom Navigation */
.floating-nav {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    height: 64px;
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.4rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    display: none;
}

.nav-item:hover,
.nav-item:active {
    color: var(--text-main);
}

.nav-item.active {
    color: var(--primary-color);
    background: var(--primary-dim);
}

.nav-item.active i {
    transform: translateY(0) scale(1.1);
}

.nav-item.active span {
    opacity: 1;
    transform: translateY(0);
}

/* 1. Detox Mode (Home) Specfics */
.content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 0 20px;
}

.breathing-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    /* Use bg-color at the edges to mask the particles behind the circle */
    background: radial-gradient(circle, var(--primary-dim) 0%, var(--bg-color) 70%, transparent 100%);
    box-shadow: 0 0 40px var(--primary-dim);
    margin-bottom: 40px;
    animation: breathe 8s ease-in-out infinite alternate;
}

@keyframes breathe {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 1;
    }
}

.content-centered .main-prompt {
    font-size: 2rem;
    margin-bottom: 24px;
    line-height: 1.2;
}

.home-interaction {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeInUp 1s ease-out;
}

.home-input-group {
    position: relative;
    width: 100%;
}

#home-response {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 50px 16px 16px;
    /* Space for button */
    color: white;
    font-family: inherit;
    text-align: left;
    outline: none;
    transition: all 0.3s ease;
}

#home-response:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-dim);
}

.home-send-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.home-send-btn:active {
    transform: translateY(-50%) scale(0.9);
}

.primary-btn.secondary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
}

.primary-btn.secondary:hover {
    background: var(--primary-dim);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Meditation Config */
/* La vista de meditación tiene estructura de 2 bloques: filtros arriba + reproductor centrado */
.meditation-view {
    display: flex;
    flex-direction: column;
}

.med-filter-bar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    width: 100%;
}

.med-filter-bar .med-cat-btn {
    width: auto;
    min-width: 120px;
    max-width: 180px;
    flex: 0 0 auto;
    justify-content: center;
}

.med-filter-bar::-webkit-scrollbar {
    display: none;
}

/* Reproductor centrado ocupa el espacio restante */
.meditation-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-display {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.ring-bg {
    fill: transparent;
    stroke: var(--surface-color);
    stroke-width: 3;
}

.ring-progress {
    fill: transparent;
    stroke: var(--primary-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 565;
    /* 2 * PI * 90 */
    stroke-dashoffset: 100;
    /* Example offset for progress */
    transition: stroke-dashoffset 0.5s ease;
}

.time-left {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 200;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    z-index: 5;
    letter-spacing: -2px;
}

/* Breathing Circle Effect for Meditation (Consistent with Home) */
.meditation-breathing-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    margin-top: -60px;
    margin-left: -60px;
    border-radius: 50%;
    /* Mask particles behind the meditation circle as well */
    background: radial-gradient(circle, var(--primary-dim) 0%, var(--bg-color) 70%, transparent 100%);
    box-shadow: 0 0 40px var(--primary-dim);
    z-index: 1;
    animation: breathe 8s ease-in-out infinite alternate;
}

@keyframes liquidRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes timerPulse {
    /* Pulso eliminado a petición del usuario */
}

.meditation-player h3 {
    font-size: 1.8rem;
    margin-top: 20px;
    position: relative;
    z-index: 2;
}

.controls {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 40px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
}

.icon-btn.active {
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-dim);
}

.play-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 4.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.play-btn:active {
    transform: scale(0.9);
}

.guidance-text {
    margin-top: 24px;
    font-size: 1.3rem;
    color: var(--primary-color);
    font-weight: 500;
    height: 1.5em;
    text-align: center;
    animation: pulseSlow 4s infinite ease-in-out;
}

@keyframes pulseSlow {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* 3. AI Chat */
.chat-header .header-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-categories {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    padding: 16px 20px;
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.chat-categories::-webkit-scrollbar {
    display: none;
}

.cat-btn,
.med-cat-btn {
    flex: 0 0 auto;
    width: 100%;
    background: var(--surface-color);
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cat-btn i,
.med-cat-btn i {
    font-size: 1.1rem;
}

.cat-btn:hover,
.med-cat-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-main);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.cat-btn.active,
.med-cat-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-color);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--primary-dim);
}

.chat-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100% - 150px);
    overflow-y: auto;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.message .time {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

.ai-message {
    background: var(--surface-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.user-message {
    background: var(--primary-color);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message.typing p {
    color: var(--primary-color);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    animation: typingPulse 1.5s infinite;
}

.video-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 8px;
    margin-top: 10px;
    transition: background 0.2s;
}

.video-link:hover {
    background: rgba(255, 0, 0, 0.2);
}

.video-link i {
    font-size: 1.2rem;
    color: #ff0000;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    color: var(--primary-color);
}

.action-btn.active {
    color: var(--primary-color);
}

@keyframes typingPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.user-message .time {
    color: rgba(0, 0, 0, 0.6);
}

.chat-input-area {
    position: absolute;
    bottom: calc(var(--nav-height) + 24px);
    /* Above floating nav */
    left: 20px;
    width: calc(100% - 40px);
    display: flex;
    gap: 12px;
}

#chat-input {
    flex: 1;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 16px 20px;
    border-radius: 30px;
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--primary-color);
}

.send-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #000;
    border: none;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(27, 217, 106, 0.3);
}

/* 4. Journal View */
.journal-wrapper {
    padding: 20px;
    height: calc(100% - 80px);
    /* header space */
    display: flex;
    flex-direction: column;
}

.journal-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 1.2rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    padding: 20px 0;
}

.journal-wrapper textarea::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.primary-btn {
    width: 100%;
    background: var(--primary-color);
    color: #000;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1rem;
    padding: 18px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(27, 217, 106, 0.2);
    transition: transform 0.2s, background 0.2s;
}

.primary-btn:active {
    transform: scale(0.98);
}

/* 5. History & Favorites */
.history-content {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
    padding: 0 16px;
}

.history-section {
    margin-bottom: 40px;
}

.history-section h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
}

.timeline {
    padding: 10px 0;
}

.favorites-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0;
}

.fav-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform 0.2s;
}

.fav-card:active {
    transform: scale(0.98);
}

.fav-card .tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.fav-card h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.fav-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fav-card .remove-fav {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.journal-card {
    border-left: 3px solid var(--primary-color) !important;
    font-style: italic;
    background: rgba(27, 217, 106, 0.03) !important;
}

.task-toggle-container {
    padding: 10px 0;
    display: flex;
    justify-content: flex-start;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: 600;
}

.task-metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-field input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-main);
    font-size: 0.85rem;
}

.task-card {
    border-left: 3px solid #ffcc00 !important;
    /* Gold/yellow for tasks */
    background: rgba(255, 204, 0, 0.03) !important;
}

.task-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.task-header i {
    color: #ffcc00;
    font-size: 1.2rem;
}

.task-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-meta-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 204, 0, 0.1);
    color: #ffcc00;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.calendar-btn:hover {
    background: #ffcc00;
    color: #000;
}

.dynamic-island-widget {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 10px auto 0;
    width: 160px;
    height: 36px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
    z-index: 20000;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: auto;
}

.dynamic-island-widget.expanded {
    width: 320px;
    height: auto;
    padding: 20px;
    border-radius: 24px;
    background: rgba(10, 10, 10, 0.98);
}

.island-capsule {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    width: 100%;
    justify-content: center;
    transition: opacity 0.2s;
}

.island-capsule span {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.dynamic-island-widget.expanded .island-capsule {
    display: none;
}

.island-expanded-content {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.dynamic-island-widget.expanded .island-expanded-content {
    display: block;
}

.island-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.island-header span {
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.island-expanded-content p {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.island-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.island-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive constraints to avoid covering titles */
@media (max-width: 480px) {
    .glass-header {
        padding-top: 60px;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (min-width: 768px) {
    .pinned-widget {
        width: 280px;
        top: 32px;
        right: 32px;
    }
}

/* --- Responsive Adjustments (Tablet & Desktop) --- */
@media (min-width: 768px) {

    /* 1. Global constraints */
    .floating-nav {
        width: 400px;
        /* Keep nav bar mobile-sized on big screens */
        bottom: 32px;
    }

    .glass-header {
        padding: 32px 40px 24px;
        text-align: center;
        /* Center the title on wide screens */
    }

    /* 2. Detox Home */
    .content-centered .main-prompt {
        font-size: 3rem;
    }

    .breathing-circle {
        width: 160px;
        height: 160px;
    }

    /* 3. Meditation */
    .timer-display {
        transform: scale(1.3);
        margin-bottom: 60px;
    }

    .meditation-player h3 {
        font-size: 2rem;
    }

    /* 4. Chat View */
    .chat-messages {
        padding: 30px 40px;
        max-width: 700px;
        /* Center chat on huge screens */
        margin: 0 auto;
        height: calc(100% - 180px);
        /* Adjust height for centered input */
    }

    .chat-input-area {
        max-width: 700px;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(var(--nav-height) + 40px);
        width: 100%;
    }

    /* 5. Journal View */
    .journal-wrapper {
        max-width: 700px;
        margin: 0 auto;
        width: 100%;
        padding: 40px;
    }

    .journal-wrapper textarea {
        font-size: 1.5rem;
    }

    /* 6. History View */
    .timeline {
        max-width: 700px;
        margin: 0 auto;
        padding: 40px;
    }
}

/* --- History Enhancements (Premium) --- */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 15px 10px;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-card span {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-card label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.history-filters {
    display: flex;
    gap: 10px;
    padding: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.history-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Timeline Refinement */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: linear-gradient(to bottom,
            transparent,
            rgba(27, 217, 106, 0.3) 10%,
            rgba(27, 217, 106, 0.3) 90%,
            transparent);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: -34px;
    top: 4px;
    width: 10px;
    height: 10px;
    background: var(--bg-dark);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    z-index: 1;
}

.timeline-item .date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.timeline-item .card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 18px;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.timeline-item .card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Category Specific Styles */
.meditation-card {
    border-left: 3px solid #8B5CF6 !important;
    /* Purple for meditation */
    background: rgba(139, 92, 246, 0.03) !important;
}

.meditation-card i {
    color: #8B5CF6;
}

.journal-card {
    border-left: 3px solid #3B82F6 !important;
    /* Blue for journal */
    background: rgba(59, 130, 246, 0.03) !important;
}

.journal-item i {
    color: #3B82F6;
}

/* AI Coach: Chat Header Settings Button */
.chat-header {
    position: sticky;
    top: 0;
    padding: 16px 20px;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 6px var(--primary-color);
    animation: statusBlink 2s infinite ease-in-out;
}

@keyframes statusBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.settings-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--primary-dim);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: rotate(45deg);
}

/* API Key Modal Overlay */
.api-key-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.api-key-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.api-key-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(10px) scale(0.97);
    transition: transform 0.3s ease;
}

.api-key-overlay.visible .api-key-card {
    transform: translateY(0) scale(1);
}

.api-key-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.api-key-header h3 {
    font-size: 1.05rem;
    color: var(--text-main);
}

.api-key-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.api-key-steps {
    font-size: 0.88rem;
    color: var(--text-muted);
    padding-left: 20px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-key-steps a {
    color: var(--primary-color);
    text-decoration: none;
}

.api-key-steps a:hover {
    text-decoration: underline;
}

#api-key-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

#api-key-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-dim);
}

.api-key-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.api-key-btn {
    flex: 1;
    padding: 13px;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.api-key-btn.primary {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 4px 14px rgba(27, 217, 106, 0.3);
}

.api-key-btn.primary:hover {
    box-shadow: 0 6px 20px rgba(27, 217, 106, 0.45);
    transform: translateY(-1px);
}

.api-key-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.api-key-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.api-key-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ======================================================
   LOGIN SCREEN
   ====================================================== */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    padding: 24px;
}

.login-content {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    animation: fadeInUp 0.8s ease-out;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.login-logo h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.login-breathing-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-dim) 0%, transparent 70%);
    box-shadow: 0 0 40px var(--primary-color);
    animation: breathe 4s ease-in-out infinite alternate;
    margin-bottom: 8px;
}

.login-card {
    width: 100%;
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.login-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
}

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    background: #fff;
    color: #1f1f1f;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.google-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.google-btn:active {
    transform: scale(0.98);
}

.google-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Email Auth Styles */
#email-auth-container {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.4s ease-out;
}

.auth-form.active {
    display: flex;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 16px 16px 48px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 12px var(--primary-dim);
}

.full-width {
    width: 100%;
}

.auth-toggle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
}

.auth-toggle span {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    gap: 16px;
    margin: 8px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

/* ======================================================
   ONBOARDING SCREEN
   ====================================================== */
.onboarding-screen {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    padding: 40px 24px;
    gap: 32px;
}

.onboarding-slides {
    width: 100%;
    max-width: 340px;
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-slide {
    position: absolute;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transform: translateX(40px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.onboarding-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    position: relative;
}

.ob-icon {
    font-size: 5rem;
    line-height: 1;
    animation: breathe 3s ease-in-out infinite alternate;
}

.onboarding-slide h2 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.onboarding-slide p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 280px;
}

.ob-dots {
    display: flex;
    gap: 8px;
}

.ob-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s ease;
}

.ob-dot.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

.ob-btn {
    width: 100%;
    max-width: 340px;
}

/* Name input in onboarding */
.ob-name-input {
    width: 100%;
    max-width: 300px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 20px;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.ob-name-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.ob-name-input:focus {
    border-color: var(--primary-color);
    background: rgba(27, 217, 106, 0.07);
    box-shadow: 0 0 18px rgba(27, 217, 106, 0.15);
}

/* ============================================================
   EMOTION REGISTRY — HOME VIEW
   ============================================================ */

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-action-btn:hover {
    color: var(--primary-color);
}

.emotion-registry-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px 0;
    text-align: center;
}

.main-prompt {
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 6px;
}

.prompt-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 24px;
    opacity: 0.8;
}

/* Emotion Grid */
.emotion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
}

.emotion-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: var(--font-family);
}

.add-custom-btn {
    border-style: dashed;
    opacity: 0.8;
}

.add-custom-btn:hover {
    opacity: 1;
}

.emotion-card:hover,
.emotion-card:active {
    transform: translateY(-4px) scale(1.04);
    border-color: var(--card-color, var(--primary-color));
    background: color-mix(in srgb, var(--card-color, var(--primary-color)) 12%, transparent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--card-color, var(--primary-color)) 25%, transparent);
}

.emotion-card.selected {
    border-color: var(--card-color, var(--primary-color));
    background: color-mix(in srgb, var(--card-color, var(--primary-color)) 18%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-color, var(--primary-color)) 30%, transparent);
    transform: scale(1.06);
}

@keyframes emotionPop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.18);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1.06);
    }
}

.emotion-card.selected {
    animation: emotionPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.emotion-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.emotion-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card h3 {
    text-align: center;
    color: var(--text-main);
    margin-bottom: 8px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-field label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.modal-input:focus {
    border-color: var(--primary-color);
}

.emoji-input {
    font-size: 2rem;
    padding: 8px;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.emoji-picker-grid span {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s, transform 0.2s;
}

.emoji-picker-grid span:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quick Note Area */
.quick-note-area {
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.35s ease-out;
}

.quick-note-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: none;
    outline: none;
    min-height: 90px;
    transition: border-color 0.3s;
}

.quick-note-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-dim);
}

.quick-note-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.ghost-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ghost-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.save-now-btn {
    flex: 2;
    font-size: 0.95rem;
    padding: 12px;
}

/* Today Pill */
.today-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 20px;
}

.today-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-dim);
}

.today-pill i {
    color: var(--primary-color);
}

/* Micro-coach Contextual Card */
.micro-coach-card {
    margin-top: 24px;
    padding: 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(27, 217, 106, 0.1), rgba(255, 255, 255, 0.05));
    border: 1.5px solid rgba(27, 217, 106, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeInUp 0.6s ease-out;
    text-align: left;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    transition: opacity 0.4s ease;
}

.micro-coach-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.micro-coach-header i {
    font-size: 1rem;
}

.micro-coach-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-main);
    font-style: italic;
    font-weight: 300;
}

/* ============================================================
   ANALYTICS DASHBOARD — HISTORY VIEW
   ============================================================ */

.dashboard-content {
    padding: 16px 16px 0;
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* AI Insight Card */
.insight-card {
    background: linear-gradient(135deg, rgba(27, 217, 106, 0.08), rgba(27, 217, 106, 0.03));
    border: 1px solid rgba(27, 217, 106, 0.2);
    border-radius: 24px;
    padding: 20px;
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.insight-badge {
    background: rgba(27, 217, 106, 0.15);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ghost-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.ghost-icon-btn:hover {
    color: var(--primary-color);
    transform: rotate(90deg);
}

.insight-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

.insight-text.loaded {
    color: var(--text-main);
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-pill label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Sections */
.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-section h3 {
    font-size: 1rem;
    color: var(--text-main);
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
}

/* Heatmap */
.heatmap-wrapper {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.2s;
    cursor: pointer;
    position: relative;
}

.heatmap-day:hover {
    transform: scale(1.3);
    z-index: 5;
}

.heatmap-day[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.heatmap-day:hover[title]::after {
    opacity: 1;
}

.heatmap-legend {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

/* Chart */
.chart-container {
    padding: 20px;
    border-radius: 20px;
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

/* Emotion Breakdown Bars */
.emotion-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breakdown-emoji {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.breakdown-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 72px;
    text-align: right;
}

.breakdown-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    width: 24px;
    text-align: right;
}

/* Data Portability */
.portability-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-direction: row;
}

.ghost-btn-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ghost-btn-full:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-dim);
}

.import-label {
    cursor: pointer;
}

/* Emotion log item in timeline */
.emotion-log-card {
    border-left: 3px solid var(--emo-color, var(--primary-color)) !important;
    background: color-mix(in srgb, var(--emo-color, var(--primary-color)) 5%, transparent) !important;
}

.emotion-log-card .task-header i {
    color: var(--emo-color, var(--primary-color));
}

/* Emotion registered toast */
.emotion-toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 32px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    white-space: nowrap;
}

.emotion-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.emotion-toast-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================================
   GAMIFICACIÓN - ORBE CENTRAL
   ============================================================ */
.zen-orbe-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

/* Modificador sutil del Orbe actual para aceptar variables de JS */
.zen-orbe {
    --xp-glow-intensity: 0.1;
    /* Dinámico por JS */
    margin-bottom: 20px;
    box-shadow: 0 0 calc(20px + (40px * var(--xp-glow-intensity))) color-mix(in srgb, var(--primary-color) calc(20% + (80% * var(--xp-glow-intensity))), transparent) !important;
    transition: transform 0.8s ease, box-shadow 1s ease;
}

/* Panel de Estilos Glassmorphism reutilizado */
.zen-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(22, 27, 34, 0.6);
    /* Transparente profundo */
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.85rem;
    color: var(--text-main);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.zen-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.zen-stat-item i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.zen-stat-divider {
    width: 1px;
    height: 14px;
    background: var(--border-color);
}

/* Dynamic Weekly Insight (Connected to Stats Row) */
.dynamic-weekly-insight {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 20px 20px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.dynamic-weekly-insight::before {
    content: '';
    position: absolute;
    top: -9px;
    right: 16.66%;
    /* Puts the arrow pointing to the 3rd stat pill */
    width: 16px;
    height: 16px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.clickable-pill:hover {
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.2) !important;
}

/* ─────────────────────────────────────────────── */
/* TERMS CONSENT CHECKBOX                          */
/* ─────────────────────────────────────────────── */
.terms-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0 14px;
    user-select: none;
}

.terms-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.terms-checkbox-custom {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.terms-checkbox-label:hover .terms-checkbox-custom {
    border-color: var(--primary-color);
    background: rgba(27, 217, 106, 0.05);
}

/* Checkmark via pseudo-element */
.terms-checkbox-custom::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    transform: rotate(45deg) scale(0) translateX(-1px);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-top: -2px;
}

/* Checked state */
.terms-checkbox-label input[type="checkbox"]:checked ~ .terms-checkbox-custom {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(27, 217, 106, 0.4);
}

.terms-checkbox-label input[type="checkbox"]:checked ~ .terms-checkbox-custom::after {
    transform: rotate(45deg) scale(1) translateX(-1px);
}

.terms-checkbox-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.terms-checkbox-text a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.terms-checkbox-text a:hover {
    opacity: 0.75;
}

/* Passive terms note (under Google / guest buttons) */
.login-terms-note {
    font-size: 0.77rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 14px;
    line-height: 1.5;
}

.login-terms-note a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.login-terms-note a:hover {
    opacity: 0.7;
}

/* Shake animation when checkbox not checked */
@keyframes termsShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.terms-shake {
    animation: termsShake 0.55s ease-in-out;
}