/* =====================================================
   AWC Admin Panel Stylesheet
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --sage:        #7A8C6E;
  --sage-light:  #A8B89A;
  --sage-dark:   #5C6E52;
  --cream:       #F7F4EF;
  --warm-white:  #FDFBF8;
  --charcoal:    #2C2C2C;
  --stone:       #6B6560;
  --gold:        #B8975A;
  --gold-light:  #D4B07A;
  --blush:       #E8D5C4;

  --sidebar-width: 240px;
  --topbar-height: 58px;
  --border: 1px solid rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 8px;
}

html, body { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--charcoal);
  background: #f2f4f1;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--sage-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.topbar-logo img { height: 30px; opacity: 0.9; }
.topbar-logo span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.01em;
}
.topbar-badge {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 0.18rem 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-right a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.2s;
}
.topbar-right a:hover { color: white; }
.topbar-right a.view-site {
  background: rgba(255,255,255,0.18);
  padding: 0.35rem 0.9rem;
  border-radius: 4px;
  font-weight: 500;
}
.topbar-right a.view-site:hover { background: rgba(255,255,255,0.28); }

/* ── LAYOUT SHELL ── */
.admin-shell {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: var(--border);
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-section-label {
  padding: 1.2rem 1.2rem 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  font-weight: 600;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  color: var(--charcoal);
  font-size: 0.86rem;
  border-radius: 0;
  transition: background 0.15s;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--cream); }
.sidebar-item.active {
  background: #edf2eb;
  color: var(--sage-dark);
  font-weight: 600;
  border-left-color: var(--sage);
}
.sidebar-item .icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--charcoal);
}
.page-header .subtitle { font-size: 0.83rem; color: var(--stone); margin-top: 0.15rem; }
.header-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn-primary { background: var(--sage); color: white; }
.btn-primary:hover { background: var(--sage-dark); }
.btn-save { background: var(--gold); color: white; }
.btn-save:hover { background: var(--gold-light); }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-ghost { background: transparent; color: var(--stone); border: 1px solid rgba(0,0,0,0.15); }
.btn-ghost:hover { background: var(--cream); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.76rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--charcoal);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(4px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--sage-dark); }
.toast.error { background: #c0392b; }

/* ── CARD ── */
.card {
  background: white;
  border-radius: var(--radius);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.card-body { padding: 1.25rem; }
.card-body + .card-body { border-top: var(--border); }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 1.1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 0.35rem;
}
.form-label .hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #aaa;
  font-size: 0.73rem;
  margin-left: 0.3rem;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  color: var(--charcoal);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(122,140,110,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

/* ── SECTION EDITOR PANELS ── */
.editor-panel { display: none; }
.editor-panel.active { display: block; }

.editor-section {
  margin-bottom: 1.5rem;
}

/* ── REPEATER (array items) ── */
.repeater-item {
  background: #fafaf9;
  border: 1.5px solid rgba(0,0,0,0.08);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  position: relative;
}
.repeater-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.repeater-item-header .item-label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.repeater-item-actions { display: flex; gap: 0.35rem; }
.repeater-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: 1.5px dashed rgba(122,140,110,0.5);
  border-radius: 5px;
  color: var(--sage-dark);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}
.repeater-add:hover { background: #edf2eb; border-color: var(--sage); }

/* ── DASHBOARD ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: var(--border);
  box-shadow: var(--shadow-sm);
}
.metric-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 0.4rem;
}
.metric-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1;
}
.metric-sub { font-size: 0.74rem; color: var(--stone); margin-top: 0.3rem; }
.metric-card.accent { background: var(--sage); }
.metric-card.accent .metric-label,
.metric-card.accent .metric-value,
.metric-card.accent .metric-sub { color: white; }
.metric-card.accent .metric-label { opacity: 0.8; }

/* ── ACTIVITY FEED ── */
.activity-feed { list-style: none; }
.activity-feed li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: var(--border);
  font-size: 0.83rem;
}
.activity-feed li:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sage-light);
  flex-shrink: 0;
  margin-top: 4px;
}
.activity-feed .time { color: var(--stone); font-size: 0.76rem; white-space: nowrap; margin-left: auto; }

/* ── BADGE ── */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-green  { background: #e3f0df; color: #2e7d32; }
.badge-gold   { background: #fdf2df; color: #8a6020; }
.badge-gray   { background: #f0f0f0; color: #555; }
.badge-red    { background: #fde8e8; color: #c0392b; }
.badge-blue   { background: #e3eef8; color: #1a5a8a; }

/* ── PREVIEW FRAME ── */
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--charcoal);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.78rem;
}
.preview-bar .url-bar {
  background: rgba(255,255,255,0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  flex: 1;
  max-width: 320px;
  margin: 0 1rem;
  color: rgba(255,255,255,0.7);
}
.preview-frame {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: 0 0 var(--radius) var(--radius);
  display: block;
  background: white;
}

/* ── TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.data-table th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  border-bottom: 2px solid rgba(0,0,0,0.07);
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  color: var(--charcoal);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafaf9; }
.data-table td .actions { display: flex; gap: 0.4rem; }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.tab {
  padding: 0.6rem 1.1rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--stone);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'Inter', sans-serif;
}
.tab:hover { color: var(--charcoal); }
.tab.active { color: var(--sage-dark); border-bottom-color: var(--sage); font-weight: 600; }

/* ── SPLIT LAYOUT (editor + live preview) ── */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.split-layout .editor-col {}
.split-layout .preview-col {
  position: sticky;
  top: calc(var(--topbar-height) + 1.5rem);
}

/* ── INLINE EDIT HIGHLIGHT (shown in preview) ── */
[data-editable]:hover {
  outline: 2px dashed rgba(122,140,110,0.6);
  outline-offset: 2px;
  cursor: pointer;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .split-layout { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1rem; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
