* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: rgb(241, 241, 241);
  color: #111;
}

.section {
  background-color: white;
}

.category {
  font-weight: bold;
  margin-top: 10px;
}

.subcategory {
  cursor: pointer;
  margin-left: 10px;
  color: #555;
  text-decoration: none;
  margin-top: 4px;
}

.product-card {
  width: 220px;
  margin: 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.out-of-stock {
  opacity: 0.5;
}
.product-card img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #f5f5f5;
}
.product-card .product-name {
  font-weight: 600;
  font-size: 0.8em;
  margin-bottom: 6px;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.4em;
}
.product-card .product-price,
.product-card .product-available {
  color: #888;
  font-size: 0.95em;
  margin-bottom: 8px;
}
.product-card .product-price span,
.product-card .product-available span {
  color: #222;
  font-weight: 500;
}
.product-card .product-cart {
  color: #888;
  font-size: 0.95em;
}
.product-card .product-cart span {
  color: #222;
  font-weight: 500;
}

.price-btn {
  font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #4CAF50;
  color: #222;
  font-weight: 600;
  font-size: 1em;
  border-radius: 24px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  outline: none;
}
.price-btn:hover {
  background: #e8f5e9;
  box-shadow: 0 2px 8px rgba(76,175,80,0.10);
}

/* Login Button */
#login-btn {
  font-family: inherit;
  background: none;
  border: none;
  color: #222;
  font-size: 1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s;
  margin-left: 5px;
  margin-right: 5px;
}
#login-btn:hover {
  background: #e8f5e9;
}

/* Login Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal[style*="display: flex"] {
  display: flex !important;
}
.modal > div {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px 24px 24px;
  min-width: 320px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.12);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1em;
  margin-bottom: 4px;
}
.modal button {
  font-family: inherit;
  font-size: 1em;
  border-radius: 8px;
  border: none;
  padding: 10px;
  margin-top: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.modal button:hover {
  filter: brightness(0.95);
}

.submit-btn {
  background: #4CAF50;
  color: #fff;
  border: none;
  margin-bottom: 0;
  transition: background 0.2s;
}
.submit-btn:hover {
  background: #388e3c;
}
.modal #register-btn {
  background: none;
  color: #4CAF50;
  border: none;
  text-decoration: underline;
  margin-top: 0;
  transition: color 0.2s;
}
.modal #register-btn:hover {
  color: #388e3c;
}
.close-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}
.close-modal:hover {
  color: #222;
}
@media (max-width: 400px) {
  .modal > div {
    min-width: 90vw;
    padding: 18px 6vw 18px 6vw;
  }
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 0;
  margin-bottom: 12px;
}
.cart-item-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
}
.cart-item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}
.cart-item-name {
  font-weight: 500;
  font-size: 0.8em;
  color: #222;
  margin-bottom: 2px;
}
.cart-item-qty {
  font-size: 0.95em;
  color: #4CAF50;
  font-weight: 600;
  margin-left: 5px;
  margin-right: 5px;
}
.cart-item-price {
  font-size: 1em;
  color: #222;
  font-weight: 600;
  margin-left: auto;
}
.cart-price-btn {
  background: #fff;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.2s;
}
.cart-price-btn:hover {
  transform: scale(1.15);
}

.layout-root {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: row;
}

.sidebar {
  width: 250px;
  height: 100%;
  padding: 8px;
}

.sidebar-section {
  height: 100%;
  width: 100%;
  border-radius: 16px;
  overflow-y: scroll;
  padding: 10px;
}

.main-content {
  flex: 1;
  height: 100%;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
}

.header-section {
  height: 64px;
  width: 100%;
  border-radius: 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

#store-select {
  padding: 8px 12px;
  margin-left: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  min-width: 100px;
}

#search-input {
  margin-left: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  flex: 1;
  min-width: 200px;
}

.products-section {
  flex: 1;
  width: 100%;
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  overflow-y: scroll;
}

.cart-container {
  width: 300px;
  height: 100%;
  padding: 8px;
}

.cart-section {
  height: 100%;
  width: 100%;
  border-radius: 16px;
  overflow-y: scroll;
}

#cart-section {
  padding: 16px;
}

#cart-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
}

#cart-empty {
  color: #888;
}

#cart-total-section {
  margin-top: 12px;
}

#cart-total-section .cart-total-label {
  font-weight: 600;
  font-size: 1.1em;
  margin-bottom: 10px;
}

#purchase-btn {
  width: 100%;
  background: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 1em;
  cursor: pointer;
}

/* Account Dropdown */
#account-container {
  position: relative;
}

#account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 160px;
  overflow: hidden;
  margin-top: 4px;
}

.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: #222;
  text-decoration: none;
  font-size: 0.95em;
  transition: background-color 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
  color: #4CAF50;
}

.dropdown-item[data-action="logout"]:hover {
  background-color: #ffebee;
  color: #d32f2f;
}

/* Loading States */
.submit-btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
  opacity: 0.7;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.submit-btn:disabled:hover {
  background: #ccc;
}

.list-item {
  max-width: 300px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 8px;
}
