/* PHARMACY TIỀN ĐẾN - GLOBAL STYLE WITH WARM PALETTE */
:root {
  --bg-color: #fffdf9; /* Kem sữa ấm dịu nhạt */
  --primary-color: #e07a5f; /* Cam đất ấm áp chủ đạo */
  --secondary-color: #3d405b; /* Xám đen navy dịu, tương phản tốt */
  --accent-color: #81b29a; /* Xanh thảo dược dịu nhẹ y tế */
  --white: #ffffff;
  --light-amber: #fef3c7; /* Vàng cam nhạt làm nổi bật */
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--secondary-color);
}

/* HEADER STYLE */
.header {
  background-color: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
}
.logo h1 {
  margin: 0;
  font-size: 24px;
  color: var(--accent-color);
  cursor: pointer;
}
.logo .accent-text {
  color: var(--primary-color);
}

/* SEARCH BOX */
.search-box {
  display: flex;
  flex: 1;
  max-width: 500px;
  margin: 0 25px;
}
.search-box input {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #f1f5f9;
  background-color: #f8fafc;
  border-radius: 6px 0 0 6px;
  outline: none;
  font-size: 14px;
  transition: all 0.3s;
}
.search-box input:focus {
  border-color: var(--primary-color);
  background-color: var(--white);
}
.search-box button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-weight: bold;
}
.search-box button:hover {
  opacity: 0.9;
}

/* ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}
.btn-text {
  background: none;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
  font-size: 14px;
}
.btn-text:hover {
  color: var(--primary-color);
}
.cart-btn {
  background-color: var(--light-amber);
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cart-btn:hover {
  background-color: #fde68a;
}
.badge {
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  padding: 2px 7px;
  font-size: 12px;
}
.admin-link-btn {
  text-decoration: none;
  font-size: 14px;
  background-color: #edf2f7;
  color: #4a5568;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 500;
}
.admin-link-btn:hover {
  background-color: #cbd5e0;
}

/* NAVBAR */
.navbar {
  background-color: var(--accent-color);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
}
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  overflow-x: auto;
}
.nav-links li a {
  display: block;
  padding: 12px 20px;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links li a:hover,
.nav-links li a.active {
  background-color: rgba(255, 255, 255, 0.15);
}

/* PROMO BANNER */
.promo-banner {
  background: linear-gradient(
    135deg,
    #e0f2fe 0%,
    #bbf7d0 100%
  ); /* Màu nền gradient dịu mát chuẩn y tế */
  border-radius: 16px;
  margin: 20px 0 30px 0;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 50px;
  gap: 30px;
}
.banner-content {
  flex: 1;
  max-width: 55%;
}
.banner-badge {
  background-color: #ef4444;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 12px;
}
.banner-content h2 {
  color: #065f46; /* Màu xanh lá đậm */
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 12px;
  font-weight: 700;
}
.banner-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}
.banner-content p {
  color: #374151;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 25px;
}
.banner-btn-primary {
  background-color: #059669;
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(5, 150, 105, 0.2);
}

.banner-btn-primary:hover {
  background-color: #047857;
  transform: translateY(-2px);
}

.banner-note {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

/* Khu vực xử lý hình ảnh quảng cáo */
.banner-image {
  flex: 1;
  max-width: 40%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.banner-image img {
  max-width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  filter: drop-shadow(
    0 10px 15px rgba(0, 0, 0, 0.1)
  ); /* Tạo hiệu ứng nổi 3D cho chai thuốc */
  transition: transform 0.5s ease;
}

/* Hiệu ứng khi rê chuột vào banner thì hình ảnh hơi phóng to nhẹ */
.promo-banner:hover .banner-image img {
  transform: scale(1.05);
}

/* LAYOUT MAIN */
.main-content {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}
.content-container {
  display: table;
  width: 100%;
}
.sidebar {
  display: table-cell;
  width: 250px;
  vertical-align: top;
  padding-right: 30px;
}
.products-area {
  display: table-cell;
  vertical-align: top;
}

.filter-group {
  background-color: var(--white);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  margin-bottom: 20px;
}
.filter-group h3 {
  margin-top: 0;
  font-size: 16px;
}
.filter-group h4 {
  margin: 15px 0 8px 0;
  font-size: 14px;
  color: #718096;
}
.price-filters {
  display: block;
}
.btn-filter {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.btn-filter:hover {
  background-color: var(--light-amber);
  border-color: #fcd34d;
}
#sortSelect {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e0;
}

/* PRODUCT GRID */
.section-heading {
  margin-top: 0;
  border-left: 4px solid var(--primary-color);
  padding-left: 10px;
  font-size: 20px;
}
.product-grid {
  display: block;
  font-size: 0; /* Clear spaces between blocks */
}
.product-card {
  display: inline-block;
  font-size: 14px;
  width: calc(33.33% - 14px);
  margin-right: 21px;
  margin-bottom: 25px;
  background-color: var(--white);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  vertical-align: top;
  text-align: center;
  border: 1px solid #f1f5f9;
  transition: all 0.3s;
}
.product-card:nth-child(3n) {
  margin-right: 0;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06);
  border-color: var(--light-amber);
}
.p-img {
  font-size: 45px;
  margin-bottom: 15px;
  background-color: #fffdf9;
  padding: 15px 0;
  border-radius: 6px;
}
.product-card h4 {
  margin: 10px 0 5px 0;
  font-size: 16px;
  height: 42px;
  overflow: hidden;
  color: var(--secondary-color);
}
.p-category {
  font-size: 12px;
  color: #a0aec0;
  margin: 0 0 10px 0;
}
.p-price {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
  margin: 10px 0;
}
.p-stock {
  font-size: 12px;
  color: #718096;
  margin-bottom: 15px;
}
.btn-add-cart {
  width: 100%;
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}
.btn-add-cart:hover {
  background-color: #6a9680;
}

/* MODAL SYSTEM */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}
.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 30px;
  border-radius: 8px;
  max-width: 450px;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.modal-large {
  max-width: 750px;
}
.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  cursor: pointer;
  color: #a0aec0;
}
.close:hover {
  color: black;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  outline: none;
}
.form-group input:focus {
  border-color: var(--primary-color);
}
.btn-submit {
  width: 100%;
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
}

/* CART STYLING */
.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 0;
}
.cart-summary {
  text-align: right;
  margin-top: 15px;
  font-size: 18px;
  font-weight: bold;
}

/* ADMIN PANEL SPECIFIC STYLES */
.admin-body {
  background-color: #f7fafc;
}
.admin-header {
  background-color: var(--secondary-color);
  color: white;
}
.admin-wrapper {
  display: table;
  width: 100%;
  max-width: 1300px;
  margin: 20px auto;
  padding: 0 20px;
}
.admin-sidebar {
  display: table-cell;
  width: 260px;
  vertical-align: top;
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}
.sidebar-btn {
  display: block;
  width: 100%;
  padding: 12px 15px;
  background: none;
  border: none;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 6px;
  color: #4a5568;
}
.sidebar-btn:hover,
.sidebar-btn.active {
  background-color: var(--light-amber);
  color: #b45309;
}
.admin-content-area {
  display: table-cell;
  vertical-align: top;
  padding-left: 30px;
}
.stats-grid {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  flex: 1;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  border-bottom: 4px solid var(--accent-color);
}
.stat-card h3 {
  margin: 0;
  font-size: 14px;
  color: #718096;
}
.stat-number {
  font-size: 24px;
  font-weight: bold;
  margin: 10px 0 0 0;
  color: var(--secondary-color);
}

.crud-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}
.crud-table th,
.crud-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.crud-table th {
  background-color: #edf2f7;
  font-weight: 600;
}
.form-container {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}
.form-row {
  display: flex;
  gap: 15px;
}
.flex-1 {
  flex: 1;
}
.btn-action {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  margin-right: 5px;
  color: white;
}
.btn-edit {
  background-color: #3182ce;
}
.btn-delete {
  background-color: #e53e3e;
}
.btn-cancel {
  background: #edf2f7;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 10px;
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 40px 20px;
  background-color: #edf2f7;
  margin-top: 60px;
  color: #718096;
  font-size: 14px;
}
/* ==========================================================================
   MÃ RESPONSIVE - TỐI ƯU GIAO DIỆN CHO DI ĐỘNG & MÁY TÍNH BẢNG (MEDIA QUERIES)
   ========================================================================== */

/* 1. DÀNH CHO MÁY TÍNH BẢNG (TABLET) VÀ MÀN HÌNH NHỎ (Dưới 992px) */
@media screen and (max-width: 992px) {
  .header-container {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .search-box {
    width: 100%;
    margin: 10px 0;
  }

  .content-container {
    display: block; /* Chuyển từ dạng Table sang Block để xếp chồng */
  }

  .sidebar {
    display: block;
    width: 100%;
    padding-right: 0;
    margin-bottom: 20px;
  }

  .products-area {
    display: block;
  }

  .product-card {
    width: calc(50% - 15px); /* Trên Tablet hiển thị 2 cột sản phẩm */
    margin-right: 30px;
  }

  .product-card:nth-child(3n) {
    margin-right: 30px; /* Reset lại khoảng cách cũ */
  }

  .product-card:nth-child(2n) {
    margin-right: 0; /* Cách đều cho hệ 2 cột */
  }

  /* Giao diện Admin */
  .admin-wrapper {
    display: block;
  }
  .admin-sidebar {
    display: flex;
    width: 100%;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 20px;
  }
  .sidebar-btn {
    margin-bottom: 0;
    white-space: nowrap;
  }
  .admin-content-area {
    padding-left: 0;
  }
  .stats-grid {
    flex-direction: column;
  }
}

/* 2. DÀNH CHO ĐIỆN THOẠI DI ĐỘNG (MOBILE) (Dưới 576px) */
@media screen and (max-width: 576px) {
  .header-container {
    padding: 10px;
  }

  .logo h1 {
    font-size: 20px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .auth-buttons {
    font-size: 13px;
  }

  .cart-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .admin-link-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Ẩn bớt thanh điều hướng dài trên mobile hoặc cho cuộn ngang */
  .nav-links {
    display: flex;
    overflow-x: auto; /* Cho phép vuốt ngang các danh mục thuốc như An Khang */
    -webkit-overflow-scrolling: touch;
  }
  .nav-links li a {
    padding: 10px 15px;
    font-size: 13px;
  }

  /* Banner quảng cáo thu nhỏ chữ */
  .promo-banner {
    padding: 25px 15px;
  }
  .banner-content h2 {
    font-size: 20px;
  }
  .banner-content p {
    font-size: 13px;
  }

  /* Danh sách sản phẩm xếp thành 1 cột dọc duy nhất để dễ nhìn và bấm */
  .product-card {
    width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 15px;
  }

  /* Các cửa sổ Modal (Giỏ hàng, Đăng nhập) chiếm toàn màn hình trên điện thoại */
  .modal-content {
    margin: 5% 10px;
    padding: 15px;
    width: calc(100% - 20px);
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .main-content {
    padding: 0 10px;
    margin: 15px auto;
  }

  .crud-table th,
  .crud-table td {
    padding: 8px 5px;
    font-size: 12px;
  }
  .banner-inner {
    flex-direction: column-reverse; /* Đẩy hình ảnh lên trên hoặc chữ lên trước tùy chọn */
    padding: 25px 20px;
    text-align: center;
    gap: 20px;
  }

  .banner-content {
    max-width: 100%;
  }

  .banner-content h2 {
    font-size: 22px;
  }

  .banner-content p {
    font-size: 14px;
    margin-bottom: 15px;
  }

  .banner-actions {
    flex-direction: column;
    gap: 8px;
  }

  .banner-btn-primary {
    width: 100%;
    padding: 10px;
  }

  .banner-image {
    max-width: 60%; /* Thu nhỏ hình ảnh trên mobile vừa vặn nhìn xinh xắn */
  }

  .banner-image img {
    max-height: 140px;
  }
}
