/* Admin Panel Styling */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #f7fafc;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: #2d3748;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.admin-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: white;
}

.admin-sidebar-header p {
  font-size: 0.85rem;
  color: #a0aec0;
  margin: 0.25rem 0 0 0;
}

.admin-nav {
  padding: 1rem 0;
}

.admin-nav-section {
  margin-bottom: 1.5rem;
}

.admin-nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a0aec0;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #e2e8f0;
  text-decoration: none;
  transition: all 0.2s;
}

.admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.admin-nav-link.active {
  background: rgba(102, 126, 234, 0.2);
  color: white;
  border-left: 3px solid #667eea;
}

.admin-nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.75rem;
}

/* Main Content */
.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
}

.admin-header {
  background: white;
  padding: 1.5rem 2rem;
  margin: -2rem -2rem 2rem -2rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

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

/* Statistics Cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #667eea;
}

.stat-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #718096;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

.stat-card:nth-child(2) {
  border-left-color: #48bb78;
}

.stat-card:nth-child(3) {
  border-left-color: #ed8936;
}

.stat-card:nth-child(4) {
  border-left-color: #9f7aea;
}

.stat-card:nth-child(5) {
  border-left-color: #38b2ac;
}

/* Content Sections */
.admin-section {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  overflow: hidden;
}

.admin-section-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a202c;
  margin: 0;
}

.admin-section-content {
  padding: 1.5rem;
}

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

.admin-table thead {
  background: #f7fafc;
}

.admin-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: #2d3748;
}

.admin-table tbody tr:hover {
  background: #f7fafc;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.admin-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-badge.badge-approved,
.admin-badge.badge-active,
.admin-badge.badge-completed {
  background: #c6f6d5;
  color: #22543d;
}

.admin-badge.badge-pending {
  background: #feebc8;
  color: #7c2d12;
}

.admin-badge.badge-rejected,
.admin-badge.badge-suspended,
.admin-badge.badge-failed {
  background: #fed7d7;
  color: #742a2a;
}

.admin-badge.badge-sold {
  background: #bee3f8;
  color: #2c5282;
}

.admin-badge.badge-ai-flagged {
  background: #fed7d7;
  color: #742a2a;
  margin-top: 0.25rem;
}

.admin-badge.badge-ai-reviewing {
  background: #e9d8fd;
  color: #553c9a;
  margin-top: 0.25rem;
}

.admin-badge.badge-ai-approved {
  background: #c6f6d5;
  color: #22543d;
  margin-top: 0.25rem;
}

/* Buttons */
.admin-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.admin-btn-primary {
  background: #667eea;
  color: white;
}

.admin-btn-primary:hover {
  background: #5a67d8;
}

.admin-btn-secondary {
  background: #e2e8f0;
  color: #2d3748;
}

.admin-btn-secondary:hover {
  background: #cbd5e0;
}

.admin-btn-danger {
  background: #fc8181;
  color: white;
}

.admin-btn-danger:hover {
  background: #f56565;
}

.admin-btn-success {
  background: #48bb78;
  color: white;
}

.admin-btn-success:hover {
  background: #38a169;
}

/* Search Form */
.admin-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.admin-search input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
}

.admin-search input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
}

.admin-search button {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.admin-search button:hover {
  background: #5a67d8;
}

/* Filters */
.admin-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

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

.admin-filter label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #4a5568;
}

.admin-filter select {
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
}

/* Pagination */
.admin-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.admin-pagination a,
.admin-pagination span {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: #2d3748;
}

.admin-pagination a:hover {
  background: #f7fafc;
}

.admin-pagination .current {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

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

.admin-form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.admin-form-group input[type="text"],
.admin-form-group input[type="email"],
.admin-form-group input[type="number"],
.admin-form-group textarea,
.admin-form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.admin-form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Alerts */
.admin-alert {
  padding: 1rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.admin-alert-success {
  background: #c6f6d5;
  color: #22543d;
  border-left: 4px solid #48bb78;
}

.admin-alert-error {
  background: #fed7d7;
  color: #742a2a;
  border-left: 4px solid #fc8181;
}

.admin-alert-warning {
  background: #feebc8;
  color: #7c2d12;
  border-left: 4px solid #ed8936;
}

.admin-alert-info {
  background: #bee3f8;
  color: #2c5282;
  border-left: 4px solid #4299e1;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .admin-main {
    margin-left: 0;
  }
  
  .admin-stats {
    grid-template-columns: 1fr;
  }
  
  .admin-table {
    font-size: 0.75rem;
  }
  
  .admin-table th,
  .admin-table td {
    padding: 0.5rem;
  }
}

/* Empty State */
.admin-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #718096;
}

.admin-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.admin-empty h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admin-empty p {
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.stat-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #a0aec0;
}

.admin-badge.badge-source {
  background: #edf2f7;
  color: #2d3748;
  text-transform: none;
  letter-spacing: 0;
}

.traffic-period-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.traffic-flow {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.traffic-flow-col {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.traffic-flow-col-center {
  justify-content: center;
}

.traffic-flow-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #718096;
  margin-bottom: 0.25rem;
}

.flow-node {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #a0aec0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
}

a.flow-node:hover {
  border-color: #667eea;
  box-shadow: 0 1px 4px rgba(102, 126, 234, 0.15);
}

.flow-node-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2d3748;
}

.flow-node-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.1;
}

.flow-node-meta {
  font-size: 0.75rem;
  color: #718096;
}

.flow-hub {
  border-left-color: #667eea;
  background: #ebf4ff;
}

.flow-approved {
  border-left-color: #48bb78;
  background: #f0fff4;
}

.flow-pending {
  border-left-color: #ed8936;
  background: #fffaf0;
}

.flow-ads {
  border-left-color: #9f7aea;
  background: #faf5ff;
}

.flow-no-ads {
  border-left-color: #a0aec0;
}

.flow-source.source-tiktok { border-left-color: #111111; }
.flow-source.source-google { border-left-color: #4285f4; }
.flow-source.source-youtube { border-left-color: #ff0000; }
.flow-source.source-instagram { border-left-color: #e1306c; }
.flow-source.source-facebook { border-left-color: #1877f2; }
.flow-source.source-twitter { border-left-color: #111111; }
.flow-source.source-whatsapp { border-left-color: #25d366; }
.flow-source.source-direct { border-left-color: #38b2ac; }
.flow-source.source-ios_app,
.flow-source.source-app_store { border-left-color: #8e8e93; }
.flow-source.source-android_app,
.flow-source.source-play_store { border-left-color: #3ddc84; }

.traffic-flow-arrow {
  display: flex;
  align-items: center;
  min-width: 36px;
}

.flow-arrow-line {
  display: block;
  height: 3px;
  flex: 1;
  background: #cbd5e0;
}

.flow-arrow-head {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid #cbd5e0;
}

.traffic-bar {
  margin-top: 0.4rem;
  height: 6px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
  max-width: 220px;
}

.traffic-bar-fill {
  display: block;
  height: 100%;
  background: #667eea;
  border-radius: 999px;
}

.traffic-bar-fill.source-tiktok { background: #111111; }
.traffic-bar-fill.source-google { background: #4285f4; }
.traffic-bar-fill.source-youtube { background: #ff0000; }
.traffic-bar-fill.source-instagram { background: #e1306c; }
.traffic-bar-fill.source-facebook { background: #1877f2; }
.traffic-bar-fill.source-direct { background: #38b2ac; }
.traffic-bar-fill.source-ios_app,
.traffic-bar-fill.source-app_store { background: #8e8e93; }
.traffic-bar-fill.source-android_app,
.traffic-bar-fill.source-play_store { background: #3ddc84; }

@media (max-width: 900px) {
  .traffic-flow {
    flex-direction: column;
  }

  .traffic-flow-arrow {
    transform: rotate(90deg);
    min-height: 28px;
    justify-content: center;
  }
}
