/* Aurora Admin — shared styles
 * Multi-page static prototype.
 * Layout: 56px topbar + 240px sidebar + main content area.
 */

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

:root {
  --primary: #8B5FE8;
  --primary-dark: #5B3FAA;
  --primary-light: #C4A0FF;
  --primary-bg: rgba(139, 95, 232, 0.08);
  --primary-bg-strong: rgba(139, 95, 232, 0.16);

  --bg: #FFFFFF;
  --bg-muted: #FAFAFC;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --border: #ECECEF;
  --border-strong: #D8D8DE;
  --text: #0F0F12;
  --text-muted: #7B7689;
  --text-subtle: #9B96A8;

  --shadow-sm: 0 1px 2px rgba(15, 15, 18, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 15, 18, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 15, 18, 0.10);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --topbar-h: 56px;
  --sidebar-w: 240px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-muted);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Layout grid ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  min-height: 100vh;
}

/* ---------- Topbar ---------- */

.topbar {
  grid-area: topbar;
  background: #0F0F12;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  width: calc(var(--sidebar-w) - 20px);
}
.topbar-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-tenant {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 13px;
}
.topbar-tenant-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFC857, #FF7A59);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #1F1208;
  flex-shrink: 0;
}
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms;
}
.topbar-icon-btn:hover { background: rgba(255, 255, 255, 0.16); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  transition: background 120ms;
}
.topbar-user:hover { background: rgba(255, 255, 255, 0.06); }
.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.topbar-user-name { font-size: 13px; font-weight: 500; }

/* ---------- Sidebar ---------- */

.sidebar {
  grid-area: sidebar;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.nav-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 12px 12px 6px;
}
.nav-section:first-child { padding-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background 120ms, color 120ms;
}
.nav-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary-bg-strong);
  color: var(--primary);
  font-weight: 600;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item.active svg { opacity: 1; }

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

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-subtle);
}
.sidebar-footer strong { color: var(--text); }

/* ---------- Main content ---------- */

.main {
  grid-area: main;
  padding: 28px 36px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h));
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 120ms;
  border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }
.btn-danger { color: #C0252B; }
.btn-danger:hover { background: rgba(192, 37, 43, 0.08); }

/* ---------- Cards ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
}
.card-body { padding: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-change.up { color: #1A8556; }
.stat-change.down { color: #C0252B; }

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.field-input,
.field-select,
.field-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color 120ms, box-shadow 120ms;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 95, 232, 0.15);
}
.field-textarea { min-height: 80px; resize: vertical; font-family: inherit; }

.field-color {
  display: flex;
  gap: 8px;
  align-items: center;
}
.field-color input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  background: white;
}
.field-color input[type="text"] {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12.5px;
}

.field-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms;
}
.field-toggle:hover { background: var(--primary-bg); }
.field-toggle-info { flex: 1; }
.field-toggle-name { font-weight: 600; font-size: 13.5px; }
.field-toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: #D0D0D5;
  border-radius: 999px;
  transition: background 120ms;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 120ms;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }

/* ---------- Tags / Chips ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tag-success { background: rgba(26, 133, 86, 0.1); color: #1A8556; }
.tag-warn { background: rgba(255, 169, 0, 0.12); color: #B86E00; }
.tag-pro {
  background: linear-gradient(135deg, #FFC857, #FF7A59);
  color: #1F1208;
}

/* ---------- Tables ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-muted);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-muted); }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-desc { margin-bottom: 16px; }

/* ---------- Code block (for embed code) ---------- */

.code-block {
  position: relative;
  background: #1F1830;
  color: #E8E0F0;
  border-radius: var(--radius);
  padding: 18px 22px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.code-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.code-copy-btn:hover { background: rgba(255, 255, 255, 0.2); }
.code-copy-btn.copied {
  background: rgba(26, 133, 86, 0.6);
  color: white;
}

/* ---------- Drag-drop zone ---------- */

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  background: var(--bg-muted);
  transition: border-color 120ms, background 120ms;
  cursor: pointer;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-bg);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.dropzone-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.dropzone-hint { font-size: 13px; color: var(--text-muted); }

/* ---------- Two-column page (for Customizer) ---------- */

.two-col {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 28px;
  align-items: start;
}
.two-col-preview {
  position: sticky;
  top: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  height: 640px;
  display: flex;
  flex-direction: column;
}
.preview-header {
  background: linear-gradient(135deg, #2A2238, #1F1830);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}
.preview-stage {
  flex: 1;
  background:
    linear-gradient(135deg, #F4F1F9 25%, transparent 25%) -10px 0,
    linear-gradient(225deg, #F4F1F9 25%, transparent 25%) -10px 0,
    linear-gradient(315deg, #F4F1F9 25%, transparent 25%),
    linear-gradient(45deg, #F4F1F9 25%, transparent 25%);
  background-size: 20px 20px;
  background-color: #FAFAFC;
  position: relative;
  overflow: hidden;
}
.preview-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

@media (max-width: 1100px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .two-col-preview {
    position: static;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar { display: none; }
  .main { padding: 20px; }
  .topbar-brand { width: auto; }
}
