@import url("https://fonts.googleapis.com/css2?family=Alexandria:wght@100..900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Alexandria", sans-serif;
}

body {
  background: #fffdf1;
  scroll-behavior: smooth;
}

h3 {
  color: #2c4b2c;
}

a {
  text-decoration: none;
  color: #2c4b2c;
}

li {
  list-style: none;
  color: #2c4b2c;
}

header {
  display: flex;
  flex-direction: column;
}

header .category-topbar {
  display: flex;
  background: #f8f5da;
  padding: 25px;
  position: relative;
}

header .category-topbar ul {
  display: flex;
  margin: auto;
  gap: 15px;
  flex-direction: row-reverse;
}

header .top {
  background: #f8f5da;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 140px;
}

.bag-order {
  position: relative;
}

.quntity {
  position: absolute;
  font-size: 14px;
  top: 11px;
  right: 5px;
  font-weight: 500;
  color: #f8f5da;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo img {
  width: 130px;
  margin: 10px 0;
}

a.logo {
  display: flex;
  align-items: center;
}

.logo span {
  color: #2c4b2c;
  font-size: 24px;
  margin-left: -12px;
  font-family: cursive;
  font-weight: 600;
}

nav ul.top-bar {
  display: flex;
  font-size: 18px;
  flex-direction: row-reverse;
}

.top-bar .active {
  font-weight: 600;
  scale: 1.05;
}

nav ul.top-bar.icon {
  display: flex;
  font-size: 25px;
}

nav ul.top-bar.icon li:last-child {
  font-size: 27px;
}

nav ul.top-bar li {
  padding: 0 15px;
}

nav ul.top-bar li.nun {
  border-right: none;
}

nav ul.top-bar li a {
  color: #2c4b2c;
}

/* User Dropdown Menu */
.user-menu-container {
  position: relative;
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  top: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  min-width: 170px;
  width: 170px;
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
  border-radius: 12px;
  z-index: 2000;
  padding: 10px 0;
  direction: rtl; /* ضمان اتجاه النص للعربية */
}

.user-dropdown-menu.active {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.user-dropdown-menu .user-info {
  padding: 15px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.user-dropdown-menu .user-name {
  font-weight: 700;
  color: #2c4b2c;
  margin-bottom: 5px;
  font-size: 11px;
}

.user-dropdown-menu .user-balance {
  font-size: 14px;
  color: #666;
  margin-top: 10px;
}

.user-dropdown-menu .user-balance span {
  color: #2c4b2c;
  font-weight: 600;
}

.user-dropdown-menu hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 5px 0;
}

.user-dropdown-menu .dropdown-links {
  padding: 5px 0;
}

.user-dropdown-menu .dropdown-links li a,
.user-dropdown-menu .dropdown-links li .logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  color: #2d4b31;
  font-size: 11px;
  transition: all 0.2s ease;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
  font-family: inherit;
}

.dropdown-links li {
  padding: 0 !important;
}

.user-dropdown-menu .dropdown-links li a:hover,
.user-dropdown-menu .dropdown-links li .logout-btn:hover {
  background: #f8f5da;
  padding-right: 25px; /* تأثير بسيط عند المرور */
}

.user-dropdown-menu .dropdown-links li a i,
.user-dropdown-menu .dropdown-links li .logout-btn i {
  font-size: 14px;
}

.user-dropdown-menu .logout-btn {
  color: #a50000 !important;
  border-top: 1px solid #eee;
  margin-top: 5px;
}

footer {
  display: flex;
  flex-direction: column;
  margin-top: 70px;
}

footer .contact-footer {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-direction: row-reverse;
  background: #f8f5da;
  padding: 30px;
}

.card-footer {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.card-footer span {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: #fff;
  color: #2c4b2c;
  font-size: 18px;
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}

.category-footer {
  display: flex;
  justify-content: space-around;
  flex-direction: row-reverse;
  margin-top: 20px;
  margin-bottom: 20px;
}

.category-footer ul {
  display: flex;
  flex-direction: row-reverse;
  gap: 25px;
  font-size: 18px;
  align-items: center;
}

.category-footer ul a:hover {
  opacity: 0.8;
}

.social-footer {
  font-size: 24px;
  display: flex;
  flex-direction: row-reverse;
  gap: 20px;
}

.social-footer a {
  width: 50px;
  height: 50px;
  color: #fffdf1;
  background: #2c4b2c;
  border-radius: 50%;
  font-size: 29px;
  display: flex;
  justify-content: center;
  align-items: center;
  &:hover {
    opacity: 0.8;
  }
}

.line-footer {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  flex-direction: row-reverse;
  background: #f8f5da;
  padding: 30px;
  text-align: right;
}

.search {
  position: relative;
  display: flex;
  justify-content: center;
  flex-direction: row-reverse;
}

.search input {
  width: 100%;
  padding: 10px 50px;
  border: 1px solid #2d4b31;
  border-radius: 16px;
  text-align: right;
  background: #fffef7;
  padding-right: 30px;
  color: #2c4b2c;
  &:hover {
    border: 1px solid #2d4b31;
    box-shadow: none;
  }
  &:active {
    border: 1px solid #2d4b31;
    box-shadow: none;
  }
}

.search input:focus {
  outline: none;
  border: 1px solid #2d4b31;
  box-shadow: none;
}

.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 15px;
  width: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232d4b31'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  background-size: contain;
  cursor: pointer;
}

.search span {
  position: absolute;
  top: 10px;
  right: 26.5%;
  color: #2c4b2c;
  max-width: 1920px;
}

/* ── Search suggestions dropdown ── */
#searchSuggestions {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: #fffef7;
  border: 1.5px solid #2d4b31;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(44, 75, 44, 0.14);
  z-index: 9999;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f0ede4;
}

.search-suggestion-item:last-of-type {
  border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
  background: #f0f7f0;
}

.search-suggestion-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e0e7e0;
  flex-shrink: 0;
}

.search-suggestion-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.search-suggestion-name {
  font-size: 0.92rem;
  color: #2c4b2c;
  font-weight: 500;
}

.search-suggestion-hint {
  font-size: 0.78rem;
  color: #7a7a7a;
}

.search-suggestion-price {
  font-size: 0.8rem;
  color: #3a5c28;
  font-weight: 600;
}

.search-suggestion-highlight {
  color: #2c4b2c;
  font-weight: 700;
  background: #d6f0d6;
  border-radius: 3px;
  padding: 0 2px;
}

.search-suggestion-arrow {
  color: #aaa;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.search-suggestion-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.88rem;
  color: #2c4b2c;
  font-weight: 600;
  background: #f5faf5;
  border-top: 1.5px solid #e0ece0;
  border-radius: 0 0 12px 12px;
  transition: background 0.15s;
}

.search-suggestion-see-all:hover {
  background: #e5f5e5;
}

@media (max-width: 1024px) {
  header .top {
    padding: 5px 60px;
  }

  .search span {
    right: 22%;
    max-width: 1024px;
  }

  .logo img {
    width: 110px;
  }

  .logo span {
    font-size: 20px;
    margin-left: -10px;
  }

  nav ul.top-bar {
    font-size: 16px;
  }

  nav ul.top-bar.icon {
    font-size: 22px;
  }

  nav ul.top-bar.icon li:last-child {
    font-size: 24px;
  }

  nav ul.top-bar li {
    padding: 0 12px;
  }
}

/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
  .category-footer,
  footer .contact-footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
  }

  .search {
    width: 100% !important;
  }

  .search input {
    padding: 10px 30px;
  }

  .search span {
    right: 13%;
  }

  main {
    margin-bottom: 50px;
  }

  header .category-topbar ul.add-cart .add {
    padding: 5px 10px !important;
    font-size: 13px !important;
  }

  header .category-topbar ul {
    position: fixed;
    bottom: 0;
    background: #f8f5da;
    padding: 10px;
    z-index: 10;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    gap: 3px;
    flex-wrap: wrap;
  }

  header .category-topbar {
    padding: 0;
  }

  header .top {
    padding: 5px 20px;
    gap: 15px;
  }

  .quntity {
    top: 8px;
    right: 4px;
  }

  .logo img {
    width: 90px;
  }

  .logo span {
    font-size: 18px;
    margin-left: -8px;
  }

  nav ul.top-bar {
    font-size: 13px;
    flex-wrap: wrap;
    justify-content: center;
    width: 120px;
  }

  nav ul.top-bar.icon {
    font-size: 20px;
  }

  nav ul.top-bar.icon li:last-child {
    font-size: 22px;
  }

  nav ul.top-bar li {
    padding: 0 10px;
  }
}

/* Small Mobile Styles (max-width: 480px) */
@media (max-width: 480px) {
  header .top {
    padding: 10px 15px;
    flex-direction: column;
    gap: 15px;
  }

  .search input {
    padding: 8px 25px;
    font-size: 14px;
  }

  .search span {
    right: 8%;
    top: 8px;
    font-size: 18px;
  }

  .quntity {
    top: 6px;
    right: 2px;
  }

  .logo img {
    width: 150px;
  }

  .logo span {
    font-size: 16px;
    margin-left: -6px;
  }

  nav ul.top-bar {
    font-size: 12px;
  }

  nav ul.top-bar.icon {
    font-size: 18px;
  }

  nav ul.top-bar.icon li:last-child {
    font-size: 20px;
  }

  nav ul.top-bar li {
    padding: 0 8px;
  }
}

/* Scroll to Top Button */
.dashboard-fab {
  position: fixed;
  bottom: 145px;
  left: 40px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  z-index: 1001;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.dashboard-fab span {
  font-size: 22px;
  font-weight: 700;
}

.dashboard-fab:hover {
  transform: translateY(-3px) scale(1.06);
  filter: brightness(1.03);
}

.dashboard-fab::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 62px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(29, 27, 17, 0.94);
  color: #fff;
  padding: 7px 11px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dashboard-fab:hover::after {
  opacity: 1;
  transform: translate(4px, -50%);
}

.dashboard-fab--ceo {
  background: linear-gradient(135deg, #f9e59a, #e6c75b);
  color: #5c3f00;
  box-shadow: 0 8px 22px rgba(170, 130, 20, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.dashboard-fab--manager {
  background: linear-gradient(135deg, #ff6559, #b72222);
  color: #fff8f1;
  box-shadow: 0 8px 22px rgba(157, 24, 24, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dashboard-fab--trader {
  background: linear-gradient(135deg, #2f9f61, #1f6f42);
  color: #f2dfb0;
  box-shadow: 0 8px 22px rgba(25, 94, 56, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.up {
  position: fixed;
  bottom: 80px; /* Above the mobile nav */
  left: 40px;
  width: 50px;
  height: 50px;
  background: #fffdf1;
  color: #2c4b2c;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: translateY(100px);
  opacity: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  /* Use a conic-gradient for the progress border */
  background-image: conic-gradient(#31694e var(--progress, 0%), transparent 0);
  padding: 2px; /* Border thickness */
}

/* Inner circle to make it look like a ring */
.up::after {
  content: "";
  position: absolute;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  background: #fffdf1;
  border-radius: 50%;
  z-index: 1;
}

.up span {
  position: relative;
  z-index: 2;
  font-size: 30px;
  font-weight: bold;
}

.up.show {
  transform: translateY(0);
  opacity: 1;
}

.up:hover {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .dashboard-fab {
    bottom: 148px;
    left: auto;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .dashboard-fab span {
    font-size: 20px;
  }

  .dashboard-fab::after {
    display: none;
  }

  .up {
    bottom: 90px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
}
