/* CAFE — Case Archive & File Exchange
   Aesthetic: Iron vault meets luxury conference room.
   Dark mahogany, brass accents, cream paper, leather textures. */

:root {
  --bg-vault: #0d0d1a;
  --bg-panel: #1a1a2e;
  --bg-card: #16213e;
  --bg-paper: #f5f0e8;
  --text-cream: #e8e0d0;
  --text-gold: #d4a574;
  --text-muted: #8892a0;
  --accent: #e94560;
  --brass: #c9a96e;
  --mahogany: #3a1f0b;
  --border: #2a2a4a;
  --success: #2ecc71;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg-vault);
  color: var(--text-cream);
  min-height: 100vh;
}

/* ── Views ─────────────────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: flex; }

/* ── Gate (Landing/Auth) ───────────────────────────────────────────── */

.gate-container {
  width: 100%; min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0d0d1a 70%);
}

.gate-logo { text-align: center; margin-bottom: 48px; }
.vault-icon { font-size: 4rem; margin-bottom: 16px; filter: drop-shadow(0 0 20px rgba(201,169,110,0.3)); }
.gate-logo h1 { font-size: 3.5rem; letter-spacing: 12px; color: var(--brass); font-weight: 400; }
.gate-subtitle { font-size: 1.1rem; color: var(--text-gold); margin-top: 8px; letter-spacing: 4px; text-transform: uppercase; }
.gate-tagline { font-size: 0.85rem; color: var(--text-muted); margin-top: 16px; letter-spacing: 2px; }

.gate-actions { display: flex; gap: 16px; }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  padding: 14px 32px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 1rem; font-family: inherit;
  font-weight: 600; letter-spacing: 1px; transition: all 0.2s;
}
.btn-primary { background: var(--brass); color: var(--bg-vault); }
.btn-primary:hover { background: #d4a574; filter: brightness(1.1); }
.btn-secondary { background: transparent; color: var(--brass); border: 1px solid var(--brass); }
.btn-secondary:hover { background: rgba(201,169,110,0.1); }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }
.btn-danger { background: var(--accent); color: white; }

/* ── Auth Cards ────────────────────────────────────────────────────── */

.auth-card {
  max-width: 440px; margin: 80px auto; padding: 48px;
  background: var(--bg-panel); border-radius: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.auth-card h2 { margin-bottom: 28px; color: var(--brass); text-align: center; font-weight: 400; letter-spacing: 2px; }
.auth-card input {
  width: 100%; padding: 14px 16px; margin-bottom: 16px;
  background: var(--bg-vault); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-cream); font-size: 1rem; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--brass); }
.auth-card input::placeholder { color: var(--text-muted); }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-card p { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }
.auth-card a { color: var(--brass); text-decoration: none; }
.auth-card a:hover { text-decoration: underline; }
.code-instruction { text-align: center; margin-bottom: 24px; color: var(--text-muted); line-height: 1.6; }
.back-link { font-size: 0.85rem; }

/* ── Conference Room Layout ────────────────────────────────────────── */

#conference-room.active { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo { font-size: 1.4rem; letter-spacing: 6px; color: var(--brass); font-weight: 400; }
.sidebar-user { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }

.nav-items { flex: 1; padding: 12px 0; }
.nav-item {
  display: block; padding: 12px 24px; color: var(--text-cream);
  text-decoration: none; border-left: 3px solid transparent;
  font-size: 0.95rem; transition: all 0.15s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(201,169,110,0.06);
  border-left-color: var(--brass); color: var(--brass);
}
.nav-divider {
  padding: 8px 24px; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-muted); margin-top: 8px;
}

.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); }
.sidebar-footer a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }

.main-content { flex: 1; padding: 32px; overflow-y: auto; background: var(--bg-vault); }

/* ── Cards ─────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-panel); border-radius: 12px;
  padding: 28px; margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}
.card h3 { margin-bottom: 16px; color: var(--brass); font-weight: 400; letter-spacing: 1px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

/* ── Case Cards ────────────────────────────────────────────────────── */

.case-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 24px;
  border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
}
.case-card:hover { border-color: var(--brass); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(201,169,110,0.1); }
.case-card h4 { color: var(--text-cream); margin-bottom: 8px; }
.case-card .case-meta { font-size: 0.85rem; color: var(--text-muted); }
.case-card .case-status { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }
.case-card .case-status.active { background: rgba(46,204,113,0.15); color: var(--success); }
.case-card .exposure { font-size: 0.9rem; color: var(--accent); margin-top: 8px; }

/* ── Document Table ────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
td { color: var(--text-cream); }
td a { color: var(--brass); text-decoration: none; }
td a:hover { text-decoration: underline; }

.doc-category {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
  background: rgba(201,169,110,0.1); color: var(--brass);
}

/* ── Document Viewer ───────────────────────────────────────────────── */

.doc-viewer {
  background: var(--bg-paper); color: #1a1a1a; padding: 40px;
  border-radius: var(--radius); font-family: 'Georgia', serif;
  line-height: 1.8; max-height: 70vh; overflow-y: auto;
}
.doc-viewer h1, .doc-viewer h2, .doc-viewer h3 { color: var(--mahogany); margin: 20px 0 12px; }
.doc-viewer pre { background: #e8e0d0; padding: 16px; border-radius: 4px; overflow-x: auto; font-size: 0.85rem; }
.doc-viewer .sha-hash { font-family: monospace; font-size: 0.75rem; color: #666; word-break: break-all; }

/* ── Media Viewer ──────────────────────────────────────────────────── */

.media-viewer { background: #000; border-radius: var(--radius); overflow: hidden; margin: 16px 0; }
.media-viewer video, .media-viewer audio { width: 100%; display: block; }
.media-viewer img { max-width: 100%; display: block; margin: 0 auto; }
.transcript-overlay {
  background: rgba(0,0,0,0.85); color: var(--text-cream); padding: 16px;
  font-family: monospace; font-size: 0.85rem; max-height: 300px; overflow-y: auto;
}

/* ── Chat / Handshake Cafe ─────────────────────────────────────────── */

.chat-container { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.chat-header {
  padding: 16px 24px; background: var(--bg-panel);
  border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
}
.chat-header h3 { color: var(--brass); font-weight: 400; }
.chat-header .cafe-tagline { font-size: 0.8rem; color: var(--text-muted); }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  background: var(--bg-card); display: flex; flex-direction: column; gap: 12px;
}
.chat-msg { max-width: 70%; padding: 12px 16px; border-radius: 12px; }
.chat-msg.self { align-self: flex-end; background: rgba(201,169,110,0.15); border: 1px solid rgba(201,169,110,0.2); }
.chat-msg.other { align-self: flex-start; background: var(--bg-panel); border: 1px solid var(--border); }
.chat-msg .msg-author { font-size: 0.75rem; color: var(--brass); margin-bottom: 4px; }
.chat-msg .msg-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.chat-input {
  display: flex; gap: 12px; padding: 16px;
  background: var(--bg-panel); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}
.chat-input textarea {
  flex: 1; padding: 12px; background: var(--bg-vault);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-cream); font-family: inherit; font-size: 0.95rem;
  resize: none; min-height: 44px;
}
.chat-input textarea:focus { outline: none; border-color: var(--brass); }

/* ── Board Messages ────────────────────────────────────────────────── */

.board-msg {
  padding: 20px; border-bottom: 1px solid var(--border);
}
.board-msg.pinned { border-left: 3px solid var(--brass); background: rgba(201,169,110,0.04); }
.board-msg .msg-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.board-msg .msg-author { font-weight: 600; color: var(--brass); }
.board-msg .msg-time { font-size: 0.8rem; color: var(--text-muted); }
.board-msg .msg-content { line-height: 1.7; color: var(--text-cream); }

/* ── Search ────────────────────────────────────────────────────────── */

.search-bar {
  width: 100%; padding: 16px 20px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-cream);
  font-size: 1.1rem; font-family: inherit; margin-bottom: 24px;
}
.search-bar:focus { outline: none; border-color: var(--brass); }
.search-result { padding: 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-result:hover { background: rgba(201,169,110,0.04); }
.search-result h4 { color: var(--text-cream); margin-bottom: 4px; }
.search-result .result-meta { font-size: 0.85rem; color: var(--text-muted); }

/* ── Tags ──────────────────────────────────────────────────────────── */

.tag {
  display: inline-block; padding: 2px 8px; margin: 2px;
  border-radius: 4px; font-size: 0.7rem; letter-spacing: 1px;
  background: rgba(233,69,96,0.1); color: var(--accent);
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--bg-panel); border-radius: 12px; padding: 32px;
  width: 90%; max-width: 600px; border: 1px solid var(--border);
  max-height: 80vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 20px; color: var(--brass); }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 12px; margin-bottom: 12px;
  background: var(--bg-vault); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-cream);
  font-family: inherit; font-size: 0.95rem;
}
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--brass); }
.modal label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
.modal .btn { margin-top: 12px; }

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #conference-room.active { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .nav-items { display: flex; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 0.85rem; padding: 10px 16px; }
  .sidebar-header, .sidebar-footer, .admin-nav { display: none; }
  .main-content { padding: 16px; }
  .gate-logo h1 { font-size: 2.5rem; letter-spacing: 8px; }
}
