/* TikTok Obsidian Dark Glassmorphism Design System v5 Mobile Bottom Nav */
:root {
  --bg-dark: #090a0f;
  --bg-card: rgba(18, 20, 29, 0.95);
  --bg-card-hover: rgba(26, 29, 43, 0.98);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(254, 44, 85, 0.4);
  --tiktok-pink: #FE2C55;
  --tiktok-cyan: #25F4EE;
  --tiktok-purple: #8A2BE2;
  --accent-gold: #FFB800;
  --text-main: #FFFFFF;
  --text-muted: #9DA3B4;
  --sidebar-width: 260px;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(254, 44, 85, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(37, 244, 238, 0.08) 0%, transparent 40%);
}

a, a:visited, a:hover, a:active {
  color: inherit !important;
  text-decoration: none !important;
}

/* App Main Container */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Desktop Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(12, 14, 22, 0.98);
  border-right: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tiktok-pink), var(--tiktok-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 0 12px rgba(254, 44, 85, 0.4);
}

.brand-text h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #FFF;
}

.badge-partner {
  font-size: 10px;
  background: rgba(37, 244, 238, 0.15);
  color: var(--tiktok-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(37, 244, 238, 0.3);
  display: inline-block;
  margin-top: 2px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text-main) !important;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(254, 44, 85, 0.15), transparent);
  border-left: 3px solid var(--tiktok-pink);
  color: #FFF !important;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
}

.partner-account-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.partner-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--tiktok-purple), var(--tiktok-pink));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.partner-info {
  display: flex;
  flex-direction: column;
}

.p-name { font-size: 13px; font-weight: 600; color: #FFF; }
.p-id { font-size: 10px; color: var(--text-muted); }

.status-indicator.online {
  width: 8px;
  height: 8px;
  background: #00E676;
  border-radius: 50%;
  box-shadow: 0 0 8px #00E676;
  margin-left: auto;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
}

/* Top Header Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.header-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #FFF;
}

.header-title p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-main);
  font-size: 13px;
}

.date-filter select {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 13px;
  cursor: pointer;
}

.user-tiktok-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px 6px 6px;
  border-radius: 30px;
}

.creator-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.creator-meta {
  display: flex;
  flex-direction: column;
}

.handle { font-size: 12px; font-weight: 600; color: #FFF; }
.status { font-size: 10px; color: #00E676; }

/* API Status Banner */
.api-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.3);
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 28px;
  width: 100%;
}

.banner-info-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.banner-icon {
  font-size: 24px;
  color: var(--tiktok-pink);
}

.banner-text h4 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #FFF;
}

.banner-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.badge-live {
  background: rgba(0, 230, 118, 0.15);
  color: #00E676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--tiktok-pink), var(--tiktok-purple));
  color: #FFF !important;
  box-shadow: 0 4px 15px rgba(254, 44, 85, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 44, 85, 0.4);
}

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

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

/* KPI Cards Section */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
  width: 100%;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.kpi-card.highlight {
  border-color: rgba(255, 184, 0, 0.4);
  background: rgba(255, 184, 0, 0.05);
}

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

.kpi-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-pink { background: rgba(254, 44, 85, 0.15); color: var(--tiktok-pink); }
.icon-cyan { background: rgba(37, 244, 238, 0.15); color: var(--tiktok-cyan); }
.icon-purple { background: rgba(138, 43, 226, 0.15); color: var(--tiktok-purple); }
.icon-gold { background: rgba(255, 184, 0, 0.15); color: var(--accent-gold); }

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #FFF;
  display: block;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

.trend-up { color: #00E676; }

.kpi-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
  width: 100%;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
}

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

.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #FFF;
}

.card-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-legend-custom {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.views-dot { background: var(--tiktok-pink); }
.likes-dot { background: var(--tiktok-cyan); }
.sales-dot { background: var(--tiktok-purple); }
.commission-dot { background: var(--accent-gold); }

.chart-wrapper {
  position: relative;
  height: 250px;
  width: 100%;
}

/* VT Breakdown Table */
.vt-table-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(10px);
  width: 100%;
}

.table-search-filter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  width: 240px;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px 8px 34px;
  color: var(--text-main);
  outline: none;
  font-size: 12px;
}

.table-search-filter select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text-main);
  outline: none;
  font-size: 12px;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
}

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

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  vertical-align: middle;
}

.vt-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vt-thumb {
  width: 44px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.vt-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vt-title {
  font-weight: 600;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 240px;
  line-height: 1.3;
}

.vt-id {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-pair {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.m-views { color: var(--tiktok-pink); font-weight: 600; }
.m-likes { color: var(--tiktok-cyan); font-size: 12px; }

.product-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 180px;
  border: 1px solid var(--border-color);
}

.product-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.badge-sold {
  background: rgba(138, 43, 226, 0.15);
  color: var(--tiktok-purple);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid rgba(138, 43, 226, 0.3);
}

.val-gmv { font-weight: 600; }
.val-commission { color: var(--accent-gold); font-weight: 700; }

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted) !important;
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none !important;
}

.btn-icon:hover {
  color: var(--tiktok-pink) !important;
  background: rgba(254, 44, 85, 0.1);
}

/* Modal Backdrop & Overlay - STRICTLY HIDDEN BY DEFAULT */
.modal-backdrop,
.modal-overlay {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100000 !important;
}

.modal-backdrop.active,
.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: #12141D;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 520px;
  max-width: 90%;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}

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

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  color: #FFF;
}

.close-btn, .btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

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

.form-group label {
  font-size: 12px;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-main);
  outline: none;
}

.input-readonly {
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-muted) !important;
}

.scope-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-scope {
  font-size: 11px;
  background: rgba(0, 230, 118, 0.15);
  color: #00E676;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.modal-alert {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  border-radius: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

/* MOBILE BOTTOM NAVIGATION BAR (FIXED AT BOTTOM FOR HP) */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 992px) {
  .sidebar {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 16px 16px 85px 16px !important;
  }
  
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 65px;
    background: rgba(12, 14, 22, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-around;
    z-index: 99999;
    padding: 0 8px;
  }

  .bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none !important;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .bnav-item i {
    font-size: 18px;
  }

  .bnav-item.active {
    color: var(--tiktok-cyan) !important;
    font-weight: 700;
  }

  .bnav-item.active i {
    color: var(--tiktok-pink);
    transform: translateY(-2px);
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .charts-grid {
    grid-template-columns: 1fr !important;
  }
  .api-status-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .banner-actions {
    width: 100%;
    flex-direction: column;
  }
  .banner-actions button {
    width: 100%;
    justify-content: center;
  }
  .converter-grid-stats {
    grid-template-columns: 1fr !important;
  }
  .converter-input-group {
    flex-direction: column !important;
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .header-title h1 {
    font-size: 20px;
  }
}
