:root {
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --bg-color: #fafafa;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --primary: #000000;
  --primary-hover: #333333;
  --accent: #2563eb;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

html,
body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* Glass Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.site-header .logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 2rem;
}

.site-header .logo img {
  height: 45px;
  width: auto;
}

.header-nav-container {
  flex-grow: 1;
}

.header-nav {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

.header-nav li {
  margin: 0 !important;
}

.header-nav a,
.logout-link {
  font-weight: 600;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s ease;
  text-decoration: none;
}

.header-nav a:hover,
.logout-link:hover {
  color: #ffffff !important;
}

.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
  .site-header {
    padding: 0 1rem;
  }

  .site-header .logo {
    margin-left: 1rem;
  }

  .header-nav-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
    min-width: 0;
    /* CRITICAL: Allows flex child to shrink and trigger scroll */
  }

  .header-nav-container::-webkit-scrollbar {
    display: none;
  }

  .header-nav {
    gap: 1rem;
    white-space: nowrap;
  }

  .header-nav a,
  .logout-link {
    font-size: 1rem !important;
  }

  .header-actions {
    gap: 1rem;
  }
}

/* Hero Section */
.hero-section {
  padding: 40px 2rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-section h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  background: linear-gradient(to right, #111827, #4b5563);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

/* Main Container */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 120px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 3rem;
}

@media (max-width: 768px) {
  .main-content {
    padding: 0 0.5rem 120px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .product-details {
    padding: 0.75rem !important;
    text-align: right !important;
    /* Fix inherited center alignment */
  }

  .product-title {
    font-size: 0.95rem !important;
    min-height: auto !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.25 !important;
  }

  .product-price {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
  }

  .product-meta {
    margin-bottom: 0.75rem !important;
    gap: 0.25rem !important;
  }

  .meta-badge {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }

  .modern-qty {
    transform: scale(0.8);
    transform-origin: center right;
  }
}

/* Product Card */
.product-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-xl);
}

.product-image-container {
  position: relative;
  width: 100%;
  padding-top: 100%;
  /* 1:1 Aspect Ratio */
  background: #ffffff;
  overflow: hidden;
}

.product-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Quick View Popup (Magnific Popup) overrides */
.mfp-iframe-holder .mfp-content {
  max-width: 1000px !important;
  width: 90% !important;
  height: 85vh !important;
  max-height: 800px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  margin: 5vh auto !important;
}

.mfp-iframe-scaler {
  overflow: hidden;
  height: 100% !important;
  padding: 0 !important;
}

.mfp-iframe-scaler iframe {
  box-shadow: none;
  background: #ffffff;
}

.mfp-bg {
  background: #111827;
  opacity: 0.5 !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

button.mfp-close {
  color: #111827 !important;
  right: 10px !important;
  top: 10px !important;
  font-size: 32px !important;
  opacity: 0.6 !important;
  background: #ffffff !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  line-height: 40px !important;
  text-align: center !important;
  padding: 0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

button.mfp-close:hover {
  opacity: 1 !important;
}

.product-card:hover .product-image-container img {
  transform: scale(1.08);
}

.product-details {
  padding: 2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.product-price {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1.1rem;
  background: #f3f4f6;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
}

.meta-badge.stock-ok {
  background: #dcfce7;
  color: #166534;
}

.product-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.product-actions {
  margin-top: auto;
}

.modern-qty {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border-radius: var(--radius-full);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  height: 54px;
}

.modern-qty input[type="button"] {
  background: transparent;
  border: none;
  width: 54px;
  height: 100%;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modern-qty input[type="button"]:hover {
  background: #e5e7eb;
}

.modern-qty input {
  flex-grow: 1;
  background: transparent;
  border: none;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-primary);
  height: 100%;
  width: 100%;
  -moz-appearance: textfield;
}

.modern-qty input::-webkit-outer-spin-button,
.modern-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Footer Action Bar */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: center;
  z-index: 50;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 1.2rem 4rem;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

/* Utilities */
.text-center {
  text-align: center;
}

/* ----------------------------------------------------------------------------------------------------
   RESTORED LEGACY STYLES FOR INNER PAGES 
---------------------------------------------------------------------------------------------------- */

/* Notify + Status-List */
.error {
  color: #cc0000;
}

.notify {
  background: #f8e59b;
  color: #262626;
}

.icon {
  height: 2em;
  width: auto;
}

.notify.white,
.icon_status.white {
  background: #fff;
  color: #262626;
}

.notify.yellow,
.icon_status.yellow {
  background: #ffcc00;
  color: #262626;
}

.notify.orange,
.icon_status.orange {
  background: #ff9600;
  color: #ffffff;
}

.notify.green,
.icon_status.green {
  background: #94bf0d;
  color: #ffffff;
}

.notify.grey,
.icon_status.grey {
  background: #333333;
  color: #ffffff;
}

.notify.blue,
.icon_status.blue {
  background: #131eec;
  color: #ffffff;
}

.notify.teal,
.icon_status.teal {
  background: #62cadca1;
  color: #000;
}

.notify.error {
  background: #990000;
  color: #fff;
}

/* Orders */
.status-list,
.subs.orders {
  border-bottom: 0.2em solid #262626;
}

.status-list .selected {
  background: #262626;
  color: #fff;
}

.icon_status.white {
  border: 0.1em #ddd solid;
}

.icon_status {
  height: 1em;
  width: 1em;
  margin-bottom: -0.25em;
  margin-left: 0.5em;
  border-radius: 50%;
  border: 0.1em #fff solid;
}

@media only screen and (min-width: 480px) and (max-width: 960px) {
  .status-list {
    text-align: center;
  }

  .icon_status {
    margin: 0 auto 0.5em auto;
    display: block !important;
  }
}

.subs.orders * {
  border-color: rgba(0, 0, 0, 0.1);
}

.subs.orders li.checked {
  opacity: 0.7;
  filter: alpha(opacity=70);
}

#change-status {
  padding: 0.38em;
}

/* Order */
.type_order .comments {
  height: 7em;
  max-width: 100%;
}

/* Print Orders */
.type_print #wrapper,
.type_picking_print #wrapper {
  width: 660px;
  margin: auto;
  overflow: visible;
}

.type_print .order,
.type_picking_print .order {
  background: #fff;
  box-shadow: 0 0 2em #ccc;
  page-break-after: always;
}

.type_print .order.last,
.type_picking_print .order.last {
  page-break-after: avoid;
}

.type_print table,
.type_picking_print table {
  width: 100%;
}

.type_print table thead,
.type_picking_print table thead {
  border-bottom: 2px solid #262626;
}

.type_print table thead th,
.type_picking_print table thead th {
  font-family: 'simple_clm';
  text-align: right;
  font-size: 1.2em;
  padding-left: 0.5em;
}

.type_print table tbody td,
.type_picking_print table tbody td {
  padding: 0.5em 0 0.5em 0.5em;
}

.type_print table tfoot,
.type_picking_print table tfoot {
  border-top: 2px solid #262626;
}

.type_print table tfoot td,
.type_picking_print table tfoot td {
  padding: 0.5em 0 0 0;
}

.type_print table tfoot .title,
.type_picking_print table tfoot .title {
  font-family: 'simple_clm';
  text-align: left;
  font-size: 1.2em;
  padding-left: 0.5em;
}

.type_print table tfoot .title.right,
.type_picking_print table tfoot .title.right {
  text-align: right;
}

.catalog-intro {
  font-size: 1.75rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 500;
}

.catalog-content {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 3rem;
  line-height: 1.8;
  text-align: center;
}