:root {
    --bg-color: #121212;
    --text-color: #a0a0a0;
    --accent-color: #e0e0e0;
    --input-bg: rgba(255, 255, 255, 0.03);
    --font-serif: 'Lora', serif;
    --font-sans: 'Inter', sans-serif;

    /* Mood Colors */
    --mood-rain-top: #1a1c22;
    --mood-rain-bot: #2b303b;

    --mood-fog-top: #242424;
    --mood-fog-bot: #3a3a3a;

    --mood-night-top: #0a0a0a;
    --mood-night-bot: #16161a;

    --mood-dusk-top: #2d2424;
    --mood-dusk-bot: #4a3b3b;

    --mood-empty-top: #121212;
    --mood-empty-bot: #121212;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    transition: color 1s ease;
}

/* Backgrounds */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    transition: background 1.5s ease;
    background: linear-gradient(to bottom, var(--mood-rain-top), var(--mood-rain-bot));
}

/* Rain Effect (Pseudo-element approach for simplicity) */
.mood-rain .app-background::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGYgc3R5bGU9ImZpbGw6IzU1NTtvcGFjaXR5OjAuMSIgZD0iTTEwIDExbDItM3oiLz48L3N2Zz4=');
    /* Noisy texture simulation */
    opacity: 0.1;
    animation: rain 1s linear infinite;
}

@keyframes rain {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(20px);
    }
}

/* Mood Specific Backgrounds */
.mood-fog .app-background {
    background: linear-gradient(to bottom, var(--mood-fog-top), var(--mood-fog-bot));
}

.mood-night .app-background {
    background: linear-gradient(to bottom, var(--mood-night-top), var(--mood-night-bot));
}

.mood-dusk .app-background {
    background: linear-gradient(to bottom, var(--mood-dusk-top), var(--mood-dusk-bot));
}

.mood-empty .app-background {
    background: linear-gradient(to bottom, var(--mood-empty-top), var(--mood-empty-bot));
}

/* Layout */
.container {
    max-width: 720px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.8rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* Language Selector - Redesigned */
.lang-selector {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    gap: 0;
    z-index: 50;
    /* Ensure it's above everything */
    opacity: 0;
    /* Initial state for fade-in */
}

.lang-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 16px;
    transition: all 0.3s ease;
    line-height: 1;
}

.lang-btn:hover {
    color: #999;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    /* remove previous underline */
}

.separator {
    display: none;
    /* Hide separator in pill design */
}

/* Adjust mobile layout */
@media (max-width: 600px) {
    .lang-selector {
        top: 1rem;
        right: 1.5rem;
    }
}

/* Mood Selector */
.mood-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.mood-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #666;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mood-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #888;
}

.mood-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
    color: var(--accent-color);
}

/* Main Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

textarea {
    width: 100%;
    flex: 1;
    background: var(--input-bg);
    border: none;
    border-radius: 8px;
    padding: 1.5rem;
    color: var(--accent-color);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 1.8;
    resize: none;
    outline: none;
    transition: background 0.3s ease;
}

textarea:focus {
    background: rgba(255, 255, 255, 0.05);
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
}

.status-indicator {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    transition: opacity 0.5s ease;
    opacity: 0;
}

.status-indicator.visible {
    opacity: 1;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.icon-btn:hover {
    color: var(--accent-color);
}

.icon-btn svg {
    stroke-width: 1.5;
}

/* Timeline/History */
.timeline-view {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #181818;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-view.hidden {
    transform: translateX(100%);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.timeline-header h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--accent-color);
    font-weight: 400;
}

.close-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--accent-color);
}

.timeline-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Entry Item */
.entry-item {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.entry-date {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-family: var(--font-sans);
}

.entry-mood {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 0.8rem;
    color: #888;
}

.entry-text {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.6;
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.entry-item.expanded .entry-text {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .mood-selector {
        gap: 0.5rem;
    }

    .timeline-view {
        max-width: 100%;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: var(--accent-color);
}

.modal-content h3 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.modal-content p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.donate-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.method-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.method-name {
    font-weight: 500;
    color: #ccc;
    font-size: 0.95rem;
}

.method-info {
    font-family: monospace;
    color: #888;
    font-size: 0.9rem;
}

.qr-placeholder {
    width: 40px;
    height: 40px;
    background: #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #555;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.qr-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.qr-img:hover {
    transform: scale(1.05);
}

.qr-hint {
    font-size: 0.7rem;
    color: #666;
    font-style: italic;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox:not(.hidden) img {
    transform: scale(1);
}