/* ============================================================
   Duluth Tracker — stylesheet
   ============================================================ */

:root {
  --red:       #c0392b;
  --red-dark:  #96281b;
  --green:     #27ae60;
  --blue:      #1a73e8;
  --gray-100:  #f8f9fa;
  --gray-200:  #e9ecef;
  --gray-400:  #ced4da;
  --gray-600:  #6c757d;
  --gray-800:  #343a40;
  --white:     #ffffff;
  --shadow:    0 2px 8px rgba(0,0,0,0.10);
  --radius:    8px;
  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  background: var(--gray-800);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}
.navbar-brand:hover { text-decoration: none; color: #ddd; }

.navbar-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.navbar-links a {
  color: #ccc;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.navbar-links a:hover,
.navbar-links a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  text-decoration: none;
}

.navbar-user {
  position: relative;
}

.user-menu-btn {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.25); }

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}
.user-menu.open .user-menu-dropdown { display: block; }

.user-menu-dropdown a {
  display: block;
  padding: 11px 16px;
  color: var(--gray-800);
  font-size: 0.875rem;
  text-decoration: none;
  transition: background 0.12s;
}
.user-menu-dropdown a:hover { background: var(--gray-100); }
.user-menu-dropdown .logout-link { color: var(--red); border-top: 1px solid var(--gray-200); }

/* ============================================================
   Container
   ============================================================ */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 32px;
  flex: 1;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; text-decoration: none; }

.btn-primary   { background: var(--red);   color: var(--white); }
.btn-outline   { background: transparent; color: var(--gray-800); border: 1px solid var(--gray-400); }
.btn-outline:hover { background: var(--gray-200); }
.btn-watch     { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.btn-watching  { background: #ffc107; color: #333; }
.btn-danger    { background: #dc3545; color: var(--white); }
.btn-sm        { padding: 4px 10px; font-size: 0.8rem; }
.btn-block     { width: 100%; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--gray-800);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-400);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--white);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}
.form-hint { font-size: 0.78rem; color: var(--gray-600); margin-top: 3px; display: block; }

/* ============================================================
   Auth pages
   ============================================================ */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 16px;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.auth-subtitle {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 28px;
  font-size: 0.9rem;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* ============================================================
   Alerts / flash messages
   ============================================================ */
.flash-messages { margin-bottom: 16px; }
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ============================================================
   Page header
   ============================================================ */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}
.text-muted { color: var(--gray-600); font-size: 0.9rem; margin-top: 4px; }

/* ============================================================
   Stats row
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
  border-top: 4px solid var(--blue);
}
.stat-card--sale  { border-top-color: var(--red); }
.stat-card--watch { border-top-color: #ffc107; }
.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label  { font-size: 0.8rem; color: var(--gray-600); margin-top: 4px; }

/* ============================================================
   Sections
   ============================================================ */
.section { margin-bottom: 40px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 { font-size: 1.25rem; font-weight: 700; }

/* ============================================================
   Product grid
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.product-card--sale { border: 2px solid var(--red); }

.product-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.product-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-800);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-name:hover { color: var(--red); text-decoration: none; }

.product-category {
  font-size: 0.75rem;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-price {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.price-current  { font-size: 1.1rem; font-weight: 700; color: var(--red); }
.price-original { font-size: 0.85rem; color: var(--gray-600); text-decoration: line-through; }
.price-badge {
  background: var(--red);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.product-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}

.watch-since {
  font-size: 0.75rem;
  color: var(--gray-600);
}

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  margin-bottom: 24px;
}
.search-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.search-input { flex: 1; min-width: 240px; }
.search-form select[name="category"] { min-width: 220px; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}
.page-info { font-size: 0.875rem; color: var(--gray-600); }

/* ============================================================
   Product detail
   ============================================================ */
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--blue); }

.product-detail-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 768px) {
  .product-detail-layout { grid-template-columns: 1fr; }
}

.product-detail-image img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.no-image {
  width: 100%;
  height: 300px;
  background: var(--gray-200);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
}

.product-detail-info h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.product-category-tag {
  display: inline-block;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.price-display {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.price-current-lg  { font-size: 2rem; font-weight: 700; color: var(--red); }
.price-original-lg { font-size: 1.1rem; color: var(--gray-600); text-decoration: line-through; }
.price-badge-lg {
  background: var(--red);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
}

.price-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.price-stat { text-align: center; }
.stat-val { display: block; font-size: 1.1rem; font-weight: 700; }
.stat-lbl { display: block; font-size: 0.72rem; color: var(--gray-600); margin-top: 2px; }

.watch-action { margin-bottom: 20px; }
.watch-hint { font-size: 0.8rem; color: var(--gray-600); margin-top: 6px; }

.product-meta {
  font-size: 0.85rem;
  color: var(--gray-600);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--gray-200);
  padding-top: 16px;
  margin-top: 16px;
}

/* ============================================================
   Chart
   ============================================================ */
.chart-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-height: 360px;
}

/* ============================================================
   Data table
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 0.875rem;
}
.data-table th {
  background: var(--gray-800);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-200);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-100); }
.row-sale td { background: #fff8f8; }
.badge-sale {
  background: var(--red);
  color: var(--white);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ============================================================
   Quick links
   ============================================================ */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.quick-link-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--gray-800);
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}
.quick-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  text-decoration: none;
  color: var(--red);
}
.quick-link-icon { font-size: 2rem; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}
.empty-state p { margin-bottom: 12px; }
.empty-state code {
  display: inline-block;
  background: var(--gray-200);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-top: 8px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--gray-800);
  color: #aaa;
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
}
.footer a { color: #ccc; }

/* ============================================================
   Account settings
   ============================================================ */
.account-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 24px;
  max-width: 1000px;
}

.account-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.account-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}
.account-card--danger { border: 1px solid #f5c6cb; }
.account-card--danger h2 { color: var(--red); }
.account-card--danger p { color: var(--gray-600); margin-bottom: 16px; font-size: 0.875rem; }

.account-info { display: flex; flex-direction: column; gap: 12px; }
.account-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
}
.account-info-row:last-child { border-bottom: none; }
.info-label { color: var(--gray-600); font-weight: 500; }
.info-value { font-weight: 600; }
