/* ═══════════════════════════════════════════
   ContractForge — styles.css
   ═══════════════════════════════════════════ */

:root {
  --bg:       #0a0a0a;
  --surface:  #1a1a1a;
  --surface2: #2a2a2a;
  --border:   #444444;
  --accent:   #ff00ff; /* Neon magenta */
  --accent2:  #00ffff; /* Neon cyan */
  --accent3:  #ffaa00; /* Neon orange */
  --danger:   #ff0040; /* Neon red */
  --text:     #ffffff;
  --muted:    #aaaaaa;
  --mono:     'IBM Plex Mono', monospace;
  --sans:     'IBM Plex Sans', sans-serif;
  --glow:     0 0 10px rgba(255, 0, 255, 0.5);
  --glow2:    0 0 10px rgba(0, 255, 255, 0.5);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: 
    linear-gradient(rgba(255, 0, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-shadow: var(--glow);
}

.logo span { color: var(--accent2); text-shadow: var(--glow2); }

.contract-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contract-selector select,
.contract-selector button {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.contract-selector button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.contract-selector button:hover { background: #2d6fe8; }

.save-indicator {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent2);
  opacity: 0;
  transition: opacity 0.4s;
}

.save-indicator.show { opacity: 1; }

/* ── LAYOUT ── */
.shell {
  display: flex;
  flex: 1;
  height: calc(100vh - 57px);
}

/* ── SIDEBAR NAV ── */
nav {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 16px 6px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 18px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}

nav a:hover { color: var(--text); background: var(--surface2); }

nav a.active {
  color: var(--accent);
  background: rgba(255,0,255,0.08);
  border-left-color: var(--accent);
  box-shadow: inset 0 0 10px rgba(255, 0, 255, 0.3);
}

nav a .icon { font-size: 1rem; }

/* ── MAIN PANEL ── */
main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.1);
}

.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.card-row.three { grid-template-columns: 1fr 1fr 1fr; }

/* ── FORM ELEMENTS ── */
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 5px;
  font-family: var(--sans);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 14px;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--glow); }
textarea { resize: vertical; min-height: 90px; }
.form-group { margin-bottom: 4px; }

/* ── BUTTONS ── */
.btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { background: #cc00cc; box-shadow: 0 0 15px rgba(255, 0, 255, 0.7); }
.btn-success { background: var(--accent2); color: #0a0a0a; box-shadow: var(--glow2); }
.btn-success:hover { background: #00cccc; box-shadow: 0 0 15px rgba(0, 255, 255, 0.7); }
.btn-warn { background: var(--accent3); color: #0b0e14; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.7rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ── BADGE ── */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}

.badge-blue   { background: rgba(59,123,255,0.18); color: var(--accent); }
.badge-green  { background: rgba(0,201,167,0.18);  color: var(--accent2); }
.badge-yellow { background: rgba(245,166,35,0.18); color: var(--accent3); }
.badge-red    { background: rgba(255,77,109,0.18); color: var(--danger); }

/* ── CHECKLIST ── */
.checklist-group { margin-bottom: 24px; }

.checklist-group h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 5px;
  margin-bottom: 4px;
  transition: background 0.12s;
  cursor: pointer;
}

.checklist-item:hover { background: var(--surface2); }
.checklist-item.done { opacity: 0.55; }
.checklist-item.done .item-label { text-decoration: line-through; }

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent2);
  cursor: pointer;
  flex-shrink: 0;
}

.item-label { flex: 1; font-size: 0.875rem; }
.item-req   { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); }

.progress-bar-wrap {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.progress-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── FOLDER STRUCTURE ── */
.folder-tree {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  line-height: 2;
}

.folder-tree .dir  { color: var(--accent);  font-weight: 600; }
.folder-tree .file { color: var(--muted); }
.folder-tree .req  { color: var(--accent2); }

/* ── CLAUSE BUILDER ── */
.clause-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.clause-card input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.clause-info  { flex: 1; }
.clause-num   { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.clause-title { font-size: 0.875rem; font-weight: 500; margin-bottom: 3px; }
.clause-desc  { font-size: 0.78rem; color: var(--muted); }
.clause-tags  { margin-top: 5px; display: flex; gap: 5px; flex-wrap: wrap; }

/* ── AI PANEL ── */
.ai-chat { display: flex; flex-direction: column; gap: 0; }

.ai-messages {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  padding: 18px;
  min-height: 340px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg { display: flex; gap: 10px; align-items: flex-start; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--mono);
}

.msg-avatar.ai   { background: rgba(255,0,255,0.2);  color: var(--accent); box-shadow: var(--glow); }
.msg-avatar.user { background: rgba(0,255,255,0.2);   color: var(--accent2); box-shadow: var(--glow2); }

.msg-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 86%;
  white-space: pre-wrap;
}

.msg-body.ai { border-color: rgba(59,123,255,0.2); }

.ai-input-row { display: flex; gap: 0; }

.ai-input-row textarea {
  flex: 1;
  margin: 0;
  border-radius: 0 0 0 8px;
  border-top: none;
  border-right: none;
  min-height: 60px;
  resize: none;
}

.ai-input-row button {
  border-radius: 0 0 8px 0;
  padding: 0 22px;
  font-size: 0.8rem;
}

.ai-quick-prompts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.quick-prompt {
  font-family: var(--mono);
  font-size: 0.7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.12s;
}

.quick-prompt:hover { border-color: var(--accent); color: var(--accent); }

/* ── FORMS ── */
.form-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 14px;
}

.form-section h4 {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.field-grid.three { grid-template-columns: 1fr 1fr 1fr; }

/* ── DASHBOARD ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
}

.stat-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: var(--glow);
}

.stat-sub { font-size: 0.75rem; color: var(--muted); }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.tab {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 9px 18px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── TYPING INDICATOR ── */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; filter: brightness(1); }
  40%           { transform: translateY(-6px); opacity: 1; filter: brightness(1.5) drop-shadow(0 0 5px var(--accent)); }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── MISC UTILITIES ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: var(--muted); }
.text-mono  { font-family: var(--mono); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.export-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.notice {
  background: rgba(59,123,255,0.08);
  border: 1px solid rgba(59,123,255,0.25);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 18px;
}

.contract-type-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(59,123,255,0.12);
  color: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  width: 520px;
  max-width: 95vw;
}

.modal h2 { margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#new-contract-form input,
#new-contract-form select { margin-bottom: 10px; }
