/* IP Delisting Automation — MarqVision Style */
:root {
  /* MarqVision Color Scheme */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;

  /* Sidebar Colors */
  --sidebar-bg: #1a1a2e;
  --sidebar-item-hover: #16213e;
  --sidebar-text: #a5a9b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #2a2f42;

  /* Content Colors */
  --bg-main: #f8fafc;
  --bg-white: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Status Colors */
  --status-detected: #f59e0b;
  --status-reported: #3b82f6;
  --status-removed: #22c55e;
  --status-denied: #ef4444;
  --status-pending: #6b7280;

  /* Shadows & Effects */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Login Styles */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.shield-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 14px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#login-form input {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}

#login-form input:focus {
  outline: none;
  border-color: var(--primary);
}

#login-form button {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

#login-form button:hover {
  background: var(--primary-dark);
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* App Layout */
#app-view {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .shield-icon {
  font-size: 24px;
}

.sidebar-title {
  color: var(--sidebar-text-active);
  font-weight: 700;
  font-size: 18px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 3px;
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  background: var(--sidebar-text);
  border-radius: 1px;
  transition: all 0.3s;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.2s;
  border-right: 3px solid transparent;
}

.nav-item:hover {
  background: var(--sidebar-item-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-item-hover);
  color: var(--sidebar-text-active);
  border-right-color: var(--primary);
}

.nav-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.nav-label {
  font-weight: 500;
  font-size: 14px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--sidebar-border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.user-name {
  color: var(--sidebar-text-active);
  font-weight: 500;
  font-size: 14px;
}

.user-logout {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.user-logout:hover {
  color: var(--sidebar-text-active);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.header-breadcrumb {
  color: var(--text-secondary);
  font-size: 14px;
}

.header-stats {
  display: flex;
  gap: 16px;
}

.stat-badge {
  background: var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 32px;
  flex: 1;
}

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

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
}

.kpi-detected .kpi-icon { background: #fef3c7; }
.kpi-reported .kpi-icon { background: #dbeafe; }
.kpi-delisted .kpi-icon { background: #dcfce7; }
.kpi-removed .kpi-icon { background: #dcfce7; }
.kpi-denied .kpi-icon { background: #fee2e2; }

.kpi-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Dashboard Layout */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

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

.dashboard-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* Status Tabs */
.status-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--border-light);
  padding: 4px;
  border-radius: var(--radius);
}

.status-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.status-tab.active {
  background: var(--bg-white);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.status-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Cases Toolbar */
.cases-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

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

.filter-select,
.filter-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  min-width: 140px;
}

.filter-input[type="date"] {
  min-width: 120px;
}

.bulk-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.selected-count {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* Table */
.table-container {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cases-table {
  width: 100%;
  border-collapse: collapse;
}

.cases-table thead {
  background: var(--border-light);
}

.cases-table th {
  padding: 16px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.cases-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cases-table tbody tr:hover {
  background: var(--border-light);
}

.th-checkbox {
  width: 40px;
}

.th-screenshot {
  width: 60px;
}

.th-actions {
  width: 100px;
}

.screenshot-thumb {
  width: 40px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.screenshot-placeholder {
  width: 40px;
  height: 30px;
  border-radius: 4px;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.pending {
  background: #f3f4f6;
  color: var(--status-pending);
}

.status-badge.reported {
  background: #dbeafe;
  color: var(--status-reported);
}

.status-badge.delisted {
  background: #dcfce7;
  color: var(--status-removed);
}

.status-badge.live {
  background: #fee2e2;
  color: var(--status-denied);
}

.status-badge.removed {
  background: #dcfce7;
  color: var(--status-removed);
}

.status-badge.not_available {
  background: #f3f4f6;
  color: var(--status-pending);
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

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

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

/* Input Fields */
.input-field {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
  width: 100%;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
}

.input-sm {
  padding: 8px 12px;
  font-size: 13px;
}

/* Cards */
.scan-card,
.settings-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.scan-card h3,
.settings-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.scan-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.quick-register-form {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-result {
  padding: 12px;
  border-radius: var(--radius);
  font-size: 14px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .filter-group {
    flex-wrap: wrap;
  }

  .cases-toolbar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

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

  .content-header {
    padding: 16px 20px;
  }

  .tab-content {
    padding: 20px;
  }
}

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

  .quick-register-form {
    flex-direction: column;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.kpi-card,
.dashboard-card,
.scan-card,
.settings-card {
  animation: fadeIn 0.3s ease-out;
}

/* Loading States */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Chart styles */
.chart-container {
  max-height: 220px;
  overflow-y: auto;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  min-width: 100px;
  font-size: 12px;
  color: var(--text-secondary);
}

.bar-track {
  flex: 1;
  height: 20px;
  background: var(--border-light);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.bar-value {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-white);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination button:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

/* Recent cases list */
.recent-cases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.case-item:hover {
  border-color: var(--primary);
  background: var(--border-light);
}

.case-info {
  flex: 1;
}

.case-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.case-url {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
}

/* Works management */
.works-list {
  margin-bottom: 20px;
}

.work-item {
  display: flex;
  justify-content: between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.work-info {
  flex: 1;
}

.work-title {
  font-weight: 500;
  color: var(--text-primary);
}

.work-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
}

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

.add-work-form {
  display: flex;
  gap: 12px;
}

.add-work-form .input-field {
  flex: 1;
}