/* Nesteo App Styles — matches landing page design language */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0f;
  --cream: #f8f6f1;
  --warm: #e8e2d6;
  --accent: #c45d3e;
  --accent-hover: #a84d32;
  --accent-light: #f0d4cb;
  --muted: #6b6560;
  --glass: rgba(248,246,241,0.85);
  --white: #ffffff;
  --border: rgba(10,10,15,0.08);
  --shadow: 0 2px 12px rgba(10,10,15,0.06);
  --shadow-lg: 0 8px 32px rgba(10,10,15,0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 260px;
  --success: #2d8a56;
  --error: #c43e3e;
  --warning: #c4943e;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.2; }
a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--ink);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.3s ease;
}
.sidebar.hidden { display: none; }

.sidebar-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(248,246,241,0.08);
}
.sidebar-header .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--cream);
}
.sidebar-header .logo span { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(248,246,241,0.6);
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item:hover {
  color: var(--cream);
  background: rgba(248,246,241,0.06);
}
.nav-item.active {
  color: var(--cream);
  background: var(--accent);
}
.nav-icon { font-size: 1.15rem; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid rgba(248,246,241,0.08);
}
.user-info {
  font-size: 0.8rem;
  color: rgba(248,246,241,0.5);
  margin-bottom: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-logout {
  background: none;
  border: 1px solid rgba(248,246,241,0.15);
  color: rgba(248,246,241,0.6);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.btn-logout:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem;
  min-height: 100vh;
  max-width: 100%;
}
.main-content.full-width {
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}
.page-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.5rem; }
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

/* ── Dashboard Grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.dash-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.dash-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}
.dash-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.dash-card p {
  font-size: 0.85rem;
  color: var(--muted);
}
.dash-card .badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: #e6f4ec; color: var(--success); }
.badge-warning { background: #fef3e2; color: var(--warning); }
.badge-muted { background: var(--warm); color: var(--muted); }
.badge-accent { background: var(--accent-light); color: var(--accent); }

/* ── Forms ── */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { resize: vertical; min-height: 100px; }
select { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Checkbox Grid (Arrondissements) ── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.checkbox-grid label:hover { border-color: var(--accent); }
.checkbox-grid input[type="checkbox"] { accent-color: var(--accent); width: auto; }
.checkbox-grid input[type="checkbox"]:checked + span {
  color: var(--accent);
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  line-height: 1.4;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
  background: var(--warm);
  color: var(--muted);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: none;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { color: var(--accent); }
.btn-danger {
  background: none;
  color: var(--error);
  border: 1px solid rgba(196,62,62,0.2);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}
.btn-danger:hover { background: rgba(196,62,62,0.05); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── Auth Pages ── */
.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 0 1.5rem;
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--ink);
}
.auth-logo .logo span { color: var(--accent); }
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}
.auth-footer a:hover { text-decoration: underline; }

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fde8e8; color: var(--error); border: 1px solid rgba(196,62,62,0.15); }
.alert-success { background: #e6f4ec; color: var(--success); border: 1px solid rgba(45,138,86,0.15); }
.alert-info { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(196,93,62,0.15); }

/* ── Document List ── */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.doc-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.doc-item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.doc-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-item-type {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Cover Letter Card ── */
.letter-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.letter-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
}
.letter-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.letter-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.letter-card .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.letter-card .preview {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Generated Content View ── */
.generated-content {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2.5rem;
  line-height: 1.8;
  font-size: 0.95rem;
}
.generated-content h2 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; color: var(--ink); }
.generated-content h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: var(--ink); }
.generated-content p { margin-bottom: 0.75rem; }
.generated-content ul, .generated-content ol { margin: 0.5rem 0 1rem 1.5rem; }
.generated-content li { margin-bottom: 0.35rem; }
.generated-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.generated-content th, .generated-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 0.85rem;
}
.generated-content th { background: var(--cream); font-weight: 600; }

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--warm);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.6; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; max-width: 320px; margin: 0 auto 1.5rem; }

/* ── Steps ── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.step {
  flex: 1;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.step:last-child { border-right: none; }
.step.active { background: var(--accent); color: var(--white); }
.step.completed { background: var(--accent-light); color: var(--accent); }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--warm);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.5rem;
}
.step.active .step-num { background: rgba(255,255,255,0.25); color: var(--white); }
.step.completed .step-num { background: var(--accent); color: var(--white); }

/* ── Print Styles ── */
@media print {
  .sidebar, .page-header, .btn-group, .steps, .no-print { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
  .generated-content { border: none; box-shadow: none; padding: 0; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    bottom: 0; top: auto; left: 0; right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
  }
  .sidebar-header, .sidebar-footer { display: none; }
  .sidebar-nav {
    flex-direction: row;
    padding: 0.5rem;
    overflow-x: auto;
    gap: 2px;
  }
  .nav-item {
    flex-direction: column;
    padding: 0.5rem;
    font-size: 0.7rem;
    gap: 0.2rem;
    min-width: 60px;
    text-align: center;
  }
  .nav-icon { font-size: 1.2rem; }
  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem 5rem;
  }
  .form-row { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .steps { flex-direction: column; }
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--cream);
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone-icon { font-size: 2rem; margin-bottom: 0.5rem; opacity: 0.5; }
.upload-zone p { font-size: 0.85rem; color: var(--muted); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Mobile Menu Toggle ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  padding: 0.75rem 1rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
  align-items: center;
}
.mobile-header .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}
.mobile-header .logo span { color: var(--accent); }
.mobile-user {
  font-size: 0.8rem;
  color: var(--muted);
}
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .main-content { padding-top: 4rem; }
}
