/* =============================================
   MintReels Dashboard — Command Center Styles
   ============================================= */

/* Layout */
.dash-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  padding-left: 4px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--mint);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
  letter-spacing: 0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: var(--mint-dim);
  color: var(--fg);
}

.nav-item.active {
  background: var(--mint-dim);
  color: var(--mint);
  border: 1px solid rgba(61, 255, 162, 0.15);
}

.nav-icon {
  font-size: 0.75rem;
  opacity: 0.7;
}

.sidebar-footer {
  color: var(--fg-muted);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color 0.15s;
  margin-top: 8px;
}

.sidebar-footer:hover {
  color: var(--mint);
}

/* ---- Main ---- */
.dash-main {
  margin-left: 220px;
  flex: 1;
  padding: 40px 48px;
  max-width: 1200px;
}

/* Tab panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Panel header */
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.panel-subtitle {
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--mint);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---- Form elements ---- */
.dash-input {
  width: 100%;
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

.dash-input:focus {
  border-color: rgba(61, 255, 162, 0.4);
}

.dash-input::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

.dash-select {
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 10px 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.field-group label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.field-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* ---- Script Generator Card ---- */
.generator-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 36px;
}

.generator-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.gen-badge {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--mint);
  background: var(--mint-dim);
  border: 1px solid rgba(61, 255, 162, 0.2);
  padding: 3px 10px;
  border-radius: 100px;
}

.generator-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
}

.gen-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.niche-grid,
.platform-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.niche-btn,
.platform-btn {
  background: #161616;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.niche-btn:hover,
.platform-btn:hover {
  border-color: rgba(61, 255, 162, 0.3);
  color: var(--fg);
}

.niche-btn.active,
.platform-btn.active {
  background: var(--mint-dim);
  border-color: rgba(61, 255, 162, 0.4);
  color: var(--mint);
}

.gen-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-generate {
  background: var(--mint);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-generate:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

.gen-icon {
  font-size: 1rem;
}

.save-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-muted);
  font-size: 0.875rem;
  cursor: pointer;
}

.save-toggle input {
  accent-color: var(--mint);
}

/* Generated output */
.gen-output {
  margin-top: 24px;
}

.output-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.output-divider::before,
.output-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.output-divider span {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.script-preview {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.script-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--mint);
}

.script-section p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--fg);
  white-space: pre-wrap;
}

.script-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.8rem;
}

/* Library */
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.library-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.filter-row {
  display: flex;
  gap: 10px;
}

.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.script-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
  cursor: pointer;
}

.script-card:hover {
  border-color: rgba(61, 255, 162, 0.2);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  flex: 1;
}

.card-niche {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
  background: var(--mint-dim);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.card-hook {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.card-platform {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.status-pill {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-draft { color: #888; background: rgba(136,136,136,0.1); }
.status-ready { color: #f59e0b; background: rgba(245,158,11,0.1); }
.status-published { color: var(--mint); background: var(--mint-dim); }
.status-scheduled { color: #60a5fa; background: rgba(96,165,250,0.1); }
.status-cancelled { color: #ef4444; background: rgba(239,68,68,0.1); }
.status-active { color: var(--mint); background: var(--mint-dim); }
.status-paused { color: #f59e0b; background: rgba(245,158,11,0.1); }
.status-inactive { color: #888; background: rgba(136,136,136,0.1); }

.card-actions {
  display: flex;
  gap: 6px;
}

.card-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s;
}

.card-btn:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.2);
}

.card-btn.danger:hover {
  color: #ef4444;
  border-color: rgba(239,68,68,0.3);
}

/* ---- Calendar ---- */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.cal-month-label {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
  min-width: 200px;
  text-align: center;
}

.calendar-grid {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 36px;
}

.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}

.cal-dow {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 0;
  text-align: center;
}

.cal-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 90px;
  padding: 8px;
  position: relative;
}

.cal-day:nth-child(7n) {
  border-right: none;
}

.cal-day-num {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.cal-day.today .cal-day-num {
  color: var(--mint);
  font-weight: 700;
}

.cal-day.other-month {
  opacity: 0.3;
}

.cal-event-dot {
  font-size: 0.7rem;
  color: var(--fg-muted);
  background: var(--mint-dim);
  border-left: 2px solid var(--mint);
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.12s;
}

.cal-event-dot:hover {
  background: rgba(61, 255, 162, 0.2);
}

/* Upcoming list */
.upcoming-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--fg);
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s;
}

.event-row:hover {
  border-color: rgba(61, 255, 162, 0.2);
}

.event-date-block {
  text-align: center;
  min-width: 44px;
  background: var(--mint-dim);
  border-radius: 6px;
  padding: 6px 8px;
}

.event-date-day {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mint);
  line-height: 1;
}

.event-date-mon {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
}

.event-info {
  flex: 1;
}

.event-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 3px;
}

.event-platforms {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.event-time {
  font-family: 'Space Mono', monospace;
  font-size: 0.78rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.event-actions {
  display: flex;
  gap: 6px;
}

/* ---- Affiliate Links ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--mint);
  margin-bottom: 4px;
}

.stat-key {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.15s;
}

.link-row:hover {
  border-color: rgba(61, 255, 162, 0.15);
}

.link-info {
  flex: 1;
}

.link-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 3px;
}

.link-partner {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.link-commission {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  color: var(--mint);
  white-space: nowrap;
}

.link-metrics {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  min-width: 100px;
}

.link-revenue {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.link-clicks {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.link-url-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
  display: flex;
  align-items: center;
}

.link-url-btn:hover {
  color: var(--mint);
  border-color: rgba(61, 255, 162, 0.3);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.12s;
}

.modal-close:hover {
  color: var(--fg);
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.checkbox-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--mint);
}

/* ---- Loading / Empty States ---- */
.loading-state,
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.875rem;
  color: var(--fg);
  z-index: 2000;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.2s ease;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(61, 255, 162, 0.3);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-height: auto;
    position: relative;
    flex-direction: row;
    padding: 16px;
    align-items: center;
  }
  .sidebar-brand { margin-bottom: 0; }
  .sidebar-nav { flex-direction: row; flex: 1; justify-content: center; }
  .sidebar-footer { display: none; }
  .dash-body { flex-direction: column; }
  .dash-main { margin-left: 0; padding: 24px 20px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .field-row { flex-direction: column; }
  .scripts-grid { grid-template-columns: 1fr; }
}
