/* ==========================================================
   AUTOSHORT MODERN DASHBOARD & REAL ANALYTICS ENGINE
   Clean, purpose-built, and 100% functional architecture
   ========================================================== */

:root {
  /* Light Theme */
  --bg-page: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-hover: #f1f5f9;

  --border-light: #e2e8f0;
  --border-card: #e2e8f0;
  --border-focus: #ef4444;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* AutoShort Accents */
  --brand-primary: #ef4444;
  --brand-primary-hover: #dc2626;
  --brand-light: #fee2e2;

  --chart-visitors: #ef4444;
  --chart-unique: #8b5cf6;
  --chart-qr: #06b6d4;
  --chart-links: #3b82f6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-sidebar: #101626;
  --bg-card: #131c31;
  --bg-input: #0c1220;
  --bg-hover: #1b2640;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-focus: #f43f5e;

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --brand-light: rgba(239, 68, 68, 0.18);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ==========================================================
   LAYOUT STRUCTURE: SIDEBAR + WORKSPACE
   ========================================================== */

.sid-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* SIDEBAR */
.sid-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 150;
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-header {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
}

.sid-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon-square {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.brand-text-main {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-text-accent {
  color: var(--brand-primary);
}

/* SIDEBAR NAVIGATION */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 14px 12px 6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item .nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active .nav-link {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
}

.nav-item.active .nav-icon {
  color: var(--brand-primary);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  color: #64748b;
  transition: color 0.15s;
}

.nav-label {
  flex: 1;
}

.badge-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.badge-live {
  background: #dcfce7;
  color: #15803d;
}

/* SIDEBAR BOTTOM */
.sidebar-bottom {
  padding: 16px 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-sidebar);
}

.btn-sidebar-create {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-name-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.user-options-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
}

/* ==========================================================
   TOPBAR HEADER
   ========================================================== */

.sid-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.sid-topbar {
  height: 62px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-main);
  cursor: pointer;
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title-wrap .title-icon {
  font-size: 1.15rem;
  color: var(--brand-primary);
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.domain-pill-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-test-action {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-test-action:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

.btn-test-action.qr {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

.btn-test-action.qr:hover {
  background: #bae6fd;
}

/* ==========================================================
   CONTENT AREA & CONTROLS TOOLBAR
   ========================================================== */

.sid-content-area {
  padding: 24px 32px 40px;
  flex: 1;
}

/* AdSense Handling - Eliminates empty white gaps on all pages */
.sid-footer-ads {
  padding: 0 32px 24px;
  text-align: center;
  overflow: hidden;
  margin-top: auto;
}

ins.adsbygoogle {
  display: block;
  margin: 0 auto;
}

ins.adsbygoogle:empty,
ins.adsbygoogle[data-ad-status="unfilled"],
.sid-footer-ads:empty {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.analytics-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.link-filter-wrapper .filter-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.select-clean {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 14px 8px 32px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.date-dropdown-wrapper {
  position: relative;
}

.date-range-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.date-range-btn:hover, .date-range-btn.open {
  border-color: var(--brand-primary);
}

.caret-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-outline-clean {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

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

/* ==========================================================
   INTERACTIVE POPUP CALENDAR
   ========================================================== */

.calendar-picker-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 35px -4px rgba(0, 0, 0, 0.15);
  padding: 16px;
  width: 320px;
  animation: calFadeIn 0.15s ease-out;
}

@keyframes calFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.cal-selects {
  display: flex;
  gap: 6px;
}

.cal-dropdown {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}

.cal-nav-arrows {
  display: flex;
  gap: 4px;
}

.cal-arrow-btn {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.cal-arrow-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
  transition: all 0.1s;
}

.cal-day-cell:hover:not(.empty):not(.range-start):not(.range-end) {
  background: var(--bg-hover);
}

.cal-day-cell.other-month {
  color: #cbd5e1;
}

.cal-day-cell.in-range {
  background: var(--brand-light);
  color: var(--brand-primary);
  border-radius: 0;
}

.cal-day-cell.range-start {
  background: var(--brand-primary) !important;
  color: #ffffff !important;
  border-radius: 50% 0 0 50% !important;
  font-weight: 700;
}

.cal-day-cell.range-end {
  background: var(--brand-primary) !important;
  color: #ffffff !important;
  border-radius: 0 50% 50% 0 !important;
  font-weight: 700;
}

.cal-day-cell.range-end::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: #ffffff;
  border-radius: 50%;
}

.cal-day-cell.single-selected {
  background: var(--brand-primary) !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  font-weight: 700;
}

.cal-presets-strip {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cal-preset-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cal-preset-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.cal-preset-btn.active {
  background: var(--brand-light);
  color: var(--brand-primary);
  border-color: #fca5a5;
}

/* ==========================================================
   STACKED BAR CHART
   ========================================================== */

.analytics-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

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

.chart-legend {
  display: flex;
  align-items: center;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.red { background: var(--chart-visitors); }
.legend-dot.purple { background: var(--chart-unique); }

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

.stacked-chart-viewport {
  position: relative;
  height: 240px;
  margin-left: 36px;
  margin-bottom: 24px;
}

.chart-y-axis {
  position: absolute;
  top: 0;
  left: -36px;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.y-tick {
  display: flex;
  align-items: center;
  width: 100%;
}

.y-tick span {
  width: 30px;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.y-tick .grid-line {
  flex: 1;
  border-top: 1px dashed var(--border-light);
}

.y-tick .grid-line.zero {
  border-top: 1px solid #cbd5e1;
}

.chart-bars-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 0 10px;
}

.chart-bar-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
  flex: 1;
  max-width: 60px;
}

.stacked-bar-fill {
  width: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s;
}

.chart-bar-column:hover .stacked-bar-fill {
  transform: scaleY(1.03);
  filter: brightness(1.08);
}

.bar-segment-unique {
  background: var(--chart-unique);
  width: 100%;
  transition: height 0.3s;
}

.bar-segment-visitors {
  background: var(--chart-visitors);
  width: 100%;
  transition: height 0.3s;
}

.bar-date-label {
  position: absolute;
  bottom: -22px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.chart-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  background: #0f172a;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  z-index: 50;
  display: none;
}

.chart-bar-column:hover .chart-tooltip {
  display: block;
}

/* ==========================================================
   4 KPI SUMMARY METRICS ROW
   ========================================================== */

.sid-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.sid-kpi-col {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-number {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

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

.dot-blue { background: var(--chart-links); }
.dot-red { background: var(--chart-visitors); }
.dot-purple { background: var(--chart-unique); }
.dot-cyan { background: var(--chart-qr); }

/* ==========================================================
   ANOMALY DETECTION SECTION (REAL STATISTICAL FEATURE)
   ========================================================== */

.anomaly-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.anomaly-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.anomaly-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anomaly-icon {
  font-size: 1.1rem;
  color: var(--brand-primary);
}

.anomaly-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.anomaly-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.anomaly-meta-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.anomaly-details-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anomaly-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  font-size: 0.84rem;
}

.anomaly-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-crit {
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* ==========================================================
   PERFORMANCE TABLE & DEEP DIVES
   ========================================================== */

.performance-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.perf-header {
  margin-bottom: 16px;
}

.perf-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.perf-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.real-analytics-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.real-analytics-table th {
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 700;
}

.real-analytics-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.real-analytics-table tr:hover {
  background: var(--bg-hover);
}

.table-slug a {
  font-weight: 700;
  color: var(--brand-primary);
}

.table-dest {
  color: var(--text-muted);
  font-size: 0.78rem;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deep-dive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.deep-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.deep-card h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.breakdown-progress-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.breakdown-progress-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: 999px;
  transition: width 0.3s;
}

/* ==========================================================
   QR STUDIO VIEW
   ========================================================== */

.qr-studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.qr-studio-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.qr-studio-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.qr-studio-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
}

.color-picker-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-btn.active {
  border-color: #0f172a;
  transform: scale(1.1);
}

.qr-preview-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--brand-primary);
  word-break: break-all;
}

.qr-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.qr-display-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 30px;
}

.qr-box-wrap {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.qr-hint-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================
   ACTIVITY STREAM TABLE
   ========================================================== */

.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

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

.activity-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.activity-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.live-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #10b981;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.activity-table-wrap {
  overflow-x: auto;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.activity-table th {
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
}

.activity-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

/* ==========================================================
   SETTINGS & CLOUD GRID
   ========================================================== */

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.settings-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.settings-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.settings-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.settings-box h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.settings-box p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex: 1;
}

/* ==========================================================
   SHORTENER VIEW (QUICK HERO & CARDS)
   ========================================================== */

.quick-shorten-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.quick-shorten-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.quick-shorten-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.quick-shorten-form {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 12px;
}

.quick-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.quick-input-group input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  background: var(--bg-input);
  color: var(--text-main);
  outline: none;
}

.quick-input-group input:focus {
  border-color: var(--border-focus);
}

.quick-custom-slug-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding-left: 12px;
}

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

.quick-custom-slug-group input {
  border: none;
  background: transparent;
  padding: 12px 8px;
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none;
  width: 100%;
}

.btn-submit-shorten {
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-submit-shorten:hover {
  background: var(--brand-primary-hover);
}

.quick-result-card {
  margin-top: 18px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-url {
  font-size: 1.1rem;
  font-weight: 800;
  color: #15803d;
}

.result-target {
  font-size: 0.8rem;
  color: #166534;
}

.quick-result-actions {
  display: flex;
  gap: 8px;
}

.links-section {
  margin-top: 24px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-left h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.count-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box-wrap i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.search-box-wrap input {
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 0.85rem;
  outline: none;
}

.links-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.link-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.link-card-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.link-preview-thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

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

.link-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.link-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.short-url-link {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.btn-inline-copy {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.dest-url-truncate {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

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

.clicks-badge {
  text-align: right;
}

.clicks-number {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.clicks-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

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

.btn-icon-action {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon-action:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.btn-icon-action.delete:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ==========================================================
   MODALS: LINK & WHATSAPP PREVIEW
   ========================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 880px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: modalPop 0.2s ease-out;
  overflow: hidden;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

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

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-main);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-sm.delete:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.input-control, .textarea-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.input-control:focus, .textarea-control:focus {
  border-color: var(--border-focus);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.slug-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  overflow: hidden;
}

.slug-domain-addon {
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
}

.slug-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
}

.btn-random-slug {
  background: none;
  border: none;
  padding: 10px 14px;
  color: var(--text-muted);
  cursor: pointer;
}

.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.upload-dropzone:hover {
  border-color: var(--brand-primary);
}

.dropzone-icon {
  font-size: 2rem;
  color: #94a3b8;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.dropzone-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.dropzone-active img {
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.url-toggle-bar {
  margin-top: 8px;
}

.btn-text-toggle {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-split-view {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

.preview-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.whatsapp-bubble-mockup {
  background: #efeae2;
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid #d1d5db;
}

.wa-card {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 8px;
}

.wa-img-wrap {
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: #e2e8f0;
}

.wa-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-content {
  padding: 10px;
}

.wa-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.wa-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
  margin-bottom: 6px;
}

.wa-domain {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
}

.wa-text-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #0284c7;
}

.wa-time {
  font-size: 0.68rem;
  color: #94a3b8;
}

.wa-ticks {
  color: #38bdf8;
  margin-left: 2px;
}

.preview-note {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 12px;
  display: flex;
  gap: 6px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PRINT STYLES FOR EXPORT PDF */
@media print {
  .sid-sidebar, .sid-topbar, .btn-test-action, #btnExportPdf, #btnDownloadCsv, .link-filter-wrapper, .date-dropdown-wrapper {
    display: none !important;
  }
  .sid-layout { display: block; }
  .sid-main-wrapper { height: auto; overflow: visible; }
  .sid-content-area { padding: 0; }
  .analytics-chart-card, .anomaly-section-card, .performance-table-card {
    box-shadow: none;
    border: 1px solid #000;
    break-inside: avoid;
  }
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .deep-dive-grid { grid-template-columns: 1fr; }
  .sid-metrics-row { grid-template-columns: repeat(2, 1fr); }
  .qr-studio-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-menu-toggle { display: block; }
  .sid-sidebar {
    position: fixed;
    left: -270px;
    transition: left 0.25s;
  }
  .sid-sidebar.open { left: 0; }
  .quick-shorten-form { grid-template-columns: 1fr; }
  .modal-split-view { grid-template-columns: 1fr; }
}
