/* Meta Ads Creative Analytics - Styles */

/* CSS Variables */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --success: #22c55e;
  --success-light: #86efac;
  --warning: #f59e0b;
  --warning-light: #fcd34d;
  --danger: #ef4444;
  --danger-light: #fca5a5;
  --neutral: #64748b;
  --neutral-light: #94a3b8;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #1e293b;
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* App Container */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

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

.sync-status.syncing .status-dot {
  background: var(--warning);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Onboarding Banner */
.onboarding-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.5rem 2rem;
  position: relative;
}

.onboarding-content h3 {
  margin-bottom: 0.5rem;
}

.onboarding-content p {
  opacity: 0.9;
  margin-bottom: 1rem;
}

.onboarding-steps {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.8;
}

.step.complete {
  opacity: 1;
}

.step.complete .step-number {
  background: var(--success);
}

.step.complete .step-check {
  display: block;
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.step-check {
  display: none;
  width: 16px;
  height: 16px;
  stroke: var(--success);
}

.onboarding-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
}

.onboarding-close:hover {
  opacity: 1;
}

/* Navigation Tabs */
.tabs {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.tab {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

/* Content Area */
.content {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

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

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

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

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

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

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

/* Meta Button */
.btn-meta {
  background: #1877f2;
  color: white;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-meta:hover {
  background: #166fe5;
}

.btn-meta .icon {
  width: 20px;
  height: 20px;
}

/* OAuth Styles */
.meta-connect-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.oauth-section {
  margin-bottom: 0.5rem;
}

.oauth-setup {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.oauth-setup .form-group {
  margin-bottom: 1rem;
}

.redirect-uri-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.redirect-uri-box label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.redirect-uri-box code {
  display: block;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
}

.divider-text {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  margin: 1rem 0;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.divider-text span {
  padding: 0 1rem;
}

.manual-token-section {
  padding-top: 0.5rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.stat-card {
  padding: 1.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
}

.large-card {
  grid-column: span 2;
}

.full-width-card {
  grid-column: span 4;
}

/* Win Rate Circle */
.win-rate-summary {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.win-rate-circle {
  width: 120px;
  height: 120px;
}

.circular-chart {
  display: block;
  max-width: 100%;
}

.circle-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3.8;
}

.circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 3.8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.percentage {
  fill: var(--text);
  font-size: 0.5em;
  font-weight: 600;
  text-anchor: middle;
}

.win-rate-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.stat-row .label {
  color: var(--text-light);
}

.stat-row .value {
  font-weight: 600;
}

.stat-row .value.success {
  color: var(--success);
}

.stat-row .value.danger {
  color: var(--danger);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral);
}

.activity-dot.success { background: var(--success); }
.activity-dot.warning { background: var(--warning); }
.activity-dot.danger { background: var(--danger); }

.activity-text {
  flex: 1;
  font-size: 0.875rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text);
}

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

.accounts-table-wrapper,
.creatives-table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Status Pills */
.pill {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.pill-success {
  background: var(--success-light);
  color: #166534;
}

.pill-warning {
  background: var(--warning-light);
  color: #92400e;
}

.pill-danger {
  background: var(--danger-light);
  color: #991b1b;
}

.pill-neutral {
  background: var(--border);
  color: var(--text-light);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--border);
  color: var(--text-light);
}

.badge.success {
  background: var(--success-light);
  color: #166534;
}

.badge.warning {
  background: var(--warning-light);
  color: #92400e;
}

.badge.danger {
  background: var(--danger-light);
  color: #991b1b;
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.view-btn {
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
}

.view-btn:hover {
  color: var(--text);
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.view-btn .icon {
  width: 18px;
  height: 18px;
}

/* Filters Row */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
}

.filter-group select,
.filter-group input {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  min-width: 140px;
}

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

.search-group {
  flex: 1;
  min-width: 200px;
}

.search-group input {
  width: 100%;
}

/* Creative Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.creative-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.creative-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.creative-card-thumbnail {
  aspect-ratio: 16/9;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.creative-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creative-card-thumbnail .placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.creative-card-body {
  padding: 1rem;
}

.creative-card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.creative-card-metric {
  display: flex;
  flex-direction: column;
}

.creative-card-metric .label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.creative-card-metric .value {
  font-weight: 600;
  font-size: 0.875rem;
}

.creative-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.creative-card-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--text-light);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.page-info {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.analytics-grid .full-width-card {
  grid-column: span 2;
}

/* Recommendation Cards */
.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recommendation-item {
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--neutral);
}

.recommendation-item.scale {
  border-left-color: var(--success);
}

.recommendation-item.watch {
  border-left-color: var(--warning);
}

.recommendation-item.kill {
  border-left-color: var(--danger);
}

.recommendation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.recommendation-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.recommendation-metrics {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

.recommendation-rationale {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.4;
}

/* Iteration Items */
.iteration-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.iteration-item {
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.iteration-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.iteration-title {
  font-weight: 600;
}

.iteration-score {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.iteration-weaknesses {
  margin-bottom: 0.75rem;
}

.iteration-weakness {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--danger);
}

.iteration-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.iteration-suggestion {
  font-size: 0.875rem;
  color: var(--text-light);
  padding-left: 1rem;
  border-left: 2px solid var(--primary);
}

/* Reports List */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-item {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.report-item:hover {
  transform: translateX(4px);
}

.report-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.report-meta {
  font-size: 0.875rem;
  color: var(--text-light);
}

.report-stats {
  display: flex;
  gap: 2rem;
  text-align: right;
}

.report-stat .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.report-stat .value {
  font-weight: 600;
}

.report-actions {
  display: flex;
  gap: 0.5rem;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input {
  flex: 1;
}

.help-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.connection-status {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: none;
}

.connection-status.success {
  display: block;
  background: var(--success-light);
  color: #166534;
}

.connection-status.error {
  display: block;
  background: var(--danger-light);
  color: #991b1b;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-large {
  max-width: 800px;
}

.modal-content.modal-small {
  max-width: 400px;
}

.modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Creative Detail Modal */
.creative-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.creative-preview {
  background: var(--bg);
  border-radius: var(--radius);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.creative-preview img,
.creative-preview video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.creative-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.creative-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.metric-item {
  background: var(--bg);
  padding: 0.75rem;
  border-radius: var(--radius);
}

.metric-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-item .value {
  font-size: 1.125rem;
  font-weight: 600;
}

.creative-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.creative-tag {
  padding: 0.375rem 0.625rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.creative-tag.secondary {
  background: var(--bg);
  color: var(--text);
}

.creative-copy {
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-dark);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast-close {
  background: none;
  border: none;
  color: white;
  opacity: 0.7;
  cursor: pointer;
  margin-left: auto;
}

.toast-close:hover {
  opacity: 1;
}

/* Empty & Loading States */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Icon Utility */
.icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

/* Table Preview */
.table-preview {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.table-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Funnel Bars */
.funnel-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.funnel-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.funnel-label {
  width: 60px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
}

.funnel-track {
  flex: 1;
  height: 24px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius);
  transition: width 0.5s ease;
}

.funnel-fill.tof { background: var(--primary-light); }
.funnel-fill.mof { background: var(--warning); }
.funnel-fill.bof { background: var(--success); }

.funnel-value {
  width: 80px;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .large-card,
  .full-width-card {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .content {
    padding: 1rem;
  }

  .dashboard-grid,
  .analytics-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .large-card,
  .full-width-card,
  .analytics-grid .full-width-card {
    grid-column: span 1;
  }

  .creative-detail {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .filters-row {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .report-stats {
    width: 100%;
    justify-content: space-between;
  }
}

/* Account Select List */
.accounts-select-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.account-select-item {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.account-select-item:last-child {
  border-bottom: none;
}

.account-select-item:hover {
  background: var(--bg);
}

.account-select-item .name {
  font-weight: 500;
}

.account-select-item .id {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
