/* ============================================
   GLOBAL DESIGN TOKENS
   Content Studio — Content Production & Publishing Dashboard
   Design language derived from reference dashboard images
   ============================================ */

:root {
  /* Brand */
  --brand-primary: #C026D3;
  --brand-primary-hover: #A821B8;
  --brand-secondary: #8B5CF6;
  --brand-gradient: linear-gradient(135deg, #C026D3 0%, #8B5CF6 100%);

  /* Status colors */
  --color-success: #22C55E;
  --color-success-bg: rgba(34, 197, 94, 0.12);
  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-info: #3B82F6;
  --color-info-bg: rgba(59, 130, 246, 0.12);
  --color-neutral: #94A3B8;
  --color-neutral-bg: rgba(148, 163, 184, 0.12);

  /* Platform brand colors */
  --platform-tiktok: #ffffff;
  --platform-instagram: #E1306C;
  --platform-facebook: #1877F2;
  --platform-youtube: #FF0000;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.9375rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 1.75rem;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-base: 1.5;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Layout */
  --sidebar-width: 60px;
  --topbar-height: 68px;
  --content-max-width: 1400px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;

  /* ===== LIGHT THEME (default) ===== */
  --bg-app: #F5F4F8;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #FAFAFC;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F3F0F7;
  --bg-input: #FFFFFF;
  --bg-tag: #F3F0F7;

  --border-color: #ECEBF2;
  --border-color-strong: #E0DEE8;

  --text-primary: #1A1523;
  --text-secondary: #6B6478;
  --text-tertiary: #9C97A8;
  --text-inverse: #FFFFFF;
}

[data-theme="dark"] {
  --bg-app: #0F0D14;
  --bg-surface: #17141F;
  --bg-surface-alt: #1D1926;
  --bg-sidebar: #17141F;
  --bg-hover: #241F2E;
  --bg-input: #1D1926;
  --bg-tag: #241F2E;

  --border-color: #2A2534;
  --border-color-strong: #363043;

  --text-primary: #F3F1F7;
  --text-secondary: #9C97A8;
  --text-tertiary: #6B6478;
  --text-inverse: #17141F;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background: var(--bg-app);
  transition: background var(--transition-base), color var(--transition-base);
  min-height: 100vh;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-content {
  padding: var(--space-6) var(--space-8) var(--space-10);
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
}

.page-header {
  margin-bottom: var(--space-6);
}

.page-header h1 {
  font-size: var(--font-size-2xl);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.breadcrumb {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.breadcrumb a {
  color: var(--text-tertiary);
}

.breadcrumb a:hover {
  color: var(--text-secondary);
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-header h2 {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

/* ============================================
   CARD
   ============================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.link-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.pillar-tag {
  display: inline-block;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  background: var(--bg-tag);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.link-all:hover {
  color: var(--brand-primary);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.field {
  margin-bottom: var(--space-5);
}

.field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.field-hint {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-tertiary);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%239C97A8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-tag);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-xs);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  padding: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   TABLE
   ============================================ */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-tertiary);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-1);
}

.empty-state-text {
  font-size: var(--font-size-sm);
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-color-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  min-width: 260px;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast.success .toast-dot { background: var(--color-success); }
.toast.error .toast-dot { background: var(--color-danger); }
.toast.info .toast-dot { background: var(--color-info); }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color-strong);
  border-radius: var(--radius-full);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .main-area {
    margin-left: 0;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .page-content {
    padding: var(--space-4);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
