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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  min-height: 100vh;
}

.header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 { font-size: 22px; }
.header-config { display: flex; gap: 15px; font-size: 13px; }
.config-badge {
  background: rgba(255,255,255,0.1);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.config-badge span { color: #00d4ff; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }
.status-dot.connected { background: #22c55e; }

/* Tab Navigation */
.tab-nav {
  background: white;
  padding: 0 40px;
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
}
.tab-btn {
  padding: 16px 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover { color: #1a1a2e; }
.tab-btn.active { color: #00d4ff; border-bottom-color: #00d4ff; }

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

.container { max-width: 1400px; margin: 0 auto; padding: 30px; }

.auth-section {
  background: white;
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.auth-info { font-size: 14px; color: #666; }
.auth-info strong { color: #1a1a2e; }
.auth-actions { display: flex; gap: 12px; }

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%); color: white; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,212,255,0.3); }
.btn-secondary { background: #e8ecf1; color: #1a1a2e; }
.btn-secondary:hover:not(:disabled) { background: #d8dce1; }
.btn-success { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; border: 1px solid #ddd; background: white; cursor: pointer; }
.btn-sm:hover { background: #f5f5f5; }
.btn-danger { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* Stats */
.stats-section { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat-number { font-size: 28px; font-weight: 700; color: #00d4ff; }
.stat-label { font-size: 12px; color: #666; text-transform: uppercase; }

/* Sync Section */
.sync-section { margin-bottom: 24px; }
.sync-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.sync-card h3 { font-size: 16px; margin-bottom: 8px; }
.sync-card p { color: #666; font-size: 14px; margin-bottom: 16px; }
.sync-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.sync-results { display: flex; gap: 24px; padding: 12px 16px; background: #f8fafc; border-radius: 8px; }
.result-item { font-size: 14px; }

/* Products */
.products-section { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #eee; }
.section-header h2 { font-size: 16px; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card { background: #fafbfc; border-radius: 10px; overflow: hidden; border: 1px solid #eee; transition: all 0.2s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.product-image { width: 100%; height: 150px; object-fit: contain; background: white; }
.product-info { padding: 14px; }
.product-brand { font-size: 10px; color: #00d4ff; text-transform: uppercase; margin-bottom: 4px; }
.product-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.product-model { font-size: 11px; color: #666; margin-bottom: 10px; }
.product-details { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.product-tag { font-size: 10px; padding: 3px 8px; background: #e8ecf1; border-radius: 4px; }
.product-tag.type-sun { background: #fef3c7; color: #92400e; }
.product-tag.type-frame { background: #dbeafe; color: #1e40af; }
.product-tag.in-stock { background: #d1fae5; color: #065f46; }
.product-tag.out-of-stock { background: #fee2e2; color: #991b1b; }
.product-footer { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid #eee; }
.product-price { font-size: 16px; font-weight: 700; }
.product-stock { font-size: 11px; color: #666; }

/* Pagination */
.pagination, .pagination-bottom { display: flex; gap: 6px; align-items: center; }
.pagination-bottom { justify-content: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; }
.page-btn { padding: 8px 12px; border: 1px solid #ddd; background: white; border-radius: 6px; cursor: pointer; font-size: 13px; }
.page-btn:hover:not(:disabled) { background: #00d4ff; color: white; border-color: #00d4ff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: #00d4ff; color: white; border-color: #00d4ff; }

/* Orders Table */
.orders-section { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.orders-table-container { overflow-x: auto; }
.orders-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders-table th, .orders-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
.orders-table th { background: #f8fafc; font-weight: 600; font-size: 12px; text-transform: uppercase; color: #666; }
.orders-table tr:hover { background: #f8fafc; }
.empty-row { text-align: center; color: #999; padding: 40px !important; }

.status-badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-received { background: #dbeafe; color: #1e40af; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-released { background: #d1fae5; color: #065f46; }
.status-shipped { background: #22c55e; color: white; }
.status-canceled { background: #fee2e2; color: #991b1b; }
.status-not_received { background: #e5e7eb; color: #6b7280; }

/* Lookup Section */
.lookup-section { background: white; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.lookup-section h2 { margin-bottom: 8px; }
.lookup-section p { color: #666; margin-bottom: 20px; }
.lookup-form { display: flex; gap: 12px; margin-bottom: 24px; }
.lookup-form input { flex: 1; max-width: 300px; padding: 12px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.lookup-results { margin-top: 20px; }
.result-card { background: #f8fafc; border-radius: 10px; padding: 20px; }
.result-card h3 { margin-bottom: 16px; font-size: 16px; }
.result-grid { display: grid; gap: 12px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: #666; }
.detail-row pre { font-size: 11px; background: #1a1a2e; color: #00d4ff; padding: 10px; border-radius: 6px; overflow-x: auto; margin-top: 8px; }
.detail-row.error { color: #dc2626; justify-content: center; }

/* Webhooks Section */
.webhooks-section { display: grid; gap: 20px; }
.webhook-card { background: white; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.webhook-card h3 { margin-bottom: 8px; font-size: 16px; }
.webhook-card h4 { margin: 20px 0 8px; font-size: 14px; }
.webhook-card p { color: #666; font-size: 14px; margin-bottom: 16px; }
.webhook-config { background: #f8fafc; border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.config-row { display: flex; gap: 12px; margin-bottom: 8px; align-items: center; }
.config-row:last-child { margin-bottom: 0; }
.config-row label { font-weight: 500; min-width: 60px; }
.config-row code { background: #1a1a2e; color: #00d4ff; padding: 6px 12px; border-radius: 4px; font-size: 13px; word-break: break-all; }
.webhook-result { margin-top: 20px; padding: 16px; border-radius: 8px; }
.webhook-result .success { background: #d1fae5; color: #065f46; padding: 16px; border-radius: 8px; }
.webhook-result .warning { background: #fef3c7; color: #92400e; padding: 16px; border-radius: 8px; }
.webhook-result .error { background: #fee2e2; color: #991b1b; padding: 16px; border-radius: 8px; }
.webhook-result h4 { margin-bottom: 8px; }
.webhook-result pre { font-size: 12px; margin-top: 8px; overflow-x: auto; }

.manual-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

/* Loading & Empty States */
.loading-state { text-align: center; padding: 60px 20px; }
.spinner { width: 40px; height: 40px; border: 3px solid #e8ecf1; border-top-color: #00d4ff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 20px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: #666; }

@media (max-width: 768px) {
  .header { flex-direction: column; gap: 15px; padding: 15px; }
  .tab-nav { padding: 0 15px; overflow-x: auto; }
  .container { padding: 15px; }
  .auth-section { flex-direction: column; gap: 15px; }
  .stats-section { grid-template-columns: repeat(2, 1fr); }
  .products-grid { grid-template-columns: 1fr; }
  .lookup-form { flex-direction: column; }
  .lookup-form input { max-width: 100%; }
}
