@font-face {
  font-family: Vazir;
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font/dist/Vazir.woff2') format('woff2');
}
* {
  box-sizing: border-box;
  font-family: Vazir;
}
body {
  margin: 0;
  background: #f3f5f8;
  transition: 0.3s;
}
body.dark {
  background: #0e1117;
  color: #e8e8e8;
}

/* Main Content - Hidden by default */
.main-content {
  display: none;
}
.main-content.authenticated {
  display: block;
}

.container {
  max-width: 1250px;
  margin: auto;
  padding: 20px;
}
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.brand > div {
  text-align: right;
}
.logo {
  width: 55px;
  height: 55px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6ee7ff, #a78bfa);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: #04243b;
}
.brand-name {
  font-size: 20px;
  font-weight: 700;
}
.brand-sub {
  font-size: 13px;
  color: gray;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}
.controls-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  justify-content: flex-end;
}
.main-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  justify-content: space-between;
}
.main-controls-top {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.search {
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #ddd;
  min-width: 320px;
  flex: 0 1 auto;
}
.search input {
  border: none;
  outline: none;
  background: none;
  width: 100%;
  text-align: right;
  direction: rtl;
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tag {
  padding: 10px 14px;
  border-radius: 14px;
  background: white;
  cursor: pointer;
}
.tag.active {
  background: linear-gradient(209deg, #28cbebab, #a78bfaa5);
  color: white;
  border: none;
}
.switch-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: #222;
  color: white;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}
body.dark .switch-btn {
  background: #2d3748;
  color: #e8e8e8;
}
body.dark .switch-btn:hover {
  background: #374151;
}
.currency-btn,
.dark-btn {
  background: linear-gradient(209deg, #0a95b1b0, #6c42eaaa);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}
.dark-btn {
  background: #222;
}
body.dark .dark-btn {
  background: #fff;
  color: #000;
}
body.dark .search{
  background: #222;
    color: #ccc;
    border-color: #555;
}
body.dark .currency-btn {
  background: linear-gradient(209deg, #0a95b1b0, #6c42eaaa);
}
body.dark .tag {
  background: #222;
  color: #ccc;
  border-color: #555;
}
body.dark .tag.active {
  background: linear-gradient(135deg, #0ea5a4, #7c3aed);
  border: none;
  color: #fff;
}
@media (max-width: 768px) {
  .header {
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
    justify-content: space-between;
  }
  .brand {
    justify-content: flex-start;
    align-items: center;
    flex: 1;
    text-align: right;
  }
  .brand > div {
    text-align: right;
  }
  .brand-name {
    font-size: 18px;
  }
  .brand-sub {
    font-size: 12px;
  }
  .logo {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  .controls {
    align-items: flex-end;
    flex: 0 0 auto;
    gap: 8px;
  }
  .controls-row {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .currency-btn,
  .dark-btn {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .main-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    justify-content: flex-start;
  }
  .main-controls-top {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    width: 100%;
  }
  .search {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
  }
  .tags {
    justify-content: flex-start;
    flex: 0 0 auto;
    gap: 6px;
    flex-wrap: wrap;
  }
  .tag {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  .switch-btn {
    padding: 12px 14px;
    font-size: 14px;
    width: 100%;
  }
  .search input {
    text-align: right;
    font-size: 14px;
  }
}

/* PRODUCTS GRID */
.products {
  margin-top: 20px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .products {
    grid-template-columns: 1fr;
  }
}
.card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: 0.3s;
}
.card:hover {
  transform: translateY(-5px);
}
body.dark .card {
  background: #161b22;
  box-shadow: 0 0 0 1px #333;
}

.img-box {
  background: #fafafa;
  border-radius: 14px;
  padding: 0;
  border: 1px solid #eee;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s;
}
.img-box:hover {
  transform: scale(1.02);
}
.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body.dark .img-box {
  background: #1f2733;
  border-color: #333;
}

.title {
  font-size: 18px;
  font-weight: 700;
  margin-top: 10px;
}
.desc {
  font-size: 14px;
  margin-top: 5px;
  color: #333;
}
body.dark .desc {
  color: #bbb;
}

.price-box {
  background: #eef2ff;
  padding: 14px;
  border-radius: 12px;
  margin-top: 14px;
}
body.dark .price-box {
  background: #1f2733;
}
.price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-weight: 700;
}
.price-label {
  color: #6b7280;
}
body.dark .price-label {
  color: #aaa;
}

/* TABLE MODE */
.table-mode {
  display: none;
  margin-top: 20px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrapper {
  min-width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  background: white;
  border-radius: 14px;
  overflow: hidden;
}
body.dark table {
  background: #161b22;
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  text-align: center;
  white-space: nowrap;
}
th {
  background: #dbe1ff;
  font-size: 14px;
}
body.dark th {
  background: #222;
}
td {
  font-size: 13px;
}
td img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}
@media (max-width: 768px) {
  .table-mode {
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 20px;
    width: calc(100% + 40px);
  }
  table {
    min-width: 700px;
    font-size: 12px;
  }
  th,
  td {
    padding: 8px 6px;
    font-size: 11px;
  }
  th {
    font-size: 12px;
  }
  td img {
    width: 100px;
    height: 60px;
  }
}
@media (max-width: 480px) {
  .table-mode {
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 20px;
    width: calc(100% + 40px);
  }
  table {
    min-width: 600px;
  }
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s;
}
.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal-content {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s;
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  font-family: ui-rounded;
  font-weight: 500;
  cursor: pointer;
  
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}
.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (max-width: 768px) {
  .modal-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 25px;
  }
}

/* PASSWORD MODAL */
.password-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s;
  justify-content: center;
  align-items: center;
}
.password-modal.active {
  display: flex;
}
.password-modal-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: zoomIn 0.3s;
  text-align: center;
}
body.dark .password-modal-content {
  background: #161b22;
  color: #e8e8e8;
}
.password-modal-header {
  margin-bottom: 30px;
}
.password-modal-header h2 {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 700;
  color: #04243b;
}
body.dark .password-modal-header h2 {
  color: #e8e8e8;
}
.password-modal-header p {
  margin: 0;
  color: #666;
  font-size: 14px;
}
body.dark .password-modal-header p {
  color: #aaa;
}
.password-modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.password-modal-body input {
  padding: 14px 18px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
  direction: ltr;

}
.password-modal-body input:focus {
  border-color: #6ee7ff;
}
body.dark .password-modal-body input {
  background: #222;
  border-color: #555;
  color: #e8e8e8;
}
body.dark .password-modal-body input:focus {
  border-color: #6ee7ff;
}
.password-error {
  display: none;
  color: #ef4444;
  font-size: 14px;
  padding: 8px;
  background: #fee;
  border-radius: 8px;
}
body.dark .password-error {
  background: #3a1f1f;
  color: #ff6b6b;
}
.password-submit-btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, #6ee7ff, #a78bfa);
  color: #04243b;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.password-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(110, 231, 255, 0.4);
}
.password-submit-btn:active {
  transform: translateY(0);
}
@media (max-width: 768px) {
  .password-modal-content {
    padding: 30px 20px;
  }
  .password-modal-header h2 {
    font-size: 20px;
  }
}

/* LOG MODAL */
.log-btn {
  background: linear-gradient(209deg, #0a95b1b0, #6c42eaaa);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}
.log-btn:hover {
  opacity: 0.9;
}
body.dark .log-btn {
  background: linear-gradient(209deg, #0a95b1b0, #6c42eaaa);
}

.log-modal {
  display: none;
  position: fixed;
  z-index: 1500;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s;
  justify-content: center;
  align-items: center;
}
.log-modal.active {
  display: flex;
}
.log-modal-content {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: zoomIn 0.3s;
  display: flex;
  flex-direction: column;
}
body.dark .log-modal-content {
  background: #161b22;
  color: #e8e8e8;
}
.log-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}
body.dark .log-modal-header {
  border-bottom-color: #333;
}
.log-modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.log-modal-header .modal-close {
  position: static;
  background: rgba(0, 0, 0, 0.1);
  width: 35px;
  height: 35px;
  font-size: 24px;
  color: #333;
}
body.dark .log-modal-header .modal-close {
  background: rgba(255, 255, 255, 0.1);
  color: #e8e8e8;
}
.log-modal-body {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  background: #f9f9f9;
  border-radius: 12px;
  overflow: hidden;
}
body.dark .log-table {
  background: #1f2733;
}
.log-table thead {
  background: linear-gradient(135deg, #6ee7ff, #a78bfa);
  color: #04243b;
}
body.dark .log-table thead {
  background: linear-gradient(135deg, #0ea5a4, #7c3aed);
  color: #fff;
}
.log-table th,
.log-table td {
  padding: 12px 15px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}
body.dark .log-table td {
  border-bottom-color: #333;
}
.log-table code {
  background: #e8e8e8;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
}
body.dark .log-table code {
  background: #2d3748;
  color: #e8e8e8;
}
.log-modal-footer {
  padding-top: 15px;
  border-top: 2px solid #eee;
  text-align: center;
}
body.dark .log-modal-footer {
  border-top-color: #333;
}
.download-log-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #6ee7ff, #a78bfa);
  color: #04243b;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.download-log-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(110, 231, 255, 0.4);
}
@media (max-width: 768px) {
  .log-modal-content {
    padding: 20px;
    max-width: 95%;
  }
  .log-table {
    font-size: 12px;
  }
  .log-table th,
  .log-table td {
    padding: 8px 10px;
  }
}
