/* =============================== RESET & BASE ================================ */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Kufi Arabic", "Cairo", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(37,99,235,.22), transparent 55%),
              radial-gradient(900px 500px at 10% 0%, rgba(34,197,94,.18), transparent 60%),
              #0b1220;
  color: #ffffff;
  line-height: 1.6;
}
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* =============================== HEADER ================================ */
.topbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(2,6,23,.95), rgba(15,23,42,.95));
  border-bottom: 1px solid rgba(255,255,255,.08);
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.logo {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 700;
  white-space: nowrap;
}
.nav-menu {
  display: flex;
  gap: 20px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.nav-link {
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
  transition: color 0.3s ease;
  padding: 8px 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-link:hover {
  color: #22c55e;
  text-decoration: none;
}
.lang-selector {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.lang-btn {
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: transparent;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-btn.active {
  background: linear-gradient(135deg, #2563eb, #22c55e);
  border-color: transparent;
}
.lang-btn:hover {
  border-color: #2563eb;
}

/* =============================== LAYOUT ================================ */
.container { max-width: 1200px; margin: auto; padding: 20px; }
.footer {
  text-align: center;
  padding: 30px 20px;
  color: #9ca3af;
  font-size: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 40px;
}

/* =============================== HERO ================================ */
.hero {
  max-width: 720px;
  margin: 60px auto 40px;
  text-align: center;
}
.hero h1 {
  font-size: 48px;
  font-weight: 900;
  margin: 0 0 20px;
}
.tagline {
  font-size: 20px;
  color: #9ca3af;
  margin: 18px 0 30px;
}
.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  min-height: 48px;
}

/* =============================== BUTTONS ================================ */
.btn {
  display: inline-block;
  cursor: pointer;
  border: none;
  font-weight: 900;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 14px;
  transition: all 0.3s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: linear-gradient(135deg,#2563eb,#22c55e);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.05);
  text-decoration: none;
}
.btn.outline {
  background: transparent;
  border: 2px solid #2563eb;
  color: #fff;
}
.btn.outline:hover {
  background: rgba(37,99,235,.1);
  text-decoration: none;
}
.btn.danger {
  background: #ef4444;
  color: #fff;
}
.btn.danger:hover:not(:disabled) {
  background: #dc2626;
  text-decoration: none;
}
.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
  min-height: 40px;
}

/* =============================== FORMS ================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 14px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: #ffffff;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  min-height: 44px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: rgba(37,99,235,.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =============================== ALERTS ================================ */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 800;
  font-size: 15px;
}
.alert-success {
  background: rgba(34,197,94,.15);
  border: 1px solid rgba(34,197,94,.35);
  color: #86efac;
}
.alert-danger {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
}

/* =============================== STORE ================================ */
.store-container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

.store-header {
  margin-bottom: 30px;
}
.store-header h1 {
  margin: 0 0 20px;
}

.store-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 20px;
  align-items: end;
}

.search-input,
.filter-select,
.items-per-page-select {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.2);
  background: #ffffff;
  color: #333333;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  min-height: 44px;
}

.filter-select option,
.items-per-page-select option {
  background-color: #ffffff;
  color: #333333;
  padding: 8px;
}

.filter-select:hover,
.items-per-page-select:hover {
  border-color: #999;
  background-color: #f9f9f9;
}

.filter-select:focus,
.items-per-page-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 5px rgba(37, 99, 235, 0.5);
}

.search-input::placeholder {
  color: #9ca3af;
}

.price-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.price-range-inputs input {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: #ffffff;
  border-radius: 8px;
  min-height: 44px;
  font-size: 15px;
}

@media (max-width: 1024px) {
  .store-controls {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 768px) {
  .store-controls {
    grid-template-columns: 1fr;
  }
  .search-input,
  .filter-select,
  .items-per-page-select {
    font-size: 16px;
  }
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 20px;
}
@media (max-width: 1024px) {
  .store-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .store-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  background: linear-gradient(180deg, rgba(18,26,43,.95), rgba(15,23,42,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}

.product-image {
  width: 100%;
  height: 220px;
  background: rgba(0,0,0,.2);
  overflow: hidden;
  position: relative;
}
.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-new {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #000;
  font-weight: 900;
  padding: 6px 10px;
  border-radius: 50%;
  font-size: 12px;
  z-index: 10;
}

.product-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-info h3 {
  font-size: 17px;
  margin: 0 0 8px;
  font-weight: 900;
  line-height: 1.3;
}

.product-description {
  font-size: 14px;
  color: #9ca3af;
  margin: 4px 0 8px;
  line-height: 1.4;
  flex: 1;
}

.product-meta {
  font-size: 13px;
  color: #9ca3af;
  margin: 4px 0;
}

.product-prices {
  margin: 12px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.price-original {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 13px;
}

.price-label {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 700;
}

.price-sale {
  font-size: 22px;
  font-weight: 900;
  color: #22c55e;
}

.product-stock {
  margin: 8px 0;
  font-size: 13px;
  font-weight: 800;
}
.stock-available {
  color: #22c55e;
}
.stock-unavailable {
  color: #ef4444;
}

.add-to-cart-form {
  margin-top: auto;
}
.add-to-cart-form .btn {
  width: 100%;
  text-align: center;
}

.no-products {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 16px;
  grid-column: 1 / -1;
}

.pagination {
  text-align: center;
  margin-top: 40px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.pagination .btn {
  margin: 0;
}

/* =============================== CART ================================ */
.cart-container {
  max-width: 900px;
  margin: auto;
  padding: 20px;
}

.empty-cart {
  text-align: center;
  padding: 60px 20px;
}
.empty-cart p {
  color: #9ca3af;
  font-size: 18px;
  margin-bottom: 20px;
}

.cart-items {
  margin-bottom: 30px;
}

.cart-item-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  margin-bottom: 12px;
}
.cart-item-row img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}
.cart-item-row h3 {
  font-size: 16px;
  margin: 0 0 8px;
}
.cart-item-row .price {
  font-size: 20px;
  font-weight: 900;
  text-align: right;
}
@media (max-width: 768px) {
  .cart-item-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cart-item-row img {
    width: 100%;
    height: 200px;
    margin: 0 auto;
  }
  .cart-item-row .price {
    text-align: left;
    font-size: 24px;
    margin: 12px 0;
  }
  .cart-item-row h3 {
    font-size: 18px;
  }
  .cart-item-row form,
  .cart-item-row button {
    width: 100%;
  }
  .cart-item-row button {
    margin-top: 8px;
  }
}

.cart-summary {
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
.cart-summary h2 {
  margin-top: 0;
  font-size: 22px;
}
.cart-summary p {
  margin: 8px 0;
  font-size: 16px;
}

.cart-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .cart-actions {
    flex-direction: column;
  }
  .cart-actions .btn {
    width: 100%;
  }
}

/* =============================== CHECKOUT ================================ */
.checkout-container {
  max-width: 1000px;
  margin: auto;
  padding: 20px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 30px;
}
@media (max-width: 768px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

.order-summary {
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
}
.order-summary h2 {
  margin-top: 0;
}

.checkout-form {
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
}
.checkout-form h2 {
  margin-top: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.form-actions .btn {
  flex: 1;
  text-align: center;
  min-width: 120px;
}

/* =============================== TABLES ================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
  font-size: 14px;
}
.table th {
  background: rgba(255,255,255,.04);
  font-weight: 900;
  color: #cbd5e1;
}
.table tr:last-child td {
  border-bottom: none;
}
@media (max-width: 768px) {
  .table {
    font-size: 13px;
  }
  .table th,
  .table td {
    padding: 8px;
  }
}

/* =============================== ADMIN ================================ */
.admin-container {
  max-width: 1100px;
  margin: auto;
  padding: 20px;
}

.admin-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}
.admin-btn {
  display: block;
  text-align: center;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: #fff;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-btn:hover {
  background: rgba(255,255,255,.1);
  text-decoration: none;
}
.admin-btn.primary {
  background: linear-gradient(135deg,#2563eb,#22c55e);
  border: none;
}
.admin-btn.danger {
  background: #ef4444;
  border: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(18,26,43,.95), rgba(15,23,42,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}
.stat-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #9ca3af;
  font-weight: 800;
}
.stat-value {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  color: #22c55e;
}

/* Scanner Styles */
#scannerContainer {
  width: 100%;
  height: 300px;
  overflow: hidden;
  position: relative;
  background: #000;
  border-radius: 8px;
}
#scannerContainer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.viewport {
  width: 100%;
  height: 100%;
  position: relative;
}

.card {
  background: linear-gradient(180deg, rgba(18,26,43,.95), rgba(15,23,42,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: 20px;
}
.login-box {
  background: linear-gradient(180deg, rgba(18,26,43,.95), rgba(15,23,42,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-form .btn {
  width: 100%;
  text-align: center;
}
@media (max-width: 480px) {
  .login-box {
    padding: 24px;
  }
}

.upload-form,
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-edit-card {
  background: linear-gradient(180deg, rgba(18,26,43,.95), rgba(15,23,42,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
}
.product-edit-card h2 {
  margin-top: 0;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-wrap: wrap;
}
.tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-weight: 800;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  min-height: 44px;
}
.tab:hover {
  color: #fff;
}
.tab.active {
  color: #22c55e;
  border-bottom-color: #22c55e;
}

.search-form {
  margin-bottom: 20px;
}
.search-form .form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}
@media (max-width: 600px) {
  .search-form .form {
    grid-template-columns: 1fr;
  }
}

/* =============================== HOME ================================ */
.home-container {
  max-width: 1100px;
  margin: auto;
  padding: 20px;
}

.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 40px 0;
}
.stat-item {
  text-align: center;
  padding: 20px;
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
}
.stat-item h3 {
  margin: 0;
  font-size: 32px;
  color: #22c55e;
}
.stat-item p {
  margin: 8px 0 0;
  color: #9ca3af;
  font-size: 15px;
}

.section {
  margin: 40px 0;
}
.section h2 {
  margin-top: 0;
}
.section h3 {
  margin-top: 20px;
  margin-bottom: 12px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.feature-list li {
  margin: 8px 0;
  padding-left: 24px;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
}
.feature-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 900;
}

.cta-section {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, rgba(37,99,235,.15), rgba(34,197,94,.15));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  margin: 40px 0;
}
.cta-section h2 {
  margin-top: 0;
}

.social-section {
  text-align: center;
  padding: 40px;
  background: rgba(18,26,43,.95);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  margin: 40px 0;
}
.social-section h3 {
  margin-top: 0;
}
.social-section p {
  margin: 12px 0;
}
.social-section a {
  display: block;
  margin: 8px 0;
  color: #93c5fd;
  font-size: 15px;
}
.social-section a:hover {
  color: #22c55e;
  text-decoration: none;
}

/* =============================== RESPONSIVE ================================ */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  .topbar {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }
  .nav-menu {
    width: 100%;
    justify-content: center;
    gap: 12px;
  }
  .nav-link {
    font-size: 15px;
  }
  .hero h1 {
    font-size: 32px;
  }
  .tagline {
    font-size: 16px;
  }
  .container {
    padding: 16px;
  }
  .admin-menu {
    grid-template-columns: 1fr;
  }
  h2 {
    font-size: 24px;
  }
  h3 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 28px;
  }
  .btn-lg {
    padding: 12px 24px;
    font-size: 15px;
  }
  .price-sale {
    font-size: 20px;
  }
}

/* =============================== GLOBAL PRINT STYLES ================================ */
@media print {
  .topbar, 
  .nav-menu, 
  .footer, 
  .btn, 
  .search-bar, 
  .pagination,
  .no-print,
  .admin-menu {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }
  .container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .table, .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }
  .table th, .table td {
    border-color: #