/* =====================================================
   Meta Ads Manager - Design System & Modern Glassmorphic CSS
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-meta: #0064e0;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #0064e0 0%, #8b5cf6 50%, #06b6d4 100%);
  --accent-glow: 0 0 25px rgba(0, 100, 224, 0.35);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 100, 224, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.12) 0%, transparent 45%);
  background-attachment: fixed;
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 28px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
  font-size: 24px;
}

.brand-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title span {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  flex-grow: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 100, 224, 0.25) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(0, 100, 224, 0.4);
  box-shadow: 0 4px 15px rgba(0, 100, 224, 0.2);
}

.nav-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

/* Sidebar Footer (Status Badge) */
.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

.mode-badge-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-info h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.mode-status-text {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.demo {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 36px 40px;
  max-width: 1300px;
  margin: 0 auto;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 100, 224, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 100, 224, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

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

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-card);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.8;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.kpi-icon {
  font-size: 1.4rem;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  margin-top: 8px;
  color: var(--success);
  font-weight: 600;
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 14px 18px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-glass);
}

.custom-table td {
  padding: 16px 18px;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.campaign-name-cell {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

.campaign-objective-badge {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-paused {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Wizard (Stepped Campaign Creator) */
.wizard-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 36px;
  position: relative;
}

.wizard-progress::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 30px;
  right: 30px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.step-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.step-item.active .step-circle {
  background: var(--accent-gradient);
  border-color: #fff;
  color: #fff;
  box-shadow: var(--accent-glow);
}

.step-item.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-item.active .step-label {
  color: var(--text-primary);
}

/* Form Styles */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: #0064e0;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(0, 100, 224, 0.25);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.radio-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.radio-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.radio-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.radio-card.selected {
  background: rgba(0, 100, 224, 0.12);
  border-color: var(--accent-meta);
  box-shadow: 0 0 15px rgba(0, 100, 224, 0.25);
}

.radio-card-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.radio-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.radio-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Two Column Layout for Creative & Mockup */
.creative-split-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: start;
}

/* =====================================================
   Facebook & Instagram Ad Mockup Phone Component
   ===================================================== */
.mockup-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-device-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 6px;
  margin-bottom: 20px;
}

.device-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.device-tab-btn.active {
  background: var(--accent-meta);
  color: #fff;
}

.phone-wrapper {
  width: 100%;
  max-width: 390px;
  background: #18191a;
  border-radius: 36px;
  border: 10px solid #242526;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  color: #e4e6eb;
}

.facebook-feed-post {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.post-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
}

.page-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0064e0, #00c6ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.post-meta {
  flex-grow: 1;
}

.page-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #e4e6eb;
  line-height: 1.2;
}

.sponsored-tag {
  font-size: 0.75rem;
  color: #b0b3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-text {
  padding: 0 14px 12px 14px;
  color: #e4e6eb;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
}

.post-image-container {
  width: 100%;
  height: 230px;
  background: #242526;
  position: relative;
  overflow: hidden;
}

.post-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.post-cta-bar {
  background: #242526;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cta-meta {
  flex-grow: 1;
  padding-right: 12px;
  overflow: hidden;
}

.cta-domain {
  font-size: 0.72rem;
  color: #b0b3b8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cta-headline {
  font-weight: 700;
  font-size: 0.92rem;
  color: #e4e6eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta-button {
  background: #3a3b3c;
  color: #e4e6eb;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.cta-button:hover {
  background: #4e4f50;
}

.post-social-stats {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  color: #b0b3b8;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.post-actions-bar {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  color: #b0b3b8;
  font-size: 0.85rem;
  font-weight: 600;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
}

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

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
}

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

/* Responsive */
@media (max-width: 1024px) {
  .creative-split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .main-content {
    padding: 20px 16px;
  }
}
