/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f7fa;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  text-align: center;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: #4f46e5; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #555; }
.btn-outline:hover { border-color: #4f46e5; color: #4f46e5; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 14px;
  color: #555;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.input-lg {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 15px;
}
.input-lg:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-label input { width: auto; }

/* ===== LOGIN PAGE ===== */
.login-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}
.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-card h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 24px;
}

/* ===== ADMIN NAV ===== */
.admin-nav {
  background: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: #4f46e5;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-user {
  font-size: 14px;
  color: #666;
}

/* ===== ADMIN CONTENT ===== */
.admin-content {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}
.card {
  background: white;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h2 {
  margin-bottom: 20px;
  font-size: 18px;
  color: #333;
}

/* ===== SCRAPE STATUS ===== */
.scrape-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.scrape-status.info { background: #e8f4fd; color: #0c5460; }
.scrape-status.success { background: #d4edda; color: #155724; }
.scrape-status.warning { background: #fff3cd; color: #856404; }
.scrape-status.error { background: #f8d7da; color: #721c24; }

/* ===== IMAGE PREVIEW ===== */
.image-preview {
  margin-top: 10px;
  max-width: 200px;
}
.image-preview img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #eee;
}

/* ===== PRODUCT TABLE ===== */
.product-table { overflow-x: auto; }
.product-table table {
  width: 100%;
  border-collapse: collapse;
}
.product-table th,
.product-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.product-table th {
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  font-weight: 600;
}
.table-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}
.table-thumb.no-image {
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #aaa;
}
.inactive-row { opacity: 0.5; }
.truncate {
  display: inline-block;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.text-muted { color: #999; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-muted { background: #eee; color: #888; }

/* ===== SITE NAVBAR (Public — Amazon-style) ===== */
.site-navbar {
  background: #232f3e;
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 20px;
}
.site-brand {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-brand:hover {
  color: #febd69;
}
.nav-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 680px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
}
.nav-search-input {
  flex: 1;
  height: 100%;
  padding: 0 14px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
  border-radius: 4px 0 0 4px;
}
.nav-search-input:focus {
  box-shadow: 0 0 0 3px rgba(254, 189, 105, 0.5);
}
.nav-search-btn {
  height: 100%;
  padding: 0 14px;
  background: #febd69;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: #232f3e;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
  white-space: nowrap;
  transition: background 0.15s;
}
.nav-search-btn:hover {
  background: #f3a847;
}

/* ===== SITE CONTENT ===== */
.site-content {
  min-height: calc(100vh - 56px - 60px);
  padding: 20px 0 40px;
  background: #eaeded;
}
.listing-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ddd;
}
.listing-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #0f1111;
}
.listing-meta {
  font-size: 13px;
  color: #565959;
}
.listing-meta a {
  color: #007185;
}
.listing-meta a:hover {
  color: #c7511f;
  text-decoration: underline;
}

/* ===== PRODUCT LIST ===== */
.product-list {
  background: white;
  border-radius: 8px;
  border: 1px solid #d5d9d9;
  overflow: hidden;
}
.product-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
  color: inherit;
}
.product-row:last-child {
  border-bottom: none;
}
.product-row:hover {
  background: #f7fafa;
}
.product-row-thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
  border: 1px solid #eee;
}
.product-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-row-nimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #aaa;
  background: #f0f0f0;
}
.product-row-info {
  flex: 1;
  min-width: 0;
}
.product-row-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: #0f1111;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-row:hover .product-row-info h3 {
  color: #007185;
}
.product-row-info p {
  font-size: 13px;
  color: #565959;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-row-link {
  flex-shrink: 0;
  font-size: 13px;
  color: #007185;
  font-weight: 500;
  white-space: nowrap;
}
.product-row:hover .product-row-link {
  color: #c7511f;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #d5d9d9;
}
.empty-state h2 {
  color: #0f1111;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.empty-state p {
  color: #565959;
  font-size: 14px;
}
.empty-state a {
  color: #007185;
}
.empty-state a:hover {
  color: #c7511f;
  text-decoration: underline;
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 20px 0;
  color: #ddd;
  font-size: 12px;
  background: #232f3e;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .admin-nav { flex-direction: column; gap: 10px; }
  .nav-right { flex-wrap: wrap; justify-content: center; }
  .form-row { flex-direction: column; }
  .actions-cell { flex-direction: column; }
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .site-brand { font-size: 18px; }
  .nav-search { max-width: 100%; }
  .product-row { gap: 12px; padding: 12px 14px; }
  .product-row-thumb { width: 50px; height: 50px; }
  .product-row-info h3 { font-size: 14px; }
  .product-row-info p { font-size: 12px; -webkit-line-clamp: 1; }
  .listing-header h1 { font-size: 16px; }
  .site-content { padding: 12px 0 24px; }
}
