/* ===== AdAutomate Dashboard — Design System ===== */

:root {
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-light: #EEF2FF;
  --sidebar: #1E293B;
  --sidebar-hover: #334155;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #334155;
  --text-muted: #94A3B8;
  --text-light: #F8FAFC;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input { font-family: inherit; }

.hidden { display: none !important; }

/* ===== AUTH SCREEN ===== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sidebar) 0%, #0F172A 100%);
  padding: 1rem;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--primary);
  color: white;
}

.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.active { display: flex; }

.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}
.form-group input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: var(--transition);
  outline: none;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}

.auth-footer-text {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.link-muted { color: var(--primary); cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-full { width: 100%; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-screen {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-light);
}
.sidebar-toggle {
  display: none;
  color: var(--text-light);
  font-size: 1.25rem;
  background: none;
  border: none;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--text-light); }
.nav-item.active { background: var(--primary); color: white; }
.nav-icon { font-size: 1.125rem; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}
.user-name { font-size: 0.8125rem; font-weight: 600; }
.user-plan { font-size: 0.6875rem; color: var(--text-muted); text-transform: uppercase; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  max-width: calc(100vw - 240px);
}

/* ===== HEADER ===== */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.header-left { flex: 1; }
.greeting { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.header-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }
.header-right { display: flex; align-items: center; gap: 0.75rem; }

.plan-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.plan-badge[data-plan="free"] { background: var(--primary-light); color: var(--primary); }
.plan-badge[data-plan="pro"] { background: var(--success-light); color: var(--success); }
.plan-badge[data-plan="agency"] { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #92400E; }

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card:nth-child(2) { border-left-color: var(--success); }
.stat-card:nth-child(3) { border-left-color: var(--warning); }
.stat-icon { font-size: 1.75rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); }

/* ===== SECTION ===== */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ===== LAUNCHPAD GRID ===== */
.launchpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 2px solid transparent;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tool-card.accessible:hover { border-color: var(--primary); }
.tool-card.accessible { cursor: pointer; }
.tool-card.locked { cursor: not-allowed; opacity: 0.7; filter: grayscale(0.6); }

.tool-card-icon { font-size: 2rem; }
.tool-card-name { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.tool-card-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.4; }
.tool-card-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}
.tool-card-badge.active { background: var(--success-light); color: var(--success); }
.tool-card-badge.coming_soon { background: var(--primary-light); color: var(--primary); }
.tool-card-badge.locked { background: #FEE2E2; color: #DC2626; }

.tool-card-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 1.25rem;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions { margin-bottom: 2rem; }
.quick-actions-row {
  display: flex;
  gap: 1rem;
}
.quick-action-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.9375rem;
}
.quick-action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); background: var(--primary-light); }
.qa-icon { font-size: 1.5rem; }

/* ===== FOOTER ===== */
.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--primary); }

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A;
    --surface: #1E293B;
    --border: #334155;
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --sidebar: #0B1121;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  }
  .tool-card.locked { opacity: 0.5; filter: grayscale(0.8); }
  .form-group input { background: var(--sidebar); color: var(--text); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .launchpad-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; max-width: 100vw; padding: 1rem; }
  .stats-row { grid-template-columns: 1fr; }
  .launchpad-grid { grid-template-columns: 1fr; }
  .quick-actions-row { flex-direction: column; }
  .dashboard-header { flex-direction: column; gap: 1rem; }
}
