@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&family=Lora:ital,wght@0,400;0,700;1,400&display=swap');

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

body {
  font-family: 'Lato', sans-serif;
  background: #f4f4f4;
  color: #444444;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: url('header-bg.jpg') center center / cover no-repeat;
  border-bottom: 3px solid #4A86C8;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: relative;
  min-height: 180px;
}

header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to right, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.2) 25%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.15) 100%);
  z-index: 0;
}

header > * {
  position: relative;
  z-index: 1;
}

header .logo {
  height: 100px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

header .header-right {
  text-align: right;
}

header .app-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

header .date {
  font-size: 0.92rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  margin-top: 2px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-size: 0.85rem;
  color: #888;
  font-weight: 700;
}

.btn-signout {
  font-family: 'Lato', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  background: transparent;
  color: #4A86C8;
  border: 1px solid #4A86C8;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-signout:hover {
  background: #4A86C8;
  color: #fff;
}

/* ── Main layout ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── Today's plan banner ── */
.plan-banner {
  background: linear-gradient(135deg, #4A86C8, #3a6fad);
  color: #fff;
  border-radius: 8px;
  padding: 16px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(74,134,200,0.25);
}

.plan-banner-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  opacity: 0.8;
}

.plan-track {
  font-size: 0.8rem;
  opacity: 0.85;
}

.plan-ref {
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
}

.btn-load-plan {
  font-family: 'Lato', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 18px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-load-plan:hover {
  background: rgba(255,255,255,0.28);
}

/* ── Passage selector ── */
.passage-selector {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 24px;
  border-top: 3px solid #4A86C8;
}

.passage-selector h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #4A86C8;
  margin-bottom: 14px;
}

/* ── Two-column workspace ── */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 720px) {
  .workspace { grid-template-columns: 1fr; }
}

.panel {
  background: url('parchment-bg.png') center center;
  background-size: cover;
  border-radius: 0;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  border: none;
  position: relative;
  filter: drop-shadow(3px 4px 6px rgba(0,0,0,0.18));
  clip-path: polygon(0.0% 1.4%, 2.0% 0.7%, 4.0% 0.6%, 6.0% 0.9%, 8.0% 2.7%, 10.0% 0.9%, 12.0% 1.3%, 14.0% 2.4%, 16.0% 1.9%, 18.0% 3.3%, 20.0% 1.7%, 22.0% 1.5%, 24.0% 2.1%, 26.0% 0.8%, 28.0% 3.2%, 30.0% 1.3%, 32.0% 1.4%, 34.0% 2.4%, 36.0% 0.5%, 38.0% 2.3%, 40.0% 3.0%, 42.0% 1.2%, 44.0% 3.3%, 46.0% 1.9%, 48.0% 2.7%, 50.0% 1.6%, 52.0% 1.4%, 54.0% 0.9%, 56.0% 0.0%, 58.0% 0.7%, 60.0% 3.5%, 62.0% 1.9%, 64.0% 1.6%, 66.0% 3.2%, 68.0% 2.1%, 70.0% 3.4%, 72.0% 1.3%, 74.0% 0.8%, 76.0% 3.2%, 78.0% 0.6%, 80.0% 2.8%, 82.0% 2.1%, 84.0% 3.4%, 86.0% 3.3%, 88.0% 2.3%, 90.0% 0.1%, 92.0% 0.1%, 94.0% 1.7%, 96.0% 2.9%, 98.0% 0.3%, 100% 1.1%, 99.7% 2.0%, 98.9% 4.0%, 100.0% 6.0%, 98.8% 8.0%, 98.2% 10.0%, 99.3% 12.0%, 97.2% 14.0%, 99.8% 16.0%, 99.3% 18.0%, 99.1% 20.0%, 98.6% 22.0%, 97.3% 24.0%, 98.8% 26.0%, 97.6% 28.0%, 96.8% 30.0%, 99.5% 32.0%, 97.0% 34.0%, 97.9% 36.0%, 97.4% 38.0%, 97.9% 40.0%, 98.6% 42.0%, 99.7% 44.0%, 99.5% 46.0%, 99.4% 48.0%, 99.4% 50.0%, 99.5% 52.0%, 99.3% 54.0%, 98.0% 56.0%, 97.3% 58.0%, 97.2% 60.0%, 97.0% 62.0%, 99.6% 64.0%, 97.1% 66.0%, 99.3% 68.0%, 99.7% 70.0%, 99.0% 72.0%, 98.0% 74.0%, 99.8% 76.0%, 99.2% 78.0%, 98.6% 80.0%, 97.1% 82.0%, 98.6% 84.0%, 98.6% 86.0%, 98.7% 88.0%, 99.7% 90.0%, 96.9% 92.0%, 96.8% 94.0%, 97.5% 96.0%, 98.6% 98.0%, 98.9% 100%, 98.0% 98.9%, 96.0% 97.7%, 94.0% 97.7%, 92.0% 98.9%, 90.0% 96.9%, 88.0% 97.5%, 86.0% 99.2%, 84.0% 97.2%, 82.0% 97.6%, 80.0% 99.1%, 78.0% 99.0%, 76.0% 97.4%, 74.0% 99.7%, 72.0% 98.5%, 70.0% 96.6%, 68.0% 99.1%, 66.0% 98.2%, 64.0% 96.8%, 62.0% 96.9%, 60.0% 97.2%, 58.0% 98.1%, 56.0% 96.7%, 54.0% 99.1%, 52.0% 96.9%, 50.0% 98.6%, 48.0% 97.7%, 46.0% 97.9%, 44.0% 99.0%, 42.0% 97.6%, 40.0% 97.9%, 38.0% 96.5%, 36.0% 97.7%, 34.0% 98.5%, 32.0% 98.7%, 30.0% 96.9%, 28.0% 98.8%, 26.0% 97.7%, 24.0% 97.6%, 22.0% 96.6%, 20.0% 99.3%, 18.0% 97.7%, 16.0% 99.4%, 14.0% 97.8%, 12.0% 97.7%, 10.0% 97.4%, 8.0% 97.0%, 6.0% 99.2%, 4.0% 97.0%, 2.0% 98.8%, 0% 99.0%, 0.4% 98.0%, 1.9% 96.0%, 0.0% 94.0%, 1.1% 92.0%, 2.4% 90.0%, 2.6% 88.0%, 0.6% 86.0%, 2.7% 84.0%, 1.6% 82.0%, 0.7% 80.0%, 2.6% 78.0%, 2.6% 76.0%, 1.6% 74.0%, 1.9% 72.0%, 2.2% 70.0%, 2.2% 68.0%, 2.7% 66.0%, 2.7% 64.0%, 0.7% 62.0%, 0.1% 60.0%, 0.4% 58.0%, 1.1% 56.0%, 2.0% 54.0%, 3.4% 52.0%, 1.5% 50.0%, 1.3% 48.0%, 2.0% 46.0%, 3.3% 44.0%, 2.1% 42.0%, 1.0% 40.0%, 2.6% 38.0%, 3.5% 36.0%, 2.8% 34.0%, 1.4% 32.0%, 0.6% 30.0%, 1.6% 28.0%, 0.4% 26.0%, 0.5% 24.0%, 1.6% 22.0%, 3.0% 20.0%, 2.5% 18.0%, 1.5% 16.0%, 3.3% 14.0%, 0.6% 12.0%, 0.9% 10.0%, 1.0% 8.0%, 2.0% 6.0%, 3.1% 4.0%, 1.3% 2.0%);
}

.panel h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #4A86C8;
  margin-bottom: 0;
}

/* standalone h2 (Notes panel has no panel-header wrapper) */
.panel > h2 {
  margin-bottom: 16px;
}

/* ── Panel header row ── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin-bottom: 0;
}

.btn-read {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Lato', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  background: transparent;
  color: #4A86C8;
  border: 1px solid #4A86C8;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-read:hover:not(:disabled) {
  background: #4A86C8;
  color: #fff;
}

.btn-read:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-read-active {
  background: #c0392b !important;
  border-color: #c0392b !important;
  color: #fff !important;
}

/* ── Scripture panel ── */
.scripture-ref {
  font-size: 1rem;
  font-weight: 700;
  color: #4A86C8;
  margin-bottom: 12px;
  min-height: 1.4em;
}

.scripture-text {
  flex: 1;
  font-family: 'Lora', serif;
  font-size: 0.97rem;
  line-height: 1.9;
  color: #3a3020;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 4px;
}

.scripture-text:empty::before {
  content: "Select a passage above and click Load Passage.";
  color: #bbb;
  font-style: italic;
}

.scripture-text .verse-num {
  font-size: 0.72em;
  color: #4A86C8;
  vertical-align: super;
  font-weight: 700;
  margin-right: 2px;
}

/* ── Notes panel ── */
#notes {
  flex: 1;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  line-height: 1.75;
  color: #444;
  border: 1px solid rgba(180,165,130,0.4);
  border-radius: 2px;
  padding: 12px 14px;
  resize: vertical;
  min-height: 340px;
  background: rgba(255,252,245,0.7);
  outline: none;
  transition: border-color 0.2s;
}

#notes:focus {
  border-color: #4A86C8;
}

#notes::placeholder {
  color: #bbb;
  font-style: italic;
}

.btn-save {
  font-family: 'Lato', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 24px;
  background: #4A86C8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 14px;
  align-self: flex-end;
  transition: background 0.2s;
}

.btn-save:hover {
  background: #3a6fad;
}

.btn-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.save-msg {
  font-size: 0.85rem;
  color: #4A86C8;
  font-weight: 700;
  margin-top: 8px;
  align-self: flex-end;
  min-height: 1.2em;
}

/* ── History ── */
.history {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-top: 3px solid #4A86C8;
}

.history h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #4A86C8;
  margin-bottom: 16px;
}

.history-empty {
  color: #bbb;
  font-style: italic;
  font-size: 0.9rem;
}

.history-item {
  border-bottom: 1px solid #eee;
  padding: 14px 0;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.history-date {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-ref {
  font-weight: 700;
  color: #4A86C8;
  font-size: 0.95rem;
}

.history-preview {
  font-size: 0.85rem;
  color: #999;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Lora', serif;
  font-style: italic;
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-edit {
  font-family: 'Lato', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  background: #4A86C8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-edit:hover {
  background: #3a6fad;
}

.btn-delete {
  font-family: 'Lato', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  background: transparent;
  color: #c0392b;
  border: 1px solid #c0392b;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: #c0392b;
  color: #fff;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 8px;
  border-top: 3px solid #4A86C8;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-ref {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4A86C8;
}

.modal-date {
  font-size: 0.82rem;
  color: #999;
  margin-top: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #555;
}

.modal-scripture {
  font-family: 'Lora', serif;
  font-size: 0.9rem;
  line-height: 1.85;
  color: #666;
  white-space: pre-wrap;
  background: #f9f9f9;
  border-left: 3px solid #4A86C8;
  border-radius: 4px;
  padding: 12px 14px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.modal-notes-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #4A86C8;
  margin-bottom: 8px;
}

.modal-notes {
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  line-height: 1.75;
  color: #444;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px 14px;
  width: 100%;
  min-height: 200px;
  resize: vertical;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s;
}

.modal-notes:focus {
  border-color: #4A86C8;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  justify-content: flex-end;
}

/* ── History toggle ── */
.history-toggle {
  display: block;
  margin-top: 16px;
  background: none;
  border: none;
  color: #4A86C8;
  font-family: 'Lato', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.history-toggle:hover {
  color: #3a6fad;
}

/* ── Loading ── */
.loading {
  color: #bbb;
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
