/* Daily Health Log — Simple (v12)
   Two-column layout, minimal friction.
*/

:root{
  --bg:#0f1115;
  --panel:#151923;
  --panel-2:#10131b;
  --text:#f4f6ff;
  --muted:#a6adc7;
  --accent:#7c9bff;
  --accent-2:#a67cff;
  --danger:#ff6b6b;
  --border:rgba(255,255,255,0.08);
  --shadow:0 10px 30px rgba(0,0,0,0.35);
  --radius:14px;
  --radius-sm:10px;
  --focus:0 0 0 2px rgba(124,155,255,0.35);
  --font:system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Robust hidden behavior (protects against site-wide CSS resets) */
[hidden]{display:none !important;}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1000px 700px at 80% -10%, rgba(124,155,255,0.12), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(166,124,255,0.10), transparent 60%),
    var(--bg);
}

.app{
  max-width:1200px;
  margin:0 auto;
  padding:22px 18px 40px;
  min-height:100%;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:14px 16px;
  background:linear-gradient(135deg, rgba(124,155,255,0.08), rgba(166,124,255,0.06));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.brand-dot{
  width:14px;height:14px;border-radius:50%;
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:0 0 0 4px rgba(124,155,255,0.12);
}
.brand-title{font-weight:650;font-size:20px}
.brand-sub{color:var(--muted);font-size:12px;margin-top:2px}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.banner{
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  background:rgba(255,255,255,0.04);
  color:var(--muted);
  font-size:13px;
  line-height:1.3;
}
.banner.warn{
  background:rgba(255,184,77,0.10);
  border-color:rgba(255,184,77,0.25);
  color:#ffd9a3;
}
.banner.danger{
  background:rgba(255,107,107,0.10);
  border-color:rgba(255,107,107,0.25);
  color:#ffb3b3;
}
.date-pill{
  padding:8px 12px;
  background:rgba(255,255,255,0.04);
  border:1px solid var(--border);
  border-radius:999px;
  min-width:160px;
  text-align:center;
}
.date-label{font-size:13px;color:var(--muted)}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}
.col{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.card{
  background:linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%), var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px 16px 14px;
  box-shadow:var(--shadow);
}
.card.subtle{background:var(--panel-2)}

.card-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

h2{margin:0;font-size:18px;font-weight:620}
.small{font-size:11.5px}
.muted{color:var(--muted)}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:10px 0;
}
.label{font-size:11.5px;color:var(--muted)}

input[type="text"],
input[type="number"],
select,
textarea{
  background:rgba(255,255,255,0.04);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:10px 11px;
  font-size:13.5px;
  outline:none;
  transition:border 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
textarea{resize:vertical;min-height:60px}
/* Journal textarea should always fill its card width (no padding/margins changed). */
textarea.textarea{width:100%;max-width:100%;display:block;flex:1 0 100%;}
textarea#journalText,
textarea[name="journal"]{width:100% !important;max-width:100% !important;display:block !important;flex:1 0 100% !important;}

/* Keep this exact rule moving forward (requested): */
textarea#journalText {
  width: 100%;
}
select option{background:#0b0d12;color:var(--text)}
input:focus, select:focus, textarea:focus{
  border-color:rgba(124,155,255,0.6);
  box-shadow:var(--focus);
  background:rgba(255,255,255,0.06);
}

.inline{
  display:flex;
  gap:10px;
  align-items:flex-end;
  flex-wrap:wrap;
}
.row{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}

/* Ensure journal row and textarea can take the full card width */
.journal-row{width:100%;align-items:stretch;}

.grow{flex:1}
.w-sm{width:120px}
.w-md{width:160px}

button{
  border:1px solid var(--border);
  background:rgba(255,255,255,0.04);
  color:var(--text);
  padding:9px 12px;
  border-radius:10px;
  font-size:12.5px;
  cursor:pointer;
  transition:transform 80ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
button:hover{transform:translateY(-1px)}
button:active{transform:translateY(0)}
button:focus{outline:none;box-shadow:var(--focus)}

.primary{
  background:linear-gradient(135deg, rgba(124,155,255,0.22), rgba(166,124,255,0.22));
  border-color:rgba(124,155,255,0.5);
}
.secondary{
  background:rgba(124,155,255,0.14);
  border-color:rgba(124,155,255,0.35);
}
.ghost{background:rgba(255,255,255,0.02)}
.danger{
  color:#ffd2d2;
  border-color:rgba(255,107,107,0.45);
  background:rgba(255,107,107,0.08);
}
.icon-btn{padding:6px 9px;font-size:11px}

.list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:10px;
}
.item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 11px;
  background:rgba(255,255,255,0.035);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
}
.item-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.pill{
  font-size:10px;
  padding:3px 7px;
  border-radius:999px;
  border:1px solid var(--border);
  color:var(--muted);
  background:rgba(255,255,255,0.03);
  white-space:nowrap;
}
.item-title{
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:380px;
}
.item-meta{font-size:11px;color:var(--muted)}

/* Mood */
.mood-row{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}
.mood-scale{flex:1}
.mood-scale input[type="range"]{width:100%}
.scale-labels{
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:10px;
  margin-top:3px;
}
.mood-badge{
  min-width:68px;
  text-align:center;
  font-weight:650;
  font-size:18px;
  padding:10px 8px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.04);
}

/* Supplements */
.supp-legend{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin:2px 0 10px;
  padding:10px 10px;
  border:1px dashed rgba(255,255,255,0.08);
  border-radius:var(--radius-sm);
  background:rgba(255,255,255,0.02);
  flex-wrap:wrap;
}
.supp-add-row{
  display:grid;
  grid-template-columns:70px 1.4fr 1fr auto;
  gap:8px;
  margin-bottom:10px;
}
#newSuppEmoji{text-align:center}
.supp-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.supp-row{
  display:grid;
  grid-template-columns:1.6fr 1fr 10px;
  gap:10px;
  align-items:center;
  padding:10px 11px;
  background:rgba(255,255,255,0.035);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
}
.supp-name{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.supp-emoji{width:22px;text-align:center;font-size:16px;opacity:0.95}
.supp-title{
  font-size:12.9px;
  font-weight:600;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.supp-schedule{font-size:11px;color:var(--muted);white-space:nowrap}
.circles{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.circle-btn{
  width:22px;height:22px;border-radius:50%;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.02);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
}
.circle-btn .dot{
  width:8px;height:8px;border-radius:50%;
  background:rgba(255,255,255,0);
}
.circle-btn.filled{
  border-color:rgba(124,155,255,0.65);
  background:rgba(124,155,255,0.18);
}
.circle-btn.filled .dot{background:rgba(255,255,255,0.85)}

/* Mood chart */
.mood-chart-wrap{
  margin-top: 10px;
  padding: 8px 8px 2px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
}
#moodChart{
  width: 100%;
  display:block;
}

/* Summary */
.summary{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}
.summary-block{
  padding:10px 11px;
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
  background:rgba(255,255,255,0.03);
}
.summary-block h3{
  margin:0 0 6px 0;
  font-size:12.5px;
  color:var(--muted);
  font-weight:600;
}
.summary-block .big{
  font-size:15px;
  font-weight:620;
}

.footer{margin-top:auto;padding:8px 4px 0}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  background:rgba(0,0,0,0.55);
  backdrop-filter:blur(4px);
  z-index:50;
}
.modal{
  position:fixed; inset:0;
  display:grid; place-items:center;
  z-index:60;
  padding:18px;
}
.modal-card{
  width:min(520px, 96vw);
  background:linear-gradient(180deg, rgba(255,255,255,0.02), transparent 30%), var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px 14px 12px;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:8px;
}
.modal-head h3{margin:0;font-size:16px;font-weight:620}
.modal-body{
  display:flex; flex-direction:column; gap:10px;
  padding:4px 2px 8px;
}
.verify-box{
  border:1px dashed rgba(255,255,255,0.10);
  border-radius:var(--radius-sm);
  padding:10px 10px 12px;
  background:rgba(255,255,255,0.02);
  display:grid; gap:6px;
}
.verify-date{
  font-size:18px; font-weight:700; letter-spacing:0.4px;
  padding:6px 8px; border-radius:8px;
  background:rgba(255,255,255,0.04);
  border:1px solid var(--border);
  width:fit-content;
}
.modal-actions{
  display:flex; justify-content:flex-end; gap:8px;
  margin-top:6px;
}

/* Responsive */
@media (max-width:1100px){
  .supp-add-row{grid-template-columns:70px 1fr}
  .supp-row{grid-template-columns:1fr; align-items:flex-start}
}
@media (max-width:980px){
  .grid{grid-template-columns:1fr}
  .item-title{max-width:240px}
}


/* compact edit button inside supplement name */
.supp-row {
  align-items: center;
}
.supp-edit-btn {
  padding: 2px 6px;
  font-size: 0.75rem;
  margin-right: 6px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .supp-edit-btn {
    font-size: 0.7rem;
    padding: 2px 4px;
  }
}


/* Delete (X) buttons for log entries */
.item-right{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.del-btn{
  width:28px;
  height:28px;
  border-radius:10px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.03);
  color:var(--muted);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  line-height:1;
  cursor:pointer;
}
.del-btn:hover{
  background:rgba(255,255,255,0.06);
  color:rgba(255,255,255,0.9);
}


/* Light therapy presets */
.preset-row select{
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
}


/* Small utility inputs */
.time-input{
  width: 130px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
}
.num-input{
  width: 110px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
}
#energyChart{
  width: 100%;
  display: block;
  margin: 10px 0 6px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
