:root {
    --bg-color: #f0ede8;
    --bg-subtle: #e8e4de;
    --surface-color: rgba(255, 253, 249, 0.82);
    --surface-solid: #fffdf9;
    --glass-border: rgba(180, 160, 130, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(80, 60, 30, 0.10);
    --text-main: #2c2416;
    --text-muted: #8a7a66;
    --primary-color: #7c5cbf;
    --primary-light: rgba(124, 92, 191, 0.12);
    --secondary-color: #c47b2b;
    --danger-color: #c0392b;
    --success-color: #2e7d52;
    --font-heading: 'Lora', serif;
    --font-body: 'DM Sans', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    /* Notebook line height — must be consistent everywhere */
    --line-h: 36px;
}

[data-theme="dark"] {
    --bg-color: #18151f;
    --bg-subtle: #221f2c;
    --surface-color: rgba(38, 33, 50, 0.85);
    --surface-solid: #26213a;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    --text-main: #ede8f5;
    --text-muted: #8878aa;
    --primary-color: #a78bdc;
    --primary-light: rgba(167, 139, 220, 0.15);
    --secondary-color: #e0974a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--bg-color); color: var(--text-main); transition: background 0.3s, color 0.3s; min-height: 100vh; }

.glass {
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ─── OFFLINE BANNER ────────────────────────────────────── */
#offline-banner {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    background: #c0392b;
    color: white;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    animation: slideDown 0.3s ease;
}
#offline-banner.show { display: block; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ─── LAYOUT ───────────────────────────────────────────── */
.app-container { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.nav-bar { width: 240px; padding: 28px 16px; display: flex; flex-direction: column; z-index: 100; border-right: 1px solid var(--glass-border); gap: 6px; }
.nav-brand { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; margin-bottom: 36px; padding: 0 10px; display: flex; align-items: center; gap: 10px; color: var(--primary-color); }
.nav-brand i { font-size: 1.1rem; }
.nav-links { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.nav-links li { padding: 13px 18px; border-radius: var(--radius-md); cursor: pointer; display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 0.9rem; transition: all 0.18s; color: var(--text-muted); }
.nav-links li:hover { background: var(--primary-light); color: var(--primary-color); }
.nav-links li.active { background: var(--primary-color); color: white; font-weight: 600; box-shadow: 0 4px 14px rgba(124,92,191,0.35); }
#theme-toggle { margin-top: auto; align-self: flex-start; }

/* Content Area */
.content-area { flex: 1; padding: 32px 36px; overflow-y: auto; display: flex; flex-direction: column; }
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; gap: 16px; }
.top-header h1 { font-family: var(--font-heading); font-size: 1.9rem; }
.search-bar { display: flex; align-items: center; padding: 11px 20px; border-radius: 30px; width: 300px; gap: 10px; }
.search-bar i { color: var(--text-muted); font-size: 0.85rem; }
.search-bar input { border: none; background: transparent; outline: none; color: var(--text-main); width: 100%; font-family: var(--font-body); font-size: 0.9rem; }

/* ─── VIEWS & CARDS ─────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; padding-bottom: 100px; align-items: start; }

/* Cards — entire card is clickable, actions are secondary */
.card {
    padding: 22px 22px 60px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); opacity: 0; transition: opacity 0.2s; }
.card:hover { transform: translateY(-5px); box-shadow: 0 20px 44px rgba(0,0,0,0.13); }
.card:hover::before { opacity: 1; }
.card-header h3 { font-family: var(--font-heading); font-size: 1.08rem; margin-bottom: 5px; line-height: 1.35; }
.card-meta { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta i { font-size: 0.7rem; }
.card-content { font-size: 0.88rem; line-height: 1.65; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; color: var(--text-muted); }
.card-actions { position: absolute; bottom: 16px; right: 16px; display: flex; gap: 6px; }
/* Hide eye button since whole card is clickable */
.card-actions .eye-btn { display: none; }
.card-tag { display: inline-block; background: var(--primary-light); color: var(--primary-color); padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 500; margin: 2px; }

/* ─── FULL-SCREEN EDITOR SCREENS ───────────────────────── */
.editor-screen {
    position: fixed; inset: 0; z-index: 1400;
    background: var(--bg-color);
    display: none; flex-direction: column;
}
.editor-screen.active { display: flex; animation: slideUp 0.28s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.editor-screen-header {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky; top: 0; z-index: 10; flex-shrink: 0;
}
.editor-screen-header h2 { font-family: var(--font-heading); font-size: 1.1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); font-weight: 500; }

.btn-save-inline {
    background: var(--primary-color); color: white;
    padding: 9px 24px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.88rem; border: none;
    cursor: pointer; transition: opacity 0.15s; flex-shrink: 0;
}
.btn-save-inline:hover { opacity: 0.85; }

.editor-screen-body {
    flex: 1; overflow-y: auto;
    padding: 0;
    display: flex; flex-direction: column;
}

/* ─── NOTEBOOK PAPER STYLE ──────────────────────────────── */
/*
 * IMPORTANT: ALL text in the notebook must sit on the ruled lines.
 * The ruled line repeats every --line-h (36px). 
 * line-height on editors must equal exactly 36px so text baseline 
 * aligns to each rule. We use padding-top to offset so the first 
 * line of text lands on the first rule after the title area.
 */
.notebook-paper {
    flex: 1; max-width: 820px; width: 100%;
    margin: 0 auto;
    padding: 0 48px 100px;
    /* Ruled lines — 1px rule at bottom of each 36px band */
    background-image: repeating-linear-gradient(
        transparent,
        transparent calc(var(--line-h) - 1px),
        var(--glass-border) calc(var(--line-h) - 1px),
        var(--glass-border) var(--line-h)
    );
    background-size: 100% var(--line-h);
    background-position: 0 0;
    min-height: 100%;
    /* Left margin red line */
    border-left: 3px solid rgba(196, 123, 43, 0.18);
}

/* Title area: use a multiple of line-h so it doesn't break the grid */
.notebook-title-input {
    width: 100%; border: none; background: transparent;
    font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700;
    color: var(--text-main); outline: none;
    padding: 0; margin: 0;
    /* 2 lines tall = 72px, then border at bottom */
    height: calc(var(--line-h) * 2);
    line-height: calc(var(--line-h) * 2);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 0;
    display: block;
}
.notebook-title-input::placeholder { color: var(--text-muted); }

/* Tags input — 1 line */
.notebook-tags-input {
    width: 100%; border: none; background: transparent;
    font-family: var(--font-body); font-size: 0.85rem;
    color: var(--text-muted); outline: none;
    height: var(--line-h);
    line-height: var(--line-h);
    padding: 0;
    display: block;
}
.notebook-tags-input::placeholder { color: var(--glass-border); font-style: italic; }

/* Meta row — fits in 2 lines */
.notebook-meta-row {
    display: flex; gap: 16px; flex-wrap: wrap;
    min-height: calc(var(--line-h) * 2);
    align-items: center;
    padding: 0;
    margin: 0;
}
.notebook-meta-input {
    flex: 1; min-width: 140px;
    border: none; border-bottom: 1px dashed var(--glass-border);
    background: transparent;
    height: var(--line-h);
    line-height: var(--line-h);
    padding: 0 4px;
    font-family: var(--font-body); font-size: 0.88rem;
    color: var(--text-main); outline: none;
    transition: border-color 0.15s;
}
.notebook-meta-input:focus { border-bottom-color: var(--primary-color); }
.notebook-meta-input::placeholder { color: var(--text-muted); }

/* Section labels — exactly 1 line tall */
.notebook-section-label {
    font-family: var(--font-heading); font-size: 0.78rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--primary-color);
    display: flex; align-items: center; gap: 8px;
    height: var(--line-h);
    line-height: var(--line-h);
    margin: 0; padding: 0;
}
.notebook-section-label i { font-size: 0.72rem; }

/* Rich editors on the notebook — line-height MUST equal --line-h */
.notebook-editor {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    font-size: 0.975rem;
    line-height: var(--line-h); /* critical — text sits on each rule */
    min-height: calc(var(--line-h) * 3);
    max-height: none !important;
    outline: none;
}
.notebook-editor-main { min-height: calc(var(--line-h) * 8); }
.notebook-editor:focus { outline: none; box-shadow: none; }
.notebook-editor:empty:before { content: attr(data-placeholder); color: var(--text-muted); opacity: 0.5; font-style: italic; pointer-events: none; }

/* All block elements inside editor must also use the same line-height */
.notebook-editor p,
.notebook-editor div,
.notebook-editor li {
    line-height: var(--line-h);
    margin: 0;
    padding: 0;
}
.notebook-editor h1 { font-family: var(--font-heading); font-size: 1.4rem; line-height: calc(var(--line-h) * 2); height: calc(var(--line-h) * 2); margin: 0; font-weight: 700; }
.notebook-editor h2 { font-family: var(--font-heading); font-size: 1.15rem; line-height: calc(var(--line-h) * 1); height: calc(var(--line-h) * 1); margin: 0; font-weight: 600; }
.notebook-editor h3 { font-family: var(--font-heading); font-size: 1rem; line-height: var(--line-h); height: var(--line-h); margin: 0; font-weight: 600; }
.notebook-editor blockquote {
    border-left: 3px solid var(--primary-color);
    padding: 0 12px;
    background: var(--primary-light);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    line-height: var(--line-h);
    margin: 0;
}
.notebook-editor input[type="checkbox"] { margin-right: 8px; accent-color: var(--primary-color); vertical-align: middle; }
.notebook-editor ul, .notebook-editor ol { padding-left: 1.5em; margin: 0; }
.notebook-editor ul li, .notebook-editor ol li { line-height: var(--line-h); }

/* Toolbar — use a multiple of line-h */
.format-toolbar {
    display: flex; align-items: center;
    padding: 0 10px;
    height: calc(var(--line-h) * 1); /* exactly 1 ruled line tall */
    border-radius: var(--radius-sm);
    margin: 0 0 0 0;
    flex-wrap: nowrap;
    gap: 2px;
    position: sticky; top: 0; z-index: 5;
    overflow-x: auto;
    scrollbar-width: none;
}
.format-toolbar::-webkit-scrollbar { display: none; }
.toolbar-group { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.toolbar-divider { width: 1px; height: 20px; background: var(--glass-border); margin: 0 4px; flex-shrink: 0; }
.fmt-btn {
    min-width: 30px; height: 28px; padding: 0 6px;
    border-radius: 5px; font-size: 0.78rem;
    display: flex; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-muted); background: transparent; border: none;
    transition: all 0.12s; cursor: pointer; flex-shrink: 0;
}
.fmt-btn:hover, .fmt-btn.active { background: var(--primary-light); color: var(--primary-color); }
.fmt-caret { font-size: 0.6rem; opacity: 0.6; }

.fmt-dropdown-wrap { position: relative; }
.fmt-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
    background: var(--surface-solid); border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 160px; overflow: hidden; display: none;
    animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.fmt-dropdown.open { display: block; }
.fmt-dropdown button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 14px; text-align: left;
    font-family: var(--font-body); font-size: 0.85rem;
    color: var(--text-main); background: none; border: none;
    cursor: pointer; transition: background 0.1s;
}
.fmt-dropdown button:hover { background: var(--primary-light); color: var(--primary-color); }
.h1-preview { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; }
.h2-preview { font-family: var(--font-heading); font-size: 0.95rem; font-weight: 600; }
.h3-preview { font-family: var(--font-heading); font-size: 0.85rem; font-weight: 600; }
.p-preview { font-size: 0.85rem; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

/* ─── RICH EDITOR (non-notebook contexts) ────────────────── */
.rich-editor {
    min-height: 160px; max-height: 280px; overflow-y: auto;
    padding: 12px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border); background: var(--surface-color);
    font-family: var(--font-body); font-size: 0.9rem; line-height: 1.7;
    color: var(--text-main); outline: none; transition: border-color 0.15s;
}
.rich-editor:focus { border-color: var(--primary-color); }
.rich-editor:empty:before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.rich-editor h1 { font-family: var(--font-heading); font-size: 1.4rem; margin: 0.6em 0 0.2em; }
.rich-editor h2 { font-family: var(--font-heading); font-size: 1.15rem; margin: 0.5em 0 0.2em; }
.rich-editor h3 { font-family: var(--font-heading); font-size: 1rem; margin: 0.4em 0 0.2em; }
.rich-editor blockquote { border-left: 3px solid var(--primary-color); padding: 6px 12px; background: var(--primary-light); border-radius: 0 6px 6px 0; margin: 0.5em 0; font-style: italic; }
.rich-editor input[type="checkbox"] { margin-right: 8px; accent-color: var(--primary-color); }
.rich-editor ul, .rich-editor ol { padding-left: 1.4em; }

/* ─── FAB ────────────────────────────────────────────────── */
.fab { position: fixed; bottom: 32px; right: 32px; width: 60px; height: 60px; border-radius: 50%; background: var(--primary-color); color: white; font-size: 1.4rem; box-shadow: 0 6px 20px rgba(124,92,191,0.45); z-index: 1000; transition: transform 0.2s, box-shadow 0.2s; display: flex; align-items: center; justify-content: center; }
.fab:hover { transform: scale(1.08) rotate(45deg); box-shadow: 0 8px 28px rgba(124,92,191,0.55); }

/* ─── DETAIL SCREENS ────────────────────────────────────── */
.detail-screen {
    position: fixed; inset: 0; z-index: 1500;
    background: var(--bg-color);
    display: none; flex-direction: column;
}
.detail-screen.active { display: flex; animation: slideUp 0.28s ease; }

.detail-header {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--glass-border);
    position: sticky; top: 0; z-index: 10;
}
.detail-header h2 { font-family: var(--font-heading); font-size: 1.15rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-header-actions { display: flex; gap: 8px; }
.back-btn { flex-shrink: 0; }

.detail-body { flex: 1; overflow-y: auto; padding: 32px 40px; max-width: 800px; width: 100%; margin: 0 auto; }
.detail-meta-strip { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--glass-border); flex-wrap: wrap; gap: 10px; }
.detail-meta-strip span { font-size: 0.82rem; color: var(--text-muted); }
#detail-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-content {
    font-family: var(--font-body); font-size: 1rem; line-height: 1.85; color: var(--text-main);
}
.detail-content h1 { font-family: var(--font-heading); font-size: 1.6rem; margin: 1.2em 0 0.4em; }
.detail-content h2 { font-family: var(--font-heading); font-size: 1.3rem; margin: 1em 0 0.4em; }
.detail-content h3 { font-family: var(--font-heading); font-size: 1.1rem; margin: 0.9em 0 0.3em; }
.detail-content p { margin-bottom: 0.9em; }
.detail-content ul, .detail-content ol { padding-left: 1.6em; margin-bottom: 0.8em; }
.detail-content li { margin-bottom: 0.3em; }
.detail-content blockquote { border-left: 3px solid var(--primary-color); padding: 12px 18px; background: var(--primary-light); border-radius: 0 8px 8px 0; margin: 1em 0; font-style: italic; color: var(--text-muted); }
.detail-content input[type="checkbox"] { margin-right: 8px; accent-color: var(--primary-color); width: 16px; height: 16px; }

/* Sermon detail sections */
.detail-section { margin-bottom: 36px; }
.detail-section-label {
    font-family: var(--font-heading); font-size: 0.78rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--primary-color); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 8px; border-bottom: 1px solid var(--primary-light);
}
.detail-section-content {
    font-family: var(--font-body); font-size: 1rem; line-height: 1.85;
    color: var(--text-main);
}
.detail-section-content h1 { font-family: var(--font-heading); font-size: 1.4rem; margin: 0.6em 0 0.3em; }
.detail-section-content h2 { font-family: var(--font-heading); font-size: 1.15rem; margin: 0.5em 0 0.2em; }
.detail-section-content h3 { font-family: var(--font-heading); font-size: 1rem; margin: 0.4em 0 0.2em; }
.detail-section-content p { margin-bottom: 0.7em; }
.detail-section-content ul, .detail-section-content ol { padding-left: 1.5em; margin-bottom: 0.6em; }
.detail-section-content blockquote { border-left: 3px solid var(--primary-color); padding: 8px 14px; background: var(--primary-light); border-radius: 0 6px 6px 0; margin: 0.5em 0; font-style: italic; }

/* Music detail setlist */
.music-detail-setlist { display: flex; flex-direction: column; gap: 12px; }
.music-detail-song-row {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px; border-radius: var(--radius-md);
    background: var(--surface-color); border: 1px solid var(--glass-border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.music-detail-song-row:hover { transform: translateX(5px); box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.music-detail-num {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-color); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.music-detail-song-info { flex: 1; }
.music-detail-song-title { font-weight: 600; font-size: 1rem; margin-bottom: 3px; }
.music-detail-song-lead { font-size: 0.8rem; color: var(--text-muted); }
.music-detail-pills { display: flex; gap: 6px; }
.music-detail-pill {
    background: var(--primary-light); color: var(--primary-color);
    padding: 4px 11px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}

/* ─── MODALS (kept for compatibility) ────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(6px); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 16px; }
.modal { width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: var(--radius-xl); padding: 32px; display: none; }
.modal.active { display: block; animation: zoomIn 0.25s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-family: var(--font-heading); font-size: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; padding-top: 8px; }
@keyframes zoomIn { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── MUSIC SESSION CARDS ────────────────────────────────── */
.music-card-songs { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.music-card-song-row { display: flex; align-items: center; gap: 10px; font-size: 0.83rem; }
.music-card-song-num { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-light); color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 700; flex-shrink: 0; }
.music-card-song-title { font-weight: 500; flex: 1; }
.music-card-song-pill { background: var(--bg-subtle); color: var(--text-muted); padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; }
.music-card-more { font-size: 0.78rem; color: var(--text-muted); padding-left: 32px; margin-top: 3px; }

/* ─── SONG INPUT ROWS ─────────────────────────────────────── */
.song-list-builder { margin-top: 8px; }
.song-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.song-list-header h3 { font-family: var(--font-heading); font-size: 1rem; display: flex; align-items: center; gap: 8px; color: var(--primary-color); }
.btn-add-song { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); background: var(--primary-light); color: var(--primary-color); font-weight: 600; font-size: 0.82rem; border: 1px dashed var(--primary-color); transition: background 0.15s; }
.btn-add-song:hover { background: var(--primary-color); color: white; }

.song-row {
    display: grid; grid-template-columns: auto 1fr; gap: 0;
    margin-bottom: 12px; border-radius: var(--radius-md); overflow: hidden;
    border: 1px solid var(--glass-border); background: var(--surface-color);
}
.song-row-num { width: 38px; background: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.song-row-fields { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 0; }
.song-row-fields input { border: none; border-radius: 0; margin: 0; background: transparent; border-left: 1px solid var(--glass-border); padding: 11px 13px; font-size: 0.85rem; }
.song-row-fields input:first-child { border-left: none; }
.song-row-fields input:focus { background: var(--primary-light); }
.song-row-delete { width: 38px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; border-left: 1px solid var(--glass-border); color: var(--danger-color); opacity: 0.5; cursor: pointer; transition: opacity 0.15s, background 0.15s; }
.song-row-delete:hover { opacity: 1; background: rgba(192,57,43,0.1); }

/* ─── TOASTS ─────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--text-main); color: var(--bg-color); padding: 12px 24px; border-radius: 30px; font-weight: 600; font-size: 0.88rem; animation: slideUpToast 0.3s, fadeOut 0.3s 2.7s forwards; white-space: nowrap; }
@keyframes slideUpToast { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }

/* ─── SHARE SHEET ─────────────────────────────────────── */
.share-sheet-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    display: none; align-items: flex-end; justify-content: center;
}
.share-sheet-overlay.active { display: flex; }
.share-sheet {
    width: 100%; max-width: 520px; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 28px 28px 40px;
    animation: sheetSlide 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheetSlide { from { transform: translateY(100%); } to { transform: translateY(0); } }
.share-sheet-handle { width: 40px; height: 4px; background: var(--glass-border); border-radius: 2px; margin: 0 auto 22px; }
.share-sheet h3 { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: 22px; text-align: center; color: var(--text-muted); font-weight: 600; }
.share-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.share-option { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; color: var(--text-main); font-family: var(--font-body); font-size: 0.78rem; font-weight: 500; transition: transform 0.15s; }
.share-option:hover { transform: scale(1.08); }
.share-icon { width: 54px; height: 54px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.share-icon.whatsapp { background: #dcfce7; color: #16a34a; }
.share-icon.copy { background: var(--primary-light); color: var(--primary-color); }
.share-icon.graphic { background: linear-gradient(135deg, #fdf4ff, #f0f9ff); color: #9333ea; }
.share-icon.print { background: #fff7ed; color: #c2410c; }
.share-icon.native { background: #f0f9ff; color: #0369a1; }
[data-theme="dark"] .share-icon.whatsapp { background: rgba(22,163,74,0.2); }
[data-theme="dark"] .share-icon.graphic { background: rgba(147,51,234,0.2); }
[data-theme="dark"] .share-icon.print { background: rgba(194,65,12,0.2); }
[data-theme="dark"] .share-icon.native { background: rgba(3,105,161,0.2); }
.share-cancel { width: 100%; padding: 15px; border-radius: var(--radius-md); background: var(--bg-subtle); border: none; font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; cursor: pointer; color: var(--text-muted); }

/* ─── GRAPHIC CARD OVERLAY ──────────────────────────────── */
.graphic-overlay {
    position: fixed; inset: 0; z-index: 4000;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(12px);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.graphic-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
.graphic-modal {
    border-radius: var(--radius-xl); padding: 28px;
    max-width: 700px; width: 100%;
    display: flex; flex-direction: column; gap: 18px;
}
.graphic-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-heading); font-weight: 600; font-size: 1.05rem;
}

/* AI Generate button inside graphic modal */
.btn-ai-generate {
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #7c5cbf, #c47b2b);
    color: white; border: none; padding: 9px 20px;
    border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: opacity 0.15s, transform 0.15s;
    position: relative; overflow: hidden;
}
.btn-ai-generate:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ai-generate.loading { opacity: 0.7; pointer-events: none; }
.ai-sparkle { font-size: 0.9rem; }

#setlist-canvas {
    width: 100%; max-width: 640px; border-radius: var(--radius-lg);
    display: block; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.graphic-modal-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* ─── AI SUMMARY PANEL ──────────────────────────────────── */
.ai-summary-panel {
    background: linear-gradient(135deg, var(--primary-light), rgba(196,123,43,0.08));
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-top: 24px;
    position: relative;
}
.ai-summary-panel-header {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-heading); font-size: 0.82rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--primary-color); margin-bottom: 12px;
}
.ai-summary-text {
    font-size: 0.95rem; line-height: 1.75; color: var(--text-main);
}
.btn-ai-summarize {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white; border: none; padding: 8px 18px;
    border-radius: var(--radius-sm); font-weight: 600; font-size: 0.82rem;
    cursor: pointer; margin-top: 14px;
    transition: opacity 0.15s, transform 0.15s;
}
.btn-ai-summarize:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ai-summarize.loading { opacity: 0.6; pointer-events: none; }

/* ─── BUTTONS & INPUTS ──────────────────────────────────── */
button { cursor: pointer; border: none; background: none; color: var(--text-main); font-family: var(--font-body); }
.btn-primary { background: var(--primary-color); color: white; padding: 12px 26px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; transition: opacity 0.15s, transform 0.15s; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); padding: 9px 18px; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.85rem; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-color); border: 1px solid var(--glass-border); font-size: 0.85rem; transition: background 0.15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--primary-light); color: var(--primary-color); }

input[type="text"], input[type="date"], textarea {
    width: 100%; padding: 12px 15px; margin-bottom: 14px;
    border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
    background: var(--surface-color); color: var(--text-main);
    font-family: var(--font-body); font-size: 0.9rem;
    transition: border-color 0.15s; outline: none;
}
input[type="text"]:focus, input[type="date"]:focus, textarea:focus { border-color: var(--primary-color); }
.input-row { display: flex; gap: 12px; }

/* ─── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .nav-bar { order: 2; width: 100%; flex-direction: row; justify-content: space-around; padding: 8px 16px; border-right: none; border-top: 1px solid var(--glass-border); height: 64px; border-radius: 18px 18px 0 0; gap: 0; }
    .nav-brand, #theme-toggle { display: none; }
    .nav-links { flex-direction: row; flex: 1; justify-content: space-around; }
    .nav-links li { flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 0.65rem; margin: 0; }
    .nav-links li i { font-size: 1.15rem; }
    .fab { bottom: 84px; }
    .content-area { padding: 18px 16px; order: 1; }
    .top-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .search-bar { width: 100%; }
    .notebook-paper { padding: 0 18px 100px; }
    .notebook-title-input { font-size: 1.4rem; }
    .song-row-fields { grid-template-columns: 1fr 1fr; }
    .song-row-fields input:nth-child(n+3) { border-top: 1px solid var(--glass-border); }
    .detail-body { padding: 20px 18px; }
    .share-options { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .share-icon { width: 48px; height: 48px; font-size: 1.2rem; }
    .format-toolbar { padding: 0 8px; }
    .fmt-btn { min-width: 28px; height: 28px; font-size: 0.75rem; }
    .graphic-modal { padding: 18px; }
}

/* ─── PRINT ─────────────────────────────────────────────── */
#print-area { display: none; }
@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 40px; background: white; color: black; font-family: 'DM Sans', sans-serif; }
    .print-card { border: 1px solid #ddd; padding: 32px; border-radius: 8px; margin-bottom: 20px; page-break-inside: avoid; }
    .print-title { font-family: 'Lora', serif; font-size: 22px; color: #2c2416; margin-bottom: 4px; }
    .print-meta { font-size: 13px; color: #8a7a66; margin-bottom: 18px; border-bottom: 2px solid #f0ede8; padding-bottom: 10px; }
    .print-content { white-space: pre-wrap; font-size: 13px; line-height: 1.7; }
    .print-song-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
    .print-song-table th { background: #f0ede8; padding: 8px 12px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
    .print-song-table td { padding: 8px 12px; border-bottom: 1px solid #eee; font-size: 13px; }
    .print-song-table tr:nth-child(even) td { background: #fafaf9; }
}
