/* ==========================================================================
   Veld Studio — Project Management App Styles
   ========================================================================== */

@import url('variables.css');

:root {
  --sidebar-w: 240px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'DM Sans', sans-serif; background: var(--sand-light); color: var(--bark); overflow: hidden; }

/* ── LOGIN ── */
#loginScreen {
  position: fixed; inset: 0;
  background: var(--bark);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; flex-direction: column; gap: 0;
}

.login-box {
  background: var(--cream); border-radius: 20px;
  padding: 48px 44px; width: 100%; max-width: 400px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4);
}

.login-logo {
  font-family: 'Cormorant Garamond', serif; font-size: 26px;
  font-weight: 600; color: var(--bark); letter-spacing: 0.08em; margin-bottom: 8px;
}
.login-logo em { color: var(--terra); font-style: italic; }

.login-sub {
  font-size: 13px; color: var(--muted); font-weight: 300; margin-bottom: 36px;
}

.login-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bark-light); font-weight: 500; margin-bottom: 6px; display: block;
}

.login-input {
  width: 100%; border: 1.5px solid var(--sand-dark); border-radius: 8px;
  padding: 12px 16px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--bark); background: var(--sand-light); outline: none;
  transition: border-color 0.2s; margin-bottom: 16px;
}
.login-input:focus { border-color: var(--terra); }

.login-btn {
  width: 100%; background: var(--terra); color: white; border: none;
  border-radius: 8px; padding: 14px; font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.2s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--bark); }

.login-err { font-size: 12px; color: var(--danger); margin-top: 8px; display: none; }

.login-mode-badge {
  display: none; margin-top: 16px; padding: 6px 12px;
  font-size: 11px; color: var(--muted); background: var(--sand-light);
  border-radius: 6px; text-align: center; letter-spacing: 0.03em;
}

.login-tabs {
  display: flex; gap: 0; margin-bottom: 28px;
  border: 1.5px solid var(--sand-dark); border-radius: 8px; overflow: hidden;
}

.login-tab {
  flex: 1; padding: 10px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; background: transparent; color: var(--muted);
  transition: all 0.2s; font-family: 'DM Sans', sans-serif;
}
.login-tab.active { background: var(--bark); color: var(--sand); }

/* ── SHELL ── */
#appShell {
  display: none; height: 100vh;
  grid-template-columns: var(--sidebar-w) 1fr;
}
#appShell.visible { display: grid; }

/* ── SIDEBAR ── */
.sidebar {
  background: var(--bark); display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }

.sidebar-logo-text {
  font-family: 'Cormorant Garamond', serif; font-size: 20px;
  font-weight: 600; color: var(--sand); letter-spacing: 0.08em;
}
.sidebar-logo-text em { color: var(--terra-light); font-style: italic; }

.sidebar-logo-sub {
  font-size: 10px; color: rgba(242,232,208,0.3);
  letter-spacing: 0.12em; text-transform: uppercase; margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section {
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  color: rgba(242,232,208,0.25); padding: 12px 20px 6px; font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  cursor: pointer; transition: all 0.15s; border-left: 2px solid transparent;
  font-size: 13px; color: rgba(242,232,208,0.55); font-weight: 400;
}
.nav-item:hover { color: var(--sand); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--sand); background: rgba(255,255,255,0.07); border-left-color: var(--terra-light); }

.nav-icon { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }

.nav-badge {
  margin-left: auto; background: var(--terra); color: white;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
}

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--terra);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 14px;
  color: white; font-weight: 600; flex-shrink: 0;
}

.user-name { font-size: 12px; color: var(--sand); font-weight: 500; }
.user-role { font-size: 10px; color: rgba(242,232,208,0.35); font-weight: 300; }

.logout-btn {
  margin-left: auto; background: none; border: none;
  color: rgba(242,232,208,0.3); cursor: pointer; font-size: 11px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--terra-light); }

/* ── MAIN ── */
.main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: 60px; background: var(--cream); border-bottom: 1px solid var(--sand-dark);
  display: flex; align-items: center; padding: 0 28px; gap: 16px; flex-shrink: 0;
}

.topbar-title {
  font-family: 'Cormorant Garamond', serif; font-size: 22px;
  font-weight: 400; color: var(--bark);
}
.topbar-title em { font-style: italic; color: var(--terra); }

.topbar-actions { margin-left: auto; display: flex; gap: 10px; }

.btn {
  border: none; border-radius: 7px; padding: 9px 18px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--terra); color: white; }
.btn-primary:hover { background: var(--bark); }
.btn-ghost { background: transparent; color: var(--bark); border: 1.5px solid var(--sand-dark); }
.btn-ghost:hover { border-color: var(--terra); color: var(--terra); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── DASHBOARD ── */
.dns-alert-bar {
  background: #FFF3E0; border: 1.5px solid #E67E22; border-radius: 10px;
  padding: 14px 18px; margin-bottom: 20px; font-size: 13px; color: var(--bark); line-height: 1.6;
}
.dns-alert-project {
  display: inline-block; background: rgba(230,126,34,0.12); padding: 2px 10px; border-radius: 6px;
  margin: 4px 4px 0 0; cursor: pointer; font-weight: 500; font-size: 12px;
}
.dns-alert-project:hover { background: rgba(230,126,34,0.22); }
.dns-task-box {
  background: #FFF3E0; border: 1px solid #E67E22; border-radius: 8px;
  padding: 12px 14px; margin-top: 10px; font-size: 12px; color: var(--bark); line-height: 1.6;
}
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }

.stat-card {
  background: var(--white); border-radius: 12px; padding: 20px;
  border: 1px solid var(--sand-dark);
}

.stat-card-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 8px;
}

.stat-card-num {
  font-family: 'Cormorant Garamond', serif; font-size: 36px;
  font-weight: 300; color: var(--bark); line-height: 1;
}
.stat-card-num em { color: var(--terra); font-style: normal; }

.stat-card-sub { font-size: 11px; color: var(--muted); font-weight: 300; margin-top: 4px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.section-title {
  font-family: 'Cormorant Garamond', serif; font-size: 20px;
  font-weight: 400; color: var(--bark);
}

/* ── PROJECTS TABLE ── */
.projects-table {
  background: var(--white); border-radius: 12px;
  border: 1px solid var(--sand-dark); overflow: hidden;
}

.table-head {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 120px;
  padding: 12px 20px; background: var(--sand-light);
  border-bottom: 1px solid var(--sand-dark);
}

.th {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}

.table-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 120px;
  padding: 14px 20px; border-bottom: 1px solid var(--sand-light);
  align-items: center; transition: background 0.15s; cursor: pointer;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--sand-light); }

.td { font-size: 13px; color: var(--bark); font-weight: 400; }
.td-name { font-weight: 500; }
.td-muted { color: var(--muted); font-weight: 300; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500;
}
.status-draft { background: rgba(184,98,62,0.1); color: var(--terra); }
.status-review { background: rgba(110,143,104,0.12); color: var(--sage-dark); }
.status-approval { background: rgba(230,126,34,0.12); color: var(--warning); }
.status-build { background: rgba(44,31,18,0.08); color: var(--bark-mid); }
.status-live { background: rgba(39,174,96,0.1); color: var(--success); }

/* ── PROJECT DETAIL ── */
.project-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px; height: 100%;
}

.project-sidebar-panel { display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--white); border-radius: 12px;
  border: 1px solid var(--sand-dark); overflow: hidden;
}

.panel-header {
  padding: 16px 20px; border-bottom: 1px solid var(--sand-light);
  display: flex; align-items: center; justify-content: space-between;
}

.panel-title {
  font-family: 'Cormorant Garamond', serif; font-size: 17px;
  font-weight: 400; color: var(--bark);
}

.panel-body { padding: 20px; }

.pages-list { display: flex; flex-direction: column; gap: 8px; }

.page-item {
  border: 1.5px solid var(--sand-dark); border-radius: 8px; overflow: hidden;
}

.page-header {
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; background: var(--sand-light); transition: background 0.15s;
}
.page-header:hover { background: var(--sand-dark); }

.page-name { font-size: 13px; font-weight: 500; color: var(--bark); flex: 1; }

.page-body {
  padding: 16px; display: none; border-top: 1px solid var(--sand-dark);
}
.page-body.open { display: block; }

.page-copy {
  font-size: 13px; color: var(--bark); line-height: 1.7; font-weight: 300;
  white-space: pre-wrap; background: var(--sand-light);
  padding: 14px; border-radius: 6px; margin-bottom: 12px;
  max-height: 200px; overflow-y: auto;
}
.page-copy.generating { color: var(--muted); font-style: italic; }

.edit-area {
  width: 100%; min-height: 120px; border: 1.5px solid var(--sand-dark);
  border-radius: 6px; padding: 12px; font-family: 'DM Sans', sans-serif;
  font-size: 13px; color: var(--bark); line-height: 1.7; outline: none;
  resize: vertical; transition: border-color 0.2s;
}
.edit-area:focus { border-color: var(--sage); }

.page-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Client Feedback */
.feedback-item {
  background: var(--sand-light); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 8px; border-left: 3px solid var(--terra);
}
.feedback-from {
  font-size: 11px; color: var(--terra); font-weight: 500;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.06em;
}
.feedback-text { font-size: 13px; color: var(--bark); line-height: 1.6; font-weight: 300; }
.feedback-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Info rows */
.info-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--sand-light);
}
.info-row:last-child { border-bottom: none; }
.info-key { font-size: 12px; color: var(--muted); font-weight: 400; }
.info-val { font-size: 12px; color: var(--bark); font-weight: 500; text-align: right; max-width: 60%; }

/* Progress Steps */
.progress-steps { display: flex; flex-direction: column; gap: 0; }

.progress-step { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; position: relative; }

.step-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; margin-top: 1px;
}
.step-dot.done { background: var(--sage); color: white; }
.step-dot.active { background: var(--terra); color: white; }
.step-dot.pending { background: var(--sand-dark); color: var(--muted); }

.step-label { font-size: 13px; font-weight: 400; }
.step-label.done { color: var(--muted); text-decoration: line-through; }
.step-label.active { color: var(--bark); font-weight: 500; }
.step-label.pending { color: var(--muted); }

/* ── NEW PROJECT FORM ── */
.form-group { margin-bottom: 18px; }

.form-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bark-light); font-weight: 500; margin-bottom: 6px; display: block;
}

.form-input {
  width: 100%; border: 1.5px solid var(--sand-dark); border-radius: 8px;
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--bark); background: var(--white); outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--terra); }

.form-select {
  width: 100%; border: 1.5px solid var(--sand-dark); border-radius: 8px;
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--bark); background: var(--white); outline: none; appearance: none;
}

.form-textarea {
  width: 100%; border: 1.5px solid var(--sand-dark); border-radius: 8px;
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  color: var(--bark); background: var(--white); outline: none;
  resize: vertical; min-height: 80px;
}
.form-textarea:focus { border-color: var(--terra); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(44,31,18,0.6); z-index: 500;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--cream); border-radius: 16px; padding: 36px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
}

/* ── CLIENT PORTAL ── */
.portal-header { max-width: 720px; margin: 0 auto 32px; }

.portal-logo {
  font-family: 'Cormorant Garamond', serif; font-size: 22px;
  font-weight: 600; letter-spacing: 0.08em; color: var(--bark); margin-bottom: 4px;
}
.portal-logo em { color: var(--terra); font-style: italic; }

.portal-greeting {
  font-family: 'Cormorant Garamond', serif; font-size: 30px;
  font-weight: 300; color: var(--bark); margin-bottom: 8px;
}
.portal-greeting em { font-style: italic; color: var(--terra); }

.portal-sub { font-size: 14px; color: var(--muted); font-weight: 300; line-height: 1.6; }

.portal-progress {
  max-width: 720px; margin: 0 auto 28px; background: var(--white);
  border-radius: 12px; padding: 20px 24px; border: 1px solid var(--sand-dark);
}

.portal-prog-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; font-weight: 500;
}

.portal-prog-bar {
  height: 6px; background: var(--sand-dark); border-radius: 6px; overflow: hidden;
}

.portal-prog-fill {
  height: 100%; background: linear-gradient(90deg, var(--sage), var(--terra));
  border-radius: 6px; transition: width 0.5s ease;
}

.portal-prog-steps { display: flex; justify-content: space-between; margin-top: 8px; }
.portal-prog-step { font-size: 11px; color: var(--muted); font-weight: 300; }
.portal-prog-step.active { color: var(--terra); font-weight: 500; }

.portal-page {
  max-width: 720px; margin: 0 auto 16px; background: var(--white);
  border-radius: 12px; border: 1px solid var(--sand-dark); overflow: hidden;
}

.portal-page-head {
  padding: 16px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--sand-light);
}

.portal-page-name {
  font-family: 'Cormorant Garamond', serif; font-size: 18px;
  font-weight: 400; color: var(--bark); flex: 1;
}

.portal-page-body { padding: 20px; }

.portal-copy {
  font-size: 14px; color: var(--bark); line-height: 1.8; font-weight: 300;
  margin-bottom: 20px; white-space: pre-wrap;
}

.portal-divider { height: 1px; background: var(--sand-light); margin: 16px 0; }

.portal-feedback-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 8px;
}

.portal-feedback-input {
  width: 100%; border: 1.5px solid var(--sand-dark); border-radius: 8px;
  padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 13px;
  color: var(--bark); outline: none; resize: vertical; min-height: 72px;
  transition: border-color 0.2s; background: var(--sand-light);
}

.portal-page-actions { display: flex; gap: 10px; margin-top: 12px; }

.approve-btn {
  background: var(--sage); color: white; border: none; border-radius: 7px;
  padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all 0.2s;
}
.approve-btn:hover { background: var(--sage-dark); }
.approve-btn.approved { background: var(--sage-dark); opacity: 0.7; }

.feedback-btn {
  background: transparent; color: var(--terra); border: 1.5px solid var(--terra);
  border-radius: 7px; padding: 10px 20px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.2s;
}
.feedback-btn:hover { background: var(--terra); color: white; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bark); color: var(--sand);
  padding: 12px 20px; border-radius: 8px; font-size: 13px; font-weight: 400;
  z-index: 999; opacity: 0; transform: translateY(8px);
  transition: all 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--sage-dark); }
.toast.error { background: var(--danger); }

/* ── LOADING SPINNER ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.3; }
.empty-title {
  font-family: 'Cormorant Garamond', serif; font-size: 22px;
  font-weight: 300; color: var(--bark); margin-bottom: 8px;
}
.empty-sub { font-size: 13px; color: var(--muted); font-weight: 300; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand-dark); border-radius: 4px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  #appShell.visible { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .project-layout { grid-template-columns: 1fr; }
  .table-head, .table-row { grid-template-columns: 2fr 1fr 1fr; }
  .table-head .th:nth-child(4),
  .table-head .th:nth-child(5),
  .table-row > div:nth-child(4),
  .table-row > div:nth-child(5) { display: none; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px 16px; }
  .stat-card-num { font-size: 22px; }
  .section-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .panel-body { padding: 14px; }
  .form-input, .form-select, .form-textarea { font-size: 14px; }
  .topbar { padding: 12px 16px; }
  .topbar-title { font-size: 16px; }
  .content { padding: 16px; }
  .login-box { padding: 24px 16px; width: 100%; max-width: none; }
  .login-input { font-size: 14px; }
  .table-head, .table-row { grid-template-columns: 2fr 1fr; }
  .table-head .th:nth-child(2),
  .table-row > div:nth-child(2) { display: none; }
  .page-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .sidebar-footer { padding: 12px; }
}

/* ── EXPORT PANEL ── */
.export-actions {
  display: flex; flex-direction: column; gap: 6px;
}

.export-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; justify-content: flex-start;
  text-align: left; font-size: 12px;
}

.export-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px; font-size: 11px;
  background: var(--sand-light); color: var(--bark-mid); flex-shrink: 0;
  font-weight: 600; font-family: 'DM Sans', monospace;
}

/* ── SITE PREVIEW ── */
.preview-device-btn {
  background: var(--sand-light); border: 1px solid var(--sand-dark); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.preview-device-btn.active {
  background: var(--bark); border-color: var(--bark); filter: none;
}
.preview-device-btn:hover { background: var(--sand); }
