/* Gratitude Journal - High Visibility & Interaction Update */
@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap');

:root {
    --bg-main: #FFFDF9;
    --bg-card: #FFFFFF;

    --primary: #FF8F8F;
    --primary-dark: #FF6B6B;
    --secondary: #FFDCA8;

    --text-main: #333333;
    /* Darker for visibility */
    --text-sub: #666666;

    --radius-l: 24px;
    --radius-m: 16px;

    --shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Gowun Dodum', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    /* App interaction */
    -webkit-tap-highlight-color: transparent;
}

/* App Layout */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #444;
}

.btn-icon {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* Main Content Area */
main {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px 100px;
    /* Bottom padding for Tab Bar */
}

/* IMPORTANT: Tab Visibility Logic */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

/* --- Today Tab UI --- */

/* Greeting Area */
.greeting-area {
    margin-bottom: 24px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #444;
    text-align: center;
    line-height: 1.5;
}

/* 1. Image Card */
.image-card {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-l);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    background: #EEE;
}

.daily-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 2. Verse Card */
.verse-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid #FFF0F0;
}

.verse-content {
    font-size: 1.3rem;
    /* Increased size */
    font-weight: 600;
    color: #444;
    margin-bottom: 12px;
    word-break: keep-all;
    line-height: 1.6;
}

.verse-ref {
    font-size: 1rem;
    color: var(--primary-dark);
    font-weight: 500;
}

/* 3. Action Area */
.action-area {
    text-align: center;
}

.btn-floating {
    width: 100%;
    padding: 16px;
    background: #FF8F8F;
    color: white;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: 'Gowun Dodum', sans-serif;
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(255, 143, 143, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-floating:hover {
    background: #FF7A7A;
    transform: translateY(-2px);
}

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

/* --- Bible Tab --- */
.bible-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.bible-select {
    flex: 1;
    padding: 12px;
    font-size: 1.1rem;
    border: 1px solid #DDD;
    border-radius: 10px;
    font-family: inherit;
}

.bible-viewer-container {
    background: white;
    border-radius: var(--radius-m);
    box-shadow: var(--shadow);
    /* Fill remaining height roughly (adjust based on header/controls) */
    height: calc(100vh - 220px);
    padding: 10px;
}

.bible-viewer {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
}

.bible-verse-item {
    margin-bottom: 14px;
    padding: 8px;
    border-bottom: 1px solid #F5F5F5;
}

.verse-num {
    font-weight: bold;
    color: var(--primary);
    margin-right: 6px;
    font-size: 1.1rem;
}

.verse-content-text {
    font-size: 1.2rem;
    color: #333;
    line-height: 1.7;
}

/* --- Library Tab --- */
.card {
    background: white;
    border-radius: var(--radius-m);
    padding: 20px;
    box-shadow: var(--shadow);
}

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

.badge {
    background: var(--secondary);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.journal-card {
    margin-bottom: 15px;
    border: 1px solid #FAF0F0;
}

.journal-date {
    font-weight: bold;
    color: var(--primary-dark);
    display: block;
    margin-bottom: 5px;
}

.journal-text {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 10px;
}

.delete-btn {
    float: right;
    color: #CCC;
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
}

/* --- Tab Bar --- */
.tab-bar {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0 15px;
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.tab-item {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #CCC;
    font-family: inherit;
}

.tab-item.active {
    color: var(--primary);
    transform: translateY(-3px);
}

.tab-icon {
    font-size: 1.6rem;
    margin-bottom: 2px;
}

/* --- Modals --- */
dialog {
    border: none;
    border-radius: var(--radius-l);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
}

/* Write Modal (Fullscreen-ish) */
.modal-fullscreen {
    width: 90%;
    max-width: 500px;
    height: 80%;
    padding: 0;
    overflow: hidden;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
}

/* IMPORTANT: Show for dialog */
.modal-fullscreen[open] {
    display: flex;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #EEE;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFF;
}

.btn-close {
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
}

.modal-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-main);
}

.dialog-question-card {
    background: white;
    border: 2px dashed var(--secondary);
    padding: 20px;
    border-radius: var(--radius-m);
    margin-bottom: 20px;
    text-align: center;
}

#modalQuestionText {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6D5D4B;
    line-height: 1.5;
}

.journal-textarea {
    width: 100%;
    height: 200px;
    border: 1px solid #EEE;
    background: #FFFEFA;
    padding: 20px;
    font-size: 1.2rem;
    font-family: 'Gowun Batang', serif;
    /* Handwriting feel */
    line-height: 1.8;
    color: #444;
    border-radius: var(--radius-m);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.01);
    resize: none;
    outline: none;
}

.journal-textarea::placeholder {
    color: #BBB;
    font-family: 'Gowun Batang', serif;
    font-style: italic;
}

.modal-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #EEE;
}

.btn-save {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(255, 143, 143, 0.3);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    background: #FF7A7A;
    transform: translateY(-1px);
}

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

/* Settings Modal (Center) */
.modal-center {
    width: 300px;
    padding: 24px;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dialog-input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    font-size: 1.1rem;
    text-align: center;
    border: 2px solid #EEE;
    border-radius: 8px;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-flat {
    flex: 1;
    padding: 12px;
    background: #EEE;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.btn-flat.btn-accent {
    background: var(--primary);
    color: white;
    font-weight: bold;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

#toast.show {
    opacity: 1;
}