/* === DISCERNO APP STYLES === */

/* === CSS VARIABLES === */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --success: #10b981;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);
    --shadow-2xl: 0 25px 50px rgba(0,0,0,0.25);
}

/* === BASE RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 5rem; /* Space at bottom */
}

/* === CONFETTI CANVAS === */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* === CONTAINER === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 5rem; /* Bottom padding for footer space */
}

/* === HEADER === */
.app-header {
    text-align: center;
    padding: 3rem 2rem 4rem; /* Increased bottom padding */
    margin-bottom: 3rem; /* Space before next section */
}

.app-title {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #6366f1 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 6s ease infinite;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
}

@keyframes gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.app-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2rem; /* Space after subtitle */
}

/* === ANALYTICS TOGGLE BUTTONS (TOP) === */
.analytics-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 0 0 3rem; /* Space below */
}

/* === HERO CTA SECTION === */
.hero-cta-section {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.05) 0%,
        white 50%,
        rgba(139, 92, 246, 0.05) 100%);
    border-radius: 32px;
    padding: 4rem 3rem;
    margin-top: 2rem; /* Space from buttons above */
    margin-bottom: 3rem; /* Space below */
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 2px solid rgba(99, 102, 241, 0.1);
    text-align: center;
}

.cta-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 3rem;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

/* === GOAL CARDS === */
.goal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.goal-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.goal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.goal-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 32px rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

.goal-card.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

.goal-card.active::before {
    opacity: 1;
}

.goal-number {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.goal-card.active .goal-number {
    color: white;
}

.goal-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
}

.goal-card.active .goal-label {
    color: rgba(255, 255, 255, 0.9);
}

/* === BUTTONS === */
.btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.btn-large {
    padding: 1.25rem 3rem;
    font-size: 1.25rem;
}

.btn-small {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-hero {
    font-size: 1.75rem !important;
    padding: 2rem 5rem !important;
    margin-top: 2rem;
    box-shadow: 
        0 20px 40px rgba(99, 102, 241, 0.3),
        0 0 60px rgba(99, 102, 241, 0.3);
    letter-spacing: -0.02em;
}

.btn-hero:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 28px 50px rgba(99, 102, 241, 0.4),
        0 0 80px rgba(99, 102, 241, 0.4);
}

/* === SECONDARY ACTIONS === */
.secondary-actions {
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 4rem;
}

/* === STATS SECTION === */
.stats-section {
    margin-top: 3rem;
}

.stats-section.hidden {
    display: none;
}

/* === STORAGE WARNING === */
.storage-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.storage-warning.hidden {
    display: none;
}

.storage-warning strong {
    color: #92400e;
    font-size: 1rem;
}

.storage-warning p {
    color: #78350f;
    margin: 0;
    font-size: 0.875rem;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 3rem;
}

.empty-state.hidden {
    display: none;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.empty-state-svg {
    width: 100%;
    height: 100%;
    stroke: var(--primary);
    fill: none;
    stroke-width: 3;
}

.empty-state-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.empty-state-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-checklist {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.checklist-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checklist-item.completed .checklist-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.checklist-item.completed .checklist-checkbox::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.05) 0%, 
        transparent 50%, 
        rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.streak {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, white 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, white 100%);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* === CIRCULAR PROGRESS === */
.circular-progress {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.progress-ring {
    transform: rotate(-90deg);
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

/* === MOUNTAIN RANGE CHART === */
.progress-visualization {
    background: white;
    border-radius: 24px;
    padding: 3rem;
    margin: 3rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.viz-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.02em;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* === ANALYTICS SECTION === */
.analytics-section {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.05) 0%,
        white 50%,
        rgba(139, 92, 246, 0.05) 100%);
    border-radius: 32px;
    padding: 3rem;
    margin: 3rem 0;
    box-shadow: var(--shadow-xl);
    border: 2px solid rgba(99, 102, 241, 0.1);
}

.analytics-section.hidden {
    display: none;
}

.analytics-header {
    text-align: center;
    margin-bottom: 3rem;
}

.analytics-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.analytics-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.analytics-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.analytics-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.analytics-card.highlight {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.1) 0%,
        white 100%);
    border-color: var(--primary);
}

.analytics-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.analytics-value {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.analytics-value.gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analytics-unit {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.analytics-note {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.analytics-insight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    padding: 2rem 3rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: white;
}

.insight-icon {
    font-size: 3rem;
}

.insight-text {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.6;
}

/* === SESSION HISTORY === */
.history-section {
    margin-top: 3rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.session-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.session-item {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.session-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-lg);
}

/* === UTILITY BUTTONS === */
.utility-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

/* === FULLSCREEN EDITOR === */
.fullscreen-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
    display: none;
}

.fullscreen-editor.active {
    display: flex;
    flex-direction: column;
}

.editor-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.editor-topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: var(--progress-percent, 0%);
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.3s ease;
}

.editor-stats {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.editor-count {
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.04em;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3)); }
    50% { filter: drop-shadow(0 8px 24px rgba(99, 102, 241, 0.5)); }
}

.editor-goal {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-muted);
}

.editor-status {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 24px;
    animation: breathing 4s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.editor-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    background: 
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
        white;
}

.editor-textarea {
    width: 100%;
    max-width: 800px;
    min-height: 60vh;
    padding: 40vh 2rem 60vh;
    font-family: 'Inter', sans-serif;
    font-size: 1.75rem;
    line-height: 2.4;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.editor-textarea::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

/* === CELEBRATION MODAL === */
.celebration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.celebration-modal.active {
    display: flex;
}

.celebration-content {
    background: white;
    border-radius: 32px;
    padding: 4rem 3rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
    text-align: center;
}

.celebration-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 3rem;
    letter-spacing: -0.03em;
}

.celebration-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.celebration-stat {
    text-align: center;
}

.celebration-stat-value {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

/* === SHORTCUTS MODAL === */
.shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.shortcuts-modal.active {
    display: flex;
}

.shortcuts-content {
    background: white;
    border-radius: 32px;
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
}

.shortcuts-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.shortcut-keys {
    display: flex;
    gap: 0.5rem;
}

.key {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* === ACHIEVEMENT TOAST === */
.achievement-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-2xl);
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
    max-width: 400px;
}

.achievement-toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* === MILESTONE TOAST === */
.milestone-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    padding: 2rem 4rem;
    border-radius: 24px;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: var(--shadow-2xl);
    z-index: 3000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.milestone-toast.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: pulse 0.4s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .goal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cta-title {
        font-size: 2rem;
    }

    .btn-hero {
        font-size: 1.25rem !important;
        padding: 1.5rem 3rem !important;
    }

    .hero-cta-section {
        padding: 3rem 2rem;
    }

    .chart-container {
        height: 250px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .goal-grid {
        grid-template-columns: 1fr;
    }

    .app-title {
        font-size: 3rem;
    }

    .stat-value {
        font-size: 3rem;
    }

    .editor-count {
        font-size: 4rem;
    }

    .editor-textarea {
        font-size: 1.25rem;
    }

    .celebration-stats {
        grid-template-columns: 1fr;
    }

    .achievement-toast {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem 4rem;
    }

    .app-header {
        padding: 2rem 1rem 3rem;
    }

    .app-title {
        font-size: 2.5rem;
    }

    .btn-hero {
        font-size: 1.125rem !important;
        padding: 1.25rem 2rem !important;
    }
}
#progressChart {
    width: 100% !important;
    height: 300px !important;
}
.utility-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}