/* Journal, New Journal Entry and Journal Entry (brainwise-mobile `develop` = live app 1.0.3: JournalScreen.tsx,
   AddJournalScreen.tsx, JournalDetailScreen.tsx StyleSheets, blue theme).
   Literal colors are the original's own: rgba(59,127,149,0.3) the empty card's border, rgba(255,255,255,…) the new
   entry's panels, #5B9BD5→#4A90E2 the AI button, #E0E0E0 the switch's off track; `${colors.info}15` /
   `${colors.accent}20` / `…10` / `…30` are #1DA1F2 at those hex alphas. */

/* ---------- Journal ---------- */
.journal { padding: 0 4px; }
.journal-enter { animation: journal-in .4s ease-out both; }
@keyframes journal-in { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: none; } }
@keyframes journal-fade { from { opacity: 0; } }
.journal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 16px; }
.journal-head-side { width: 35px; height: 35px; flex: none; }
.journal-h1 { flex: 1; text-align: center; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); outline: none; }
.journal-add { flex: none; width: 35px; height: 35px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: var(--button-gradient); color: var(--text); }
.journal-add svg { fill: currentColor; }
.journal-list { padding-top: 4px; margin-bottom: 32px; }

.journal-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px; border-radius: 16px; border: 1px solid rgba(59,127,149,0.3); background: var(--card); }
.journal-empty-ic { fill: var(--text-muted); }
.journal-empty-title { font-size: 18px; font-weight: 600; margin: 16px 0 8px; color: var(--text); }
.journal-empty-desc { font-size: 14px; line-height: 20px; margin: 0; color: var(--text-2); }

.journal-card { display: block; text-decoration: none; color: inherit; border-radius: 16px; padding: 18px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--card); box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: opacity .15s; }
.journal-card:active { opacity: .8; }
.journal-card p, .journal-card h2 { margin: 0; }
.journal-card-date { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 12px !important; }
.journal-card-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); margin-bottom: 10px !important; overflow-wrap: anywhere; }
.journal-card-content { font-size: 15px; line-height: 22px; color: var(--text-2); margin-bottom: 16px !important; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }

/* "Prompt used" and "AI Feedback" boxes, on a card and on the entry */
.journal-prompt-used { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; margin-bottom: 12px; background: #1DA1F215; border: 1px solid var(--accent); border-left-width: 3px; color: var(--accent); }
.journal-prompt-used svg { flex: none; fill: currentColor; }
.journal-prompt-used p { flex: 1; margin: 0; font-size: 12px; font-style: italic; }
.journal-ai { padding: 12px; border-radius: 12px; margin-bottom: 12px; background: #1DA1F220; border: 1px solid var(--accent); border-left-width: 4px; }
.journal-ai-head { display: flex; align-items: center; gap: 6px; margin: 0 0 8px !important; color: var(--accent); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.journal-ai-head svg { fill: currentColor; flex: none; }
.journal-ai-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-card .journal-ai-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; white-space: normal; }

/* ---------- the stack screens' header: gradient back button, centered title, an empty 35px on the right ---------- */
.journal-stack .stack-head { justify-content: space-between; min-height: 35px; }
.journal-stack .stack-head .back { flex: none; width: 35px; height: 35px; border-radius: 22px; background: var(--button-gradient); }
.journal-stack .stack-head .back svg { width: 20px; height: 20px; }
.journal-stack .stack-title { flex: 1; text-align: center; margin-right: 47px; font-size: 18px; letter-spacing: -0.3px; }

/* ---------- New Journal Entry (AddJournalScreen) ---------- */
.journal-new { margin: 0 -8px; padding-bottom: 20px; }
.journal-new-prompt { margin: 0 0 20px; padding: 12px 16px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 2px 4px rgba(0,0,0,0.08); text-align: center; font-size: 16px; line-height: 24px; font-style: italic; font-weight: 500; color: var(--text); }
.journal-new-field { margin-bottom: 20px; }
.journal-new-title, .journal-new-text { display: block; width: 100%; border: 1.5px solid var(--border); border-radius: 16px; padding: 16px; background: var(--input-bg); color: var(--text); font-family: var(--font); box-shadow: 0 2px 4px rgba(0,0,0,0.08); outline: none; }
.journal-new-title:focus, .journal-new-text:focus { border-color: var(--brand-sub); }
.journal-new-title::placeholder, .journal-new-text::placeholder { color: var(--text-muted); }
.journal-new-title { font-size: 17px; font-weight: 600; }
.journal-new-text { font-size: 16px; line-height: 24px; min-height: 180px; max-height: 300px; resize: vertical; }
.journal-new-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding: 12px 20px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 2px 3px rgba(0,0,0,0.06); font-size: 16px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); cursor: pointer; }
/* The iOS switch: accent track when on, #E0E0E0 off, white thumb, drawn 1.1× */
.journal-switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 56px; height: 34px; margin: 0; border-radius: 17px; background: #E0E0E0; cursor: pointer; transition: background .2s; }
.journal-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; border-radius: 50%; background: #F5F5F5; box-shadow: 0 2px 4px rgba(0,0,0,0.25); transition: transform .2s; }
.journal-switch:checked { background: var(--accent); }
.journal-switch:checked::after { background: #FFFFFF; transform: translateX(22px); }
.journal-switch:focus-visible { outline: 2px solid var(--brand-sub); outline-offset: 3px; }
.journal-new-ai-wrap { margin-bottom: 20px; }
.journal-new-ai { max-height: 140px; overflow-y: auto; padding: 18px; border-radius: 16px; border: 1.5px solid #1DA1F230; background: #1DA1F210; box-shadow: 0 3px 6px rgba(0,0,0,0.1); font-size: 15px; line-height: 22px; font-style: italic; font-weight: 500; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-new-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px 0; border-radius: 16px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); font-size: 15px; font-style: italic; font-weight: 500; color: var(--accent); }
.journal-new-note { margin: 0; padding: 12px 16px; border-radius: 16px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); font-size: 14px; line-height: 20px; color: var(--text-2); text-align: center; }
.journal-new-note a { color: var(--brand-sub); font-weight: 700; }
.journal-spinner { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: journal-spin .8s linear infinite; }
.journal-spinner.small { width: 16px; height: 16px; border-width: 2px; }
@keyframes journal-spin { to { transform: rotate(360deg); } }

.journal-new-actions { padding: 20px 8px; }
.journal-btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; padding: 16px 0; border: 0; border-radius: 16px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); font: 700 17px var(--font); letter-spacing: -0.3px; color: var(--primary); cursor: pointer; }
.journal-btn svg { fill: currentColor; flex: none; }
/* The original's #003153 text gives 4.1:1 on #4A90E2: the theme's darker navy, --primary-dark, gives 5:1. */
.journal-btn-ai { padding: 12px 0; background: linear-gradient(90deg, #5B9BD5, #4A90E2); color: var(--primary-dark); }
/* The original's navy text on its #1DA1F2→#126180 gradient falls to 1.9:1 at the dark end: white on --accent-strong
   instead (5.5:1 and up). */
.journal-btn-save { background: linear-gradient(90deg, var(--accent-strong), #126180); color: #FFFFFF; }
.journal-btn:disabled { background: var(--text-muted); color: var(--primary); opacity: .5; box-shadow: 0 4px 8px rgba(0,0,0,0.1); cursor: default; }
.journal-cancel { display: block; margin-top: 8px; padding: 12px 0; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); text-align: center; text-decoration: none; font: 600 16px var(--font); letter-spacing: -0.2px; color: var(--text-2); opacity: .9; }

/* ---------- Journal Entry (JournalDetailScreen) ---------- */
.journal-entry { border-radius: 16px; padding: 24px; margin: 4px 4px 24px; border: 1px solid rgba(59,127,149,0.3); background: var(--card); animation: journal-fade .6s ease-out; }
.journal-entry-date { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.journal-entry-date svg { fill: currentColor; flex: none; }
.journal-entry-title { margin: 0 0 20px; font-size: 24px; line-height: 32px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.journal-entry-content { margin: 0 0 20px; font-size: 16px; line-height: 26px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.journal-entry .journal-prompt-used { gap: 8px; padding: 12px; border-radius: 10px; margin-bottom: 16px; }
.journal-entry .journal-prompt-used p { font-size: 14px; line-height: 20px; }
.journal-entry .journal-ai { padding: 16px; }
.journal-entry .journal-ai-head { gap: 8px; margin-bottom: 12px !important; font-size: 13px; }
.journal-entry .journal-ai-text { font-size: 16px; line-height: 24px; }
.journal-missing { text-align: center; color: var(--text-2); font-size: 16px; margin: 40px 0; }

@media (prefers-reduced-motion: reduce) {
  .journal-enter, .journal-entry { animation: none; }
  .journal-spinner { animation-duration: 2s; }
}
