/* =========================================================
   Propostas DS — CSS do painel admin
   ========================================================= */

:root {
  --deep: #1A0533;
  --plum: #2D0B5C;
  --lilac: #B088C9;
  --lilac-soft: #E7D9F0;
  --lilac-bg: #F5ECFA;
  --accent: #E8006F;
  --white: #FFFFFF;
  --ink: #1F1230;
  --gray: #7A6D88;
  --line: #EAE2F2;
  --bg: #FAF7FC;
  --success: #16A34A;
  --danger: #B91C1C;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.display { font-family: 'Fredoka', sans-serif; }
.muted { color: var(--gray); }
.mono { font-family: monospace; }

/* ========== Login ========== */
.login-body {
  background: var(--deep);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(176,136,201,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(232,0,111,0.1) 0%, transparent 50%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.login-box {
  background: white; border-radius: 20px;
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--deep);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}

.login-box h1 {
  margin: 0; color: var(--deep); font-size: 28px; font-weight: 700;
}
.login-box .lead {
  margin: 4px 0 28px; color: var(--gray); font-size: 14px;
}
.login-box label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--deep); margin-bottom: 6px;
}
.login-box input {
  width: 100%; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; color: var(--ink);
  outline: none; margin-bottom: 16px;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.login-box input:focus { border-color: var(--lilac); }

/* ========== Header admin ========== */
.admin-header {
  background: white;
  border-bottom: 1px solid var(--line);
}
.admin-header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.admin-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
}
.admin-brand-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--deep);
  display: flex; align-items: center; justify-content: center;
}
.admin-brand-title {
  font-size: 18px; font-weight: 600; color: var(--deep);
}
.admin-brand-sub {
  font-size: 12px; color: var(--gray);
}
.admin-user {
  display: flex; align-items: center; gap: 14px;
  font-size: 14px;
}
.admin-user strong { color: var(--deep); }

/* ========== Nav (abas) ========== */
.admin-nav {
  background: white;
  border-bottom: 1px solid var(--line);
}
.admin-nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  display: flex; gap: 4px;
  overflow-x: auto;
}
.nav-item {
  padding: 14px 18px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-item:hover { color: var(--deep); }
.nav-item.active {
  color: var(--deep);
  font-weight: 600;
  border-bottom-color: var(--lilac);
}

/* ========== Container ========== */
.admin-container {
  max-width: 1200px; margin: 0 auto;
  padding: 32px 24px 64px;
}
.admin-container.narrow { max-width: 820px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--gray); text-decoration: none;
  font-size: 14px; margin-bottom: 16px;
}
.back-link:hover { color: var(--deep); }

/* ========== Page header ========== */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px; gap: 16px; flex-wrap: wrap;
}
.page-header.column { display: block; }
.page-header h1 {
  margin: 0; color: var(--deep); font-size: 28px; font-weight: 600;
}
.page-header .muted {
  margin: 4px 0 0; font-size: 14px;
}

/* ========== Botões ========== */
.btn-primary {
  background: var(--deep); color: white; border: none;
  padding: 12px 20px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(26,5,51,0.2);
  text-decoration: none; cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: var(--line); color: var(--gray);
  cursor: not-allowed; box-shadow: none; transform: none;
}

.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--lilac-bg); }

/* ========== Stats ========== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.stat-card {
  background: white; border-radius: 14px;
  padding: 20px; border: 1px solid var(--line);
}
.stat-label {
  font-size: 13px; color: var(--gray); margin-bottom: 8px;
}
.stat-value {
  font-size: 24px; font-weight: 600; color: var(--deep);
}

/* ========== Busca ========== */
.search-bar {
  position: relative; margin-bottom: 20px;
}
.search-icon {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%); color: var(--gray);
  pointer-events: none;
}
.search-bar input {
  width: 100%; padding: 14px 16px 14px 46px;
  background: white; border: 1px solid var(--line);
  border-radius: 12px; font-size: 14px; color: var(--ink);
  outline: none; font-family: inherit;
  transition: border-color 0.15s;
}
.search-bar input:focus { border-color: var(--lilac); }

/* ========== Lista de propostas ========== */
.proposals-list { display: grid; gap: 12px; }
.proposal-card {
  background: white; border-radius: 14px;
  padding: 20px; border: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  transition: border-color 0.2s;
}
.proposal-card:hover { border-color: var(--lilac); }
.proposal-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--lilac-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--deep); flex-shrink: 0;
}
.proposal-info { flex: 1; min-width: 200px; }
.proposal-name {
  font-size: 17px; font-weight: 600; color: var(--deep); margin-bottom: 2px;
}
.proposal-type {
  font-size: 13px; color: var(--gray); margin-bottom: 6px;
}
.proposal-link {
  font-size: 12px; color: var(--lilac);
  font-family: monospace; display: flex; align-items: center; gap: 4px;
}
.proposal-value { text-align: right; min-width: 120px; }
.proposal-price {
  font-size: 18px; font-weight: 600; color: var(--deep);
}
.proposal-date {
  font-size: 12px; color: var(--gray);
}
.proposal-actions {
  display: flex; gap: 6px;
}
.inline-form { display: inline-flex; margin: 0; padding: 0; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: transparent;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--deep); text-decoration: none; cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--lilac-bg); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: #FEE2E2; }

/* ========== Empty state ========== */
.empty-state {
  background: white; border: 1px dashed var(--line);
  border-radius: 16px; padding: 64px 24px; text-align: center;
}
.empty-icon {
  width: 64px; height: 64px; border-radius: 20px;
  margin: 0 auto 20px; background: var(--lilac-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--deep);
}
.empty-state h3 {
  margin: 0 0 8px; font-size: 20px; font-weight: 600; color: var(--deep);
}
.empty-state p {
  margin: 0 0 20px; color: var(--gray); font-size: 14px;
}

/* ========== Alerts ========== */
.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; margin-bottom: 16px; line-height: 1.5;
}
.alert-success { background: #DCFCE7; color: #15803D; }
.alert-error { background: #FEE2E2; color: #B91C1C; }

/* ========== Formulário ========== */
.form-section {
  background: white; border-radius: 16px; padding: 24px;
  border: 1px solid var(--line); margin-bottom: 16px;
}
.form-section-title {
  margin: 0 0 20px; font-size: 16px; font-weight: 600; color: var(--deep);
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink); margin-bottom: 6px;
}
.req { color: var(--accent); }
.hint { font-size: 12px; color: var(--gray); margin-top: 6px; display: block; }

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

.field input[type=text],
.field input[type=number],
.field textarea,
.field select {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; color: var(--ink);
  outline: none; font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--lilac);
}

.slug-group {
  display: flex; align-items: center; gap: 8px;
}
.slug-prefix {
  font-size: 13px; color: var(--gray);
  font-family: monospace; white-space: nowrap;
}

.array-field {
  display: flex; flex-direction: column; gap: 8px;
}
.array-row {
  display: flex; gap: 8px; align-items: center;
}
.array-row input {
  flex: 1; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; color: var(--ink);
  outline: none; font-family: 'DM Sans', sans-serif;
}
.array-row input:focus { border-color: var(--lilac); }

.btn-add {
  margin-top: 10px; background: transparent;
  border: 1px dashed var(--lilac); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; color: var(--deep); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; font-family: inherit;
}
.btn-add:hover { background: var(--lilac-bg); }

.form-actions {
  display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px;
}

/* ========== Toast ========== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--deep); color: white;
  padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 40px rgba(26,5,51,0.3);
  opacity: 0; pointer-events: none;
  transition: all 0.25s;
  z-index: 100;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ========== Portfolio admin ========== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.portfolio-card {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 0.2s;
}
.portfolio-card:hover { border-color: var(--lilac); }
.portfolio-thumb {
  aspect-ratio: 4/5;
  overflow: hidden;
  background: var(--lilac-bg);
}
.portfolio-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  display: block;
}
.portfolio-info {
  padding: 14px 16px;
  flex: 1;
}
.portfolio-title {
  font-size: 15px; font-weight: 600;
  color: var(--deep);
  margin-bottom: 4px;
}
.portfolio-url {
  font-size: 12px; color: var(--gray);
  text-decoration: none;
  display: inline-block;
  word-break: break-all;
}
.portfolio-url:hover { color: var(--accent); }
.portfolio-actions {
  display: flex; gap: 6px;
  padding: 0 12px 12px;
}

/* ========== Upload de imagem ========== */
.field input[type=file] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px dashed var(--lilac);
  border-radius: 8px;
  font-size: 13px; color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.field input[type=file]::file-selector-button {
  background: var(--deep);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  margin-right: 12px;
  cursor: pointer;
  font-family: inherit;
}
.field input[type=file]::file-selector-button:hover {
  background: var(--plum);
}

.current-image {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--lilac-bg);
  border-radius: 10px;
  text-align: center;
}
.current-image img {
  max-width: 240px;
  max-height: 280px;
  border-radius: 8px;
  display: block;
  margin: 0 auto 10px;
}
.current-image-label {
  font-size: 12px;
  color: var(--gray);
}

.remove-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--gray);
  cursor: pointer;
}
.remove-checkbox input[type=checkbox] {
  width: auto;
  margin: 0;
}

/* ========== Responsivo ========== */
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .proposal-card { flex-direction: column; align-items: stretch; }
  .proposal-value { text-align: left; }
  .proposal-actions { justify-content: stretch; }
  .proposal-actions .icon-btn, .proposal-actions .inline-form { flex: 1; }
  .proposal-actions .inline-form .icon-btn { width: 100%; }
  .admin-header-inner { flex-wrap: wrap; }
}
