:root {
    --bg-color: #0A1A14;
    --surface: #112A20;
    --surface-hover: #1A3C2D;
    --primary: #10B981;
    --secondary: #34D399;
    --accent: #8B5CF6;
    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;
    --border: #1F4231;
    
    --radius: 12px;
    --transition: 200ms ease;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.streak-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-main);
    background: var(--surface-hover);
}

/* Navigation */
.app-nav {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    padding: 0 1rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--text-main);
}

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

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Main Content */
.app-main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 80vh;
}

.view-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Today View */
.today-header {
    margin-bottom: 2rem;
}

.today-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.today-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.gratitude-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.input-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.input-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.number-badge {
    background: var(--bg-color);
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.input-card input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    width: 100%;
    outline: none;
    font-family: inherit;
}

.input-card input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.mood-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.mood-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.mood-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.mood-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.mood-btn.selected {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.primary-btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.primary-btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.save-status {
    color: var(--primary);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-status.show {
    opacity: 1;
}

/* History View */
.history-controls {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 1rem 0;
    width: 100%;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
}

.search-box svg {
    color: var(--text-muted);
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.history-day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.history-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.history-day-header strong {
    color: var(--text-main);
    font-size: 1.1rem;
}

.history-items {
    list-style: none;
}

.history-items li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.history-items li::before {
    content: '•';
    color: var(--primary);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.history-mood {
    display: inline-block;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 1rem;
}

/* Insights View */
.insights-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 600px) {
    .insights-row {
        grid-template-columns: 1fr 1fr;
    }
}

.insight-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.insight-card h3 {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.word-cloud-card {
    min-height: 250px;
}

.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cloud-word {
    transition: transform 0.2s ease;
}
.cloud-word:hover {
    transform: scale(1.1);
}

.mood-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mood-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mood-stat-label {
    width: 100px;
    font-weight: 500;
}

.mood-stat-bar-container {
    flex: 1;
    height: 12px;
    background: var(--bg-color);
    border-radius: 999px;
    overflow: hidden;
}

.mood-stat-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 1s ease;
}

.mood-stat-count {
    width: 40px;
    text-align: right;
    color: var(--text-muted);
}

.export-section {
    margin-top: 2rem;
    text-align: center;
}

.secondary-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

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

.secondary-btn.danger {
    color: #ef4444;
}

.secondary-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-group label {
    font-weight: 600;
}

.time-input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.data-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(16, 185, 129, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.celebration-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.celebration-card {
    background: var(--bg-color);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celebration-overlay.show .celebration-card {
    transform: scale(1);
}

.celebration-card h2 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.celebration-card p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

/* Print Styles for PDF Export */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .app-header, .app-nav, .today-header, .gratitude-inputs, .mood-section, .action-row, .history-controls, .export-section, .settings-group {
        display: none !important;
    }

    #viewHistory {
        display: block !important;
    }

    .history-day-card {
        border: 1px solid #ccc;
        break-inside: avoid;
        margin-bottom: 2rem;
        background: white;
    }
    
    .history-day-header strong {
        color: black;
    }
    
    .history-items li::before {
        color: black;
    }
    
    .history-mood {
        border: 1px solid #ccc;
        background: transparent;
        color: black;
    }
}
