/* mOS PWA — Japanese Minimalist Aesthetic */

:root {
  --bg:          #0a0a0a;
  --bg-card:     #121212;
  --bg-elevated: #1c1c1e;
  --border:      #1a1a1a;
  --text:        #e2e2e2;
  --text-muted:  #888888;
  --accent:      #bc2121; /* Japanese Hanko Red */
  --accent-soft: rgba(188, 33, 33, 0.1);
  --success:     #2ecc71;
  --radius:      4px;    /* Shorter radius for a more architectural look */
  --tab-h:       64px;
  --safe-top:    env(safe-area-inset-top, 44px);
  --safe-bot:    env(safe-area-inset-bottom, 20px);
  
  --font-serif:  "Georgia", "Times New Roman", serif;
  --font-sans:   -apple-system, "SF Pro Text", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ─── Auth ─── */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.screen.active { z-index: 100; }
.auth-box {
  width: min(300px, 85vw);
  display: flex; flex-direction: column; gap: 24px;
}
.logo {
  font-family: var(--font-serif);
  font-size: 3rem; font-weight: 300; letter-spacing: 4px;
  text-align: center; color: var(--text); margin-bottom: 20px;
}
input[type="password"], input[type="text"], textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  padding: 12px 0;
  outline: none;
  border-radius: 0;
  -webkit-appearance: none;
  transition: border-color 0.3s;
}
input:focus, textarea:focus { border-color: var(--text-muted); }

/* ─── Main Layout ─── */
#main {
  display: flex; flex-direction: column;
  height: 100svh;
  padding-top: var(--safe-top);
}
#tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-h) + var(--safe-bot));
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bot);
  z-index: 50;
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: none; border: none;
  color: var(--text-muted); font-size: 10px; cursor: pointer;
  padding: 8px 0;
  transition: color 0.3s;
}
.tab.active { color: var(--text); }
.tab-icon { font-size: 18px; line-height: 1; }
.tab-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; }

/* ─── Scroll Content ─── */
.tab-content {
  flex: 1; overflow-y: auto;
  padding: 0 24px calc(var(--tab-h) + var(--safe-bot) + 24px);
  -webkit-overflow-scrolling: touch;
}

/* ─── Section Header ─── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 40px 0 20px;
  position: sticky; top: 0;
  background: var(--bg); z-index: 10;
}
.section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem; font-weight: 300; letter-spacing: 2px;
  text-transform: uppercase;
}

/* ─── Cards ─── */
.card {
  margin-bottom: 32px;
}
.card-title {
  font-size: 11px; font-weight: 400;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.card-body { overflow: hidden; }

/* ─── List Items ─── */
.list-placeholder { color: var(--text-muted); font-size: 14px; font-style: italic; }
.list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-text { flex: 1; font-size: 15px; font-weight: 300; }
.list-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.task-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 1px solid var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.task-check.done { background: var(--text); border-color: var(--text); }
.task-check.done::after { content: "✕"; color: var(--bg); font-size: 10px; }

/* Priority dots — minimalist style */
.prio { width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0; }
.prio-1 { background: var(--accent); }
.prio-2 { background: var(--text); }
.prio-3 { background: var(--text-muted); }
.prio-4 { border: 1px solid var(--border); }

/* Calendar events */
.cal-item {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 300;
}
.cal-item:last-child { border-bottom: none; }
.cal-time { color: var(--text-muted); font-size: 12px; min-width: 60px; font-variant-numeric: tabular-nums; }
.cal-dot { width: 6px; height: 6px; flex-shrink: 0; }

/* ─── Buttons ─── */
.btn-primary {
  width: 100%; padding: 16px;
  background: var(--text); color: var(--bg);
  border: none; border-radius: 0;
  font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px;
  cursor: pointer; margin-top: 20px;
  transition: opacity 0.3s;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.3; }

.icon-btn {
  background: none; border: none;
  color: var(--text); cursor: pointer; font-size: 18px;
  padding: 8px; opacity: 0.6; transition: opacity 0.3s;
}
.icon-btn:hover { opacity: 1; }

/* ─── Status Bar ─── */
.status-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.status-meta { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ─── Capture ─── */
.tag-row { display: flex; gap: 12px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 8px; }
.tag-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 4px 12px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px; white-space: nowrap;
}
.tag-btn.active { border-color: var(--text); color: var(--text); }

.upload-area {
  min-height: 100px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.upload-placeholder { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }

/* ─── Chat ─── */
.chat-messages {
  padding: 20px 0 100px;
  display: flex; flex-direction: column; gap: 24px;
}
.msg {
  max-width: 100%; font-size: 15px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  position: relative;
  padding-left: 0;
}
.msg-user {
  color: var(--text);
  align-self: flex-start;
  font-weight: 400;
}
.msg-user::before {
  content: "I";
  position: absolute; left: -20px; color: var(--text-muted); font-size: 10px; top: 4px;
}
.msg-ai {
  color: var(--text-muted);
  align-self: flex-start;
  font-weight: 300;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
.msg-ai::before {
  content: "mOS";
  position: absolute; left: -35px; color: var(--accent); font-size: 10px; top: 4px;
  writing-mode: vertical-rl; transform: rotate(180deg);
}

.chat-input-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 16px 24px calc(var(--safe-bot) + 16px);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex; gap: 16px; align-items: center;
  z-index: 50;
}
#chat-input {
  flex: 1; min-height: 24px; max-height: 120px;
  border: none; border-bottom: 1px solid var(--border);
  padding: 8px 0; font-size: 15px;
}
.btn-send, .mic-btn {
  background: none; border: none; color: var(--text);
  font-size: 18px; cursor: pointer; opacity: 0.6;
}
.mic-btn.recording { color: var(--accent); opacity: 1; animation: breathe 2s infinite; }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Mono Text ─── */
.mono-text {
  font-family: "Menlo", monospace;
  font-size: 12px; color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Toast ─── */
.toast {
  position: fixed; top: var(--safe-top); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 8px 24px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  z-index: 200; transition: opacity 0.4s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ─── Helpers ─── */
.hidden { display: none !important; }
.error { color: var(--accent); font-size: 13px; font-style: italic; }
