/* =====================================================
   VARIABLES & BASE STYLES
===================================================== */
:root {
  --bg: #f7f8fa;
  --panel: #fff;
  --muted: #6b7280;
  --text: #0f172a;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* =====================================================
   LAYOUT & CONTAINERS
===================================================== */
.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: 1.3rem;
  margin: 0;
}

/* =====================================================
   CARDS, GRID & PRODUCT DISPLAY
===================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.card-pad {
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.price {
  color: var(--primary);
  font-weight: 700;
}

/* =====================================================
   BUTTONS & LINKS
===================================================== */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.linkbtn {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

/* =====================================================
   TABLES & FORMS
===================================================== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.formrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* =====================================================
   COMPONENTS & UTILITIES
===================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
}

.badge {
  background: #dbeafe;
  color: #1e3a8a;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.notice {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
  color: #075985;
}

.footer {
  opacity: .7;
  margin: 30px 0 20px;
  text-align: center;
}


/* =====================================================
   SIDEBAR & NAVIGATION
===================================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow: auto;
}

.main {
  margin-left: 260px;
  padding: 16px;
}

.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 6px;
}

.nav a.active,
.nav a:hover {
  background: #f1f5f9;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.small {
  color: var(--muted);
  font-size: .9rem;
}

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

.qty input {
  max-width: 90px;
}

/* =====================================================
   FabiMed MOBILE PATCH — FRONTEND
===================================================== */

/* Base */
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f8f9fa;
  color: #333;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: auto;
  padding: 15px;
}

/* Header / Branding */
header {
  text-align: center;
  background: #fff;
  padding: 15px;
  border-bottom: 1px solid #ddd;
}

header img {
  max-height: 70px;
  width: auto;
  height: auto;
}

header h1,
header h2,
header h3 {
  margin: 6px 0 0;
  font-weight: 600;
  color: #222;
  font-size: 1.1rem;
}

/* Product Grid */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
}

.product-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  padding: 10px;
  text-align: center;
  border: 1px solid #e9ecef;
}

.product-card img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.product-card h3 {
  font-size: 1rem;
  margin: 10px 0;
  min-height: 2.2em;
}

.product-card .price {
  font-weight: 700;
  margin-bottom: 8px;
}

.product-card button,
.btn {
  background: #0073e6;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}

.product-card button:hover,
.btn:hover {
  background: #005bb5;
}

/* =====================================================
   CART & TABLES
===================================================== */
.table-wrap {
  overflow-x: auto;
  width: 100%;
}

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

.cart-table th,
.cart-table td,
table th,
table td {
  padding: 10px;
  border: 1px solid #ddd;
  white-space: nowrap;
  text-align: left;
}

/* =====================================================
   FORMS (Checkout, Contact)
===================================================== */
form {
  max-width: 520px;
  margin: 15px auto;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
}

label {
  display: block;
  font-weight: 600;
  margin-top: 8px;
}

.btn-primary {
  background: #0073e6;
  color: #fff;
  border: none;
  padding: 11px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover {
  background: #005bb5;
}

/* =====================================================
   FOOTER
===================================================== */
footer {
  text-align: center;
  font-size: 13px;
  color: #666;
  padding: 18px 0 30px;
}

/* =====================================================
   RESPONSIVE & MOBILE TWEAKS
===================================================== */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header img {
    max-height: 52px;
  }

  .product-card {
    padding: 8px;
  }

  .cart-table {
    font-size: 13px;
  }

  form {
    width: 100%;
    padding: 12px;
  }

  input,
  select,
  textarea {
    font-size: 14px;
  }
}

/* =====================================================
   CHECKOUT LAYOUT FIX
===================================================== */
.checkout-form {
  display: block;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.checkout-form .card {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

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

.checkout-form table th,
.checkout-form table td {
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.checkout-form .formrow {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.checkout-form .formrow > div {
  flex: 1 1 45%;
  min-width: 200px;
}

.checkout-form input,
.checkout-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.checkout-form button.btn {
  display: block;
  margin: 20px auto 0;
  padding: 12px 30px;
  font-size: 16px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.checkout-form button.btn:hover {
  background: #0056b3;
}
@media (max-width: 768px) {
  .checkout-form .formrow {
    flex-direction: column;
  }
}
/* ===============================
   RIGHT SIDEBAR MENU
================================*/
.right-menu-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  z-index: 1100;
  transition: background 0.3s ease;
}
.right-menu-toggle:hover {
  background: var(--primary-600);
}

.right-sidebar {
  position: fixed;
  top: 0;
  right: -260px;
  width: 240px;
  height: 100%;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -2px 0 10px rgba(0,0,0,0.15);
  padding: 20px;
  transition: right 0.35s ease-in-out;
  z-index: 1050;
}

.right-sidebar.open {
  right: 0;
}

.right-sidebar h3 {
  margin-top: 0;
  color: var(--primary);
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  font-weight: 700;
}

.right-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 20px 0 0 0;
}

.right-sidebar ul li {
  margin-bottom: 12px;
}

.right-sidebar ul li a {
  display: block;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.right-sidebar ul li a:hover {
  background: var(--primary);
  color: #fff;
}

/* Dark overlay when open */
body.sidebar-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: 1000;
}

/* Responsive Fix */
@media (max-width: 700px) {
  .right-sidebar {
    width: 80%;
    right: -80%;
  }
  .right-sidebar.open {
    right: 0;
  }
}
.small {
  font-size: 14px;
  margin-top: 5px;
}

/* Top Bar and Cartbadge additional stuff */

.site-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, #ffffffcc, #ffffffaa);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5e7eb;
}

.topbar-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cartbadge-floating {
  position: fixed;
  top: 16px;
  right: 20px;
  background: #111827;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 50;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, background 0.25s ease;
}
.cartbadge-floating:hover {
  background: #374151;
  transform: translateY(-2px);
}
.cartbadge-floating .cart-icon {
  width: 20px;
  height: 20px;
  filter: invert(1);
}
.cartbadge-floating #cartCount {
  background: #facc15;
  color: #111;
  padding: 2px 7px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
}
.cartbadge-floating #cartCount.updated {
  animation: pulseCart 0.4s ease;
}
@keyframes pulseCart {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Rating System */
.review-section {
  margin-top: 30px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}
/* .star {
  color: #ccc;
  font-size: 1.5rem;
  cursor: pointer;
}
.star.filled {
  color: gold;
} */
.review-summary h2 {
  font-size: 2rem;
  margin-bottom: 0;
}
.add-review-btn {
  background: #f0c14b;
  border: 1px solid #a88734;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}
.review-form.hidden {
  display: none;
}
.review-form {
  margin-top: 20px;
}
.review-form input,
.review-form textarea {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.review-list .review {
  border-top: 1px solid #eee;
  padding: 10px 0;
}
.review-list .review-rating {
  color: gold;
}

.stars-input,
.add-review-btn {
  position: relative;
  z-index: 20;
}

.add-review-btn {
  cursor: pointer;
}

.review-form .star {
  color: #ccc;
  cursor: pointer;
  font-size: 1.8rem;
  transition: color 0.2s;
}

.review-form .star.filled,
.review-form .star:hover {
  color: gold;
}


.stars {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 1rem;
}

.star {
  color: #ccc;
  position: relative;
}

.star.filled {
  color: gold;
}

.star.half {
  color: #ccc;
}

.star.half::before {
  content: '★';
  color: gold;
  position: absolute;
  left: 0;
  width: 50%;
  overflow: hidden;
}
