/* ============================================
   THE H TIPS — Main Stylesheet
   Colors: #12341C (forest green), #D0A14C (gold)
   ============================================ */

:root {
  --green: #12341C;
  --green-mid: #1a4a28;
  --green-light: #2a6040;
  --gold: #D0A14C;
  --gold-light: #e8b86a;
  --gold-dim: #b88a3a;
  --bg: #F7F4EF;
  --bg-card: #ffffff;
  --text: #1e1e1e;
  --text-muted: #6b7280;
  --border: #e2ddd6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 10px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Raleway', 'Inter', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ============================================
   HEADER
   ============================================ */
.site-header {
  background: var(--green);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--green);
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.logo-tagline {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav a {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: var(--transition);
}

.site-nav a:hover,
.site-nav a.active {
  color: #fff;
  background: var(--green-mid);
}

.nav-badge {
  background: var(--gold);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 60%, #1e5a35 100%);
  padding: 30px 24px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(208,161,76,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(208,161,76,0.15);
  border: 1px solid rgba(208,161,76,0.3);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.hero h1 span {
  color: var(--gold);
}

.hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  max-width: 520px;
  margin: 0 auto 28px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
  font-family: var(--font-heading);
}

.stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================
   FILTERS
   ============================================ */
.filters-section {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 64px;
  z-index: 90;
}

.filters-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.filter-input,
.filter-select {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(208,161,76,0.15);
}

.filter-input {
  min-width: 220px;
}

.filter-select {
  min-width: 130px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filters-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-reset {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-body);
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-reset:hover {
  border-color: var(--gold);
  color: var(--text);
}

.result-count {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================================
   MAIN TABLE SECTION
   ============================================ */
.table-section {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
}

.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

thead {
  background: var(--green);
}

thead th {
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: var(--transition);
}

thead th:hover {
  background: var(--green-mid);
  color: var(--gold);
}

thead th.sorted {
  color: var(--gold);
}

thead th.sorted::after {
  content: attr(data-dir);
  margin-left: 5px;
  font-size: 10px;
}

thead th.no-sort {
  cursor: default;
}

thead th.no-sort:hover {
  background: var(--green);
  color: rgba(255,255,255,0.9);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(208,161,76,0.05);
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  vertical-align: middle;
}

/* Product image cell */
.td-image {
  width: 72px;
}

.product-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg);
  padding: 4px;
  border: 1px solid var(--border);
}

.product-img-placeholder {
  width: 60px;
  height: 60px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
  font-size: 22px;
}

/* Brand + Model cell */
.td-product {
  min-width: 180px;
}

.product-brand {
  font-weight: 700;
  color: var(--green);
  font-size: 14px;
}

.product-model {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.product-notes {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Capacity badge */
.capacity-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(18,52,28,0.08);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Condition badge */
.condition-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.condition-new {
  background: rgba(34,197,94,0.1);
  color: #166534;
}

.condition-refurbished {
  background: rgba(59,130,246,0.1);
  color: #1d4ed8;
}

.condition-used {
  background: rgba(245,158,11,0.1);
  color: #92400e;
}

/* Price */
.td-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}

/* Price per TB */
.td-pptb {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.pptb-highlight {
  color: var(--green);
  font-weight: 700;
}

/* Buy button */
.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 7px;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(208,161,76,0.3);
}

.btn-buy:hover {
  background: var(--gold-light);
  color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(208,161,76,0.4);
}

.btn-buy svg {
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}

/* ============================================
   TABLE FOOTER / PAGINATION INFO
   ============================================ */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--green);
  color: rgba(255,255,255,0.7);
  margin-top: 60px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}

.footer-brand .logo-name {
  font-size: 20px;
}

.footer-brand .logo-tagline {
  margin-bottom: 12px;
  display: block;
}

.footer-desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.6);
  max-width: 300px;
}

.footer-disclaimer {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 10px;
  line-height: 1.6;
}

.footer-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   ADMIN PAGE STYLES
   ============================================ */
.admin-body {
  background: #f0f0f0;
  min-height: 100vh;
}

/* Login screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-mid) 100%);
  padding: 24px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  margin-bottom: 24px;
}

.login-logo .logo-icon {
  width: 56px;
  height: 56px;
  font-size: 26px;
  margin: 0 auto 10px;
}

.login-card h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 6px;
}

.login-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.input-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input-group input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
  background: var(--bg);
}

.input-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(208,161,76,0.15);
}

.login-error {
  color: #dc2626;
  font-size: 13px;
  background: rgba(220,38,38,0.08);
  padding: 8px 12px;
  border-radius: 6px;
  display: none;
}

.login-error.show { display: block; }

/* Admin layout */
.admin-page { display: none; }
.admin-page.show { display: block; }

.admin-header {
  background: var(--green);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header .logo-name {
  font-size: 16px;
}

.admin-badge {
  background: var(--gold);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 5px;
  margin-left: 8px;
  text-transform: uppercase;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-family: var(--font-body);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover { background: rgba(255,255,255,0.2); }

.admin-main {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

/* Admin cards */
.admin-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.admin-card-header h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

.admin-card-body { padding: 24px; }

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid .full-width { grid-column: 1 / -1; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-field input,
.form-field select,
.form-field textarea {
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: var(--transition);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(208,161,76,0.15);
}

.form-field textarea {
  resize: vertical;
  min-height: 70px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  flex: 1;
  justify-content: center;
}

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

.btn-gold {
  background: var(--gold);
  color: var(--green);
}

.btn-gold:hover { background: var(--gold-light); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

.btn-outline:hover { border-color: var(--gold); color: var(--text); }

.btn-danger {
  background: transparent;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger:hover { background: #fef2f2; }

.btn-edit {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
}

.btn-edit:hover { border-color: var(--green); color: var(--green); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Admin product table */
.admin-table-wrapper { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.admin-table thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.admin-table thead th:hover {
  background: var(--bg);
  color: var(--text-muted);
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--border);
}

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

.admin-table tbody tr:hover { background: rgba(208,161,76,0.04); }

.admin-table tbody td {
  padding: 12px 14px;
  font-size: 13px;
  vertical-align: middle;
}

.inactive-row { opacity: 0.5; }

/* Export section */
.export-bar {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.export-bar .export-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  font-family: var(--font-heading);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Status toggle */
.toggle-status {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  padding: 2px;
  display: flex;
  align-items: center;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e1e1e;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 360px;
}

.toast.success { background: var(--green); }
.toast.error { background: #dc2626; }

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 960px) {
  .admin-main {
    grid-template-columns: 1fr;
  }

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

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }

  .footer-top > *:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .header-inner { padding: 0 16px; }

  .logo-tagline { display: none; }

  .hero { padding: 40px 16px 36px; }

  .hero-stats { gap: 20px; }

  .filters-inner {
    padding: 12px 16px;
    gap: 8px;
  }

  .filter-input { min-width: 0; width: 100%; }

  .filters-right { width: 100%; justify-content: space-between; }

  .table-section { padding: 0 12px; margin: 20px auto; }

  .footer-top { grid-template-columns: 1fr; }

  .form-grid { grid-template-columns: 1fr; }

  .stats-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .site-nav a span { display: none; }
  .stat-card .stat-value { font-size: 22px; }
}
