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

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(17, 25, 40, 0.75);
  --border-card: rgba(255, 255, 255, 0.08);
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.2);
  --secondary: #10b981;
  --secondary-glow: rgba(16, 185, 129, 0.2);
  --accent: #f59e0b;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(245, 158, 11) 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
}

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

h1 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2rem;
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #4338ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.btn-reset {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  color: white;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-reset:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

/* Container Grid */
.container {
  display: grid;
  grid-template-columns: 1fr; /* Default is full width dashboard */
  gap: 24px;
  align-items: start;
}

.container.simulator-active {
  grid-template-columns: 1.4fr 1fr; /* Split view */
}

/* Hide simulator panel by default */
.simulator-panel {
  display: none !important;
}

/* Show simulator panel when active */
.container.simulator-active .simulator-panel {
  display: block !important;
}

@media (max-width: 992px) {
  .container, .container.simulator-active {
    grid-template-columns: 1fr !important;
  }
}

/* Common Card Styling */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  margin-bottom: 24px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-box:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.03);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Chart Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}

/* Raw Logs Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-card);
  background: rgba(0, 0, 0, 0.2);
  max-height: 380px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: #121a2a !important; /* Solid dark color to mask scrolling content underneath */
  z-index: 10;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-android { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-ios { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-web { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.3); }

.badge-guest { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }
.badge-logged_in { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

.event-name-td {
  font-weight: 600;
  color: #a5b4fc;
}

/* SIMULATOR LAYOUT */
.simulator-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-card);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.form-group select, .form-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

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

/* Simulated Smartphone View */
.phone-mockup {
  border: 8px solid #1f2937;
  border-radius: 36px;
  background: #0f172a;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  aspect-ratio: 9 / 16;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.phone-header {
  background: #1e293b;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.phone-screen {
  flex-grow: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.phone-screen::-webkit-scrollbar {
  width: 4px;
}

.phone-screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.phone-navbar {
  background: #1e293b;
  display: flex;
  justify-content: space-around;
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-item {
  color: var(--text-secondary);
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s;
  background: none;
  border: none;
  outline: none;
}

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

.nav-item svg {
  width: 18px;
  height: 18px;
}

/* Simulator Screens */
.sim-screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.sim-screen.active {
  display: flex;
}

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

.screen-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: white;
}

.screen-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Simulator UI Elements */
.sim-button {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.sim-button:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.3) 100%);
  border-color: var(--primary);
  transform: scale(1.02);
}

.sim-button-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  border: none;
  color: white;
}

.sim-button-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

.sim-button-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.2) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.sim-button-danger:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.3) 100%);
  border-color: #ef4444;
}

.product-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

.product-price {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 700;
}

.product-btn {
  background: var(--primary);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.product-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px var(--primary);
}

/* Network Request Log HUD inside simulator */
.hud-payload {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.7rem;
  color: #34d399;
  max-height: 120px;
  overflow-y: auto;
  margin-top: 16px;
  position: relative;
}

.hud-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pulse-circle {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(0.8); opacity: 0.5; }
  to { transform: scale(1.3); opacity: 1; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Filter Bar Styles */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end; /* Align inputs to the bottom */
  justify-content: space-between;
  background: rgba(17, 25, 40, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 140px; /* Allow items to stretch and wrap properly */
  min-width: 120px;
}

.filter-group label {
  font-size: 0.72rem;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.filter-group select, 
.filter-group input,
.filter-group div select {
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  color: #f3f4f6 !important;
  font-size: 0.85rem !important;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 42px; /* Fixed height for all elements */
  width: 100%;
}

.filter-group select:hover, 
.filter-group input:hover,
.filter-group div select:hover {
  border-color: rgba(99, 102, 241, 0.5) !important;
  background: rgba(15, 23, 42, 0.8) !important;
}

.filter-group select:focus, 
.filter-group input:focus,
.filter-group div select:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25) !important;
  background: #0f172a !important;
}

/* Calendar Icon white in dark mode */
.filter-group input[type="date"] {
  position: relative;
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.7;
}

.filter-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.filter-btn-clear {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.3) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  height: 42px;
  min-width: 90px;
  flex: 0 0 auto;
}

.filter-btn-clear:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: transparent;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

#filter-version-cond {
  flex: 0 0 65px !important;
}

#filter-version {
  flex: 1 1 auto !important;
}

/* Switch Container */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.switch-container:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.02);
}

.switch-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Toggle Switch slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid var(--border-card);
  z-index: 1;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #9ca3af;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
  border-color: rgba(99, 102, 241, 0.4);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: white;
}

/* Simulator Content visibility transition */
.simulator-content {
  display: none;
  flex-direction: column;
}

.simulator-content.show {
  display: flex;
  animation: slideInDown 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Glassmorphic Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 12, 21, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex !important;
  opacity: 1;
}

/* Modal Card Container */
.modal-card {
  background: rgba(17, 25, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-card {
  transform: translateY(0);
}

/* Modal Header styling */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

/* Modal Body styling */
.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Modal User Info Banner */
.modal-user-banner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

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

.banner-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.banner-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
  word-break: break-all;
}

/* Timeline Components */
.timeline-container {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 8px;
}

.timeline-list {
  list-style: none;
  position: relative;
  padding-left: 20px;
  margin: 0;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 4px;
  width: 2px;
  height: calc(100% - 16px);
  background: rgba(99, 102, 241, 0.25);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid #0f172a;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.timeline-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 14px;
}

.timeline-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.timeline-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Action button eye styling */
.action-btn-eye {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  cursor: pointer;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.action-btn-eye:hover {
  background: #6366f1;
  border-color: transparent;
  color: white;
  transform: scale(1.05);
}

.clicks-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 0.75rem;
}
