:root {
    --primary-color: #2196f3;
    --primary-color-dark: #1976d2;
    --accent-color: #64b5f6;
    --danger-color: #1976d2;
    --font-family: 'Quicksand', Arial, sans-serif;
}

body {
    background: #f3f8fd;
    color: #222;
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
}

header {
  background-color: var(--card-bg);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  min-height: 48px;
}
.logo-container {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 0 0 auto;
}
.logo {
  height: 48px;
  min-width: 32px;
  max-width: 15vw;
  object-fit: contain;
  transition: transform 0.3s ease;
  margin-right: 10px;
}
.site-title {
  font-size: 2em;
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 0;
  letter-spacing: 2px;
  font-family: var(--font-family);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
  transition: font-size 0.2s;
}
.user-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  gap: 1.2em;
  z-index: 10;
}
.cart-btn {
  background: none;
  border: none;
  position: relative;
  margin-right: 0;
  margin-left: 0;
  left: 0;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.cute-btn, .cute-btn.secondary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cute-btn:hover, .cute-btn.secondary:hover {
    background: var(--primary-color-dark);
}

.cute-btn:active, .cute-btn.secondary:active {
    background: var(--accent-color);
}

.cute-btn.secondary {
    background: #e3f2fd;
    color: var(--primary-color-dark);
    border: 1.5px solid var(--primary-color-dark);
}

.hidden {
    display: none !important;
}

main {
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    text-shadow: 2px 2px 0px white;
    font-size: 2.5em;
    margin-bottom: 30px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}
@media (min-width: 601px) and (max-width: 940px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px;
  }
}
@media (min-width: 800px) and (max-width: 940px) {
  .grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 18px;
  }
}
@media (min-width: 1201px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
  }
}

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(33,150,243,0.06);
    padding: 18px 12px 16px 12px;
    margin: 0;
    position: relative;
    overflow: hidden;
    border: 3px solid transparent;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: var(--accent-color);
}

.card-img-container {
    width: 100%;
    height: 180px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    background-color: #f0f0f0;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-img {
    transform: scale(1.1);
}

.card-title {
    font-size: 1.1em;
    margin: 10px 0;
    color: #444;
    font-weight: 700;
}

.stock-status {
    font-size: 0.9em;
    padding: 5px 10px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 600;
}

.stock-high {
    background-color: #d4edda;
    color: #155724;
}

.stock-low {
    background-color: #fff3cd;
    color: #856404;
}

.stock-out {
    background-color: #f8d7da;
    color: #d32f2f;
    font-weight: bold;
    border-radius: 6px;
    padding: 2px 8px;
    display: inline-block;
}

.edit-btn {
    background-color: var(--accent-color);
    border: none;
    padding: 5px 15px;
    border-radius: 15px;
    color: #555;
    cursor: pointer;
    font-size: 0.8em;
    width: 100%;
    margin-top: 5px;
    transition: background 0.2s;
}

.edit-btn:hover {
    background-color: #ffcbb3;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content, .cart-modal-content, .user-modal-content {
  background: #fff !important;
  padding: 30px 24px 24px 24px !important;
  border-radius: 20px;
  width: 95vw;
  max-width: 400px !important;
  min-width: 0;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  animation: slideUp 0.3s;
  margin: 0 auto;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 1.5em;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: #555;
}

.modal h2 {
    color: var(--primary-color);
    margin-top: 0;
}

input[type="password"], input[type="number"] {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    border: 2px solid #eee;
    border-radius: 10px;
    font-size: 1em;
    outline: none;
    box-sizing: border-box;
    font-family: var(--font-family);
}

input:focus {
    border-color: var(--primary-color);
}

.preview-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
    margin: 10px auto;
    display: block;
}

.error-msg {
    color: #ff6b6b;
    font-size: 0.9em;
    margin-top: 10px;
}

.admin-login-btn-modal {
  margin-top: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* User controls layout */
.user-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  gap: 1.2em;
  z-index: 10;
}

.welcome-text {
    margin-right: 15px;
    font-weight: 600;
    color: var(--primary-color);
}

.site-title {
  font-size: 2em;
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 0;
  letter-spacing: 2px;
  font-family: var(--font-family);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.controls-row {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: flex-end;
    align-items: center;
}

#search-input, #sort-select {
    padding: 8px 14px;
    border-radius: 15px;
    border: 2px solid #eee;
    font-size: 1em;
    font-family: var(--font-family);
    outline: none;
    transition: border 0.2s;
}

#search-input:focus, #sort-select:focus {
    border-color: var(--primary-color);
}

.price-tag {
    color: var(--primary-color-dark);
    font-weight: bold;
}

.regular-price s {
    color: #90caf9;
    font-weight: normal;
}

.stock-low {
    color: #1976d2;
}

.stock-out {
    color: #b0bec5;
}

.saving-indicator {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: transparent;
  z-index: 2;
}
.saving-indicator .bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #2196f3 0%, #64b5f6 100%);
  animation: saving-bar 1s linear infinite alternate;
  border-radius: 2px;
}
@keyframes saving-bar {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Product View Modal */
#product-view-modal .user-modal-content {
  max-width: 350px;
  width: 95vw;
  text-align: center;
  position: relative;
}

#view-product-image.zoom-img {
  width: 100%;
  max-width: 250px;
  max-height: 250px;
  object-fit: contain;
  margin: 0 auto 1em auto;
  transition: transform 0.2s;
  cursor: zoom-in;
}

#view-product-image.zoom-img.zoomed {
  max-width: 98vw !important;
  max-height: 80vh !important;
  width: auto;
  height: auto;
  object-fit: contain;
  z-index: 10;
}

#view-product-prices {
  margin-bottom: 1em;
}

#view-product-qty-group {
  margin-bottom: 1em;
}

.out-of-stock-msg {
  color: #d32f2f;
  font-weight: bold;
  margin-bottom: 1em;
  display: none;
}

.styled-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #eee;
  font-size: 1em;
  font-family: var(--font-family);
  margin-top: 4px;
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border 0.2s;
}
.styled-input:focus {
  border-color: var(--primary-color);
}
.image-edit-container {
  position: relative;
  display: inline-block;
}
.image-upload-icon {
  position: absolute;
  top: 2px;
  right: -10px;
  background: none;
  border-radius: 50%;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s;
  line-height: 0;
}
.image-upload-icon:hover svg {
  stroke: #0d47a1;
}
.image-upload-icon svg {
  display: block;
}
#edit-image-upload {
  display: none;
}

.offer-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #1976d2;
  color: #fff;
  font-size: 1em;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 16px;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(33,150,243,0.10);
}

.cart-btn {
  background: none;
  border: none;
  position: relative;
  margin-right: 0;
  margin-left: 0.5em;
  left: 0;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #1976d2;
  color: #fff;
  font-size: 0.95em;
  font-weight: bold;
  border-radius: 50%;
  padding: 2px 7px;
  min-width: 22px;
  text-align: center;
  z-index: 2;
}
.cart-modal-content {
  max-width: 400px;
  width: 95vw;
  min-height: 200px;
  text-align: left;
  position: relative;
}

.cart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cart-thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e3e3e3;
}
.cart-name {
  flex: 1;
  font-size: 1em;
  font-weight: 600;
  color: #1976d2;
}
.cart-qty-group {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #b0bec5;
  background: #fff;
  height: 38px;
}
.cart-qty-btn {
  background: #e3f2fd;
  border: none;
  color: #1976d2;
  font-size: 1.2em;
  width: 38px;
  height: 38px;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  transition: background 0.15s;
}
.cart-qty-btn:active {
  background: #bbdefb;
}
.cart-qty {
  width: 48px;
  height: 38px;
  padding: 4px 6px;
  border: none;
  font-size: 1em;
  text-align: center;
  margin: 0;
  border-radius: 0;
  background: #fff;
}
.cart-price {
  min-width: 70px;
  text-align: right;
  font-weight: 600;
  color: #1976d2;
}
.cart-remove {
  background: none;
  border: none;
  color: #d32f2f;
  font-size: 1.5em;
  cursor: pointer;
  margin-left: 6px;
  padding: 0 4px;
  line-height: 1;
}
.cart-remove:hover {
  color: #b71c1c;
}
#cart-total {
  font-size: 1.2em;
  font-weight: bold;
  text-align: center;
  margin: 18px 0 10px 0;
}
#checkout-btn {
  display: block;
  margin: 16px auto 0 auto;
}

.toggle-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.cute-btn.small {
  font-size: 0.95em;
  padding: 7px 18px;
  border-radius: 6px;
}
.cute-btn.small.active,
.cute-btn.small[aria-pressed="true"] {
  background: var(--primary-color-dark);
  color: #fff;
}

.profile-icon {
  background: #e3f2fd;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.5em;
  color: #1976d2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 18px;
  margin-right: 0;
  margin-top: 0;
  margin-bottom: 0;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  z-index: 10001;
}
.profile-icon:hover {
  background: #bbdefb;
}
.profile-menu {
  background: #fff;
  border: 1.5px solid #1976d2;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(33,150,243,0.10);
  padding: 18px 22px 12px 22px;
  min-width: 180px;
  z-index: 9999;
  position: fixed;
  right: 24px;
  top: 70px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
}
.profile-info {
  margin-bottom: 12px;
  color: #1976d2;
  font-weight: 600;
  text-align: center;
}

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #1976d2;
}
.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="tel"],
.input-group input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #eee;
  font-size: 1em;
  font-family: var(--font-family);
  margin-bottom: 10px;
  box-sizing: border-box;
  transition: border 0.2s;
  background: #f8fbff;
}
.input-group input:focus {
  border-color: var(--primary-color);
  background: #e3f2fd;
}
.small-note {
  font-size: 0.97em;
  color: #888;
  margin-top: 8px;
  margin-bottom: 0;
}
.small-note a {
  color: #1976d2;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.center-btn-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

@media (max-width: 900px) {
  .site-title {
    font-size: 1.3em;
    max-width: 32vw;
  }
  .logo {
    height: 38px;
    max-width: 18vw;
  }
  .user-controls {
    gap: 0.7em;
  }
}
@media (max-width: 600px) {
  header {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 2vw;
    min-height: 38px;
  }
  .logo-container {
    justify-content: flex-start;
    width: auto;
    margin-bottom: 0;
    min-width: 0;
  }
  .logo {
    height: 28px;
    max-width: 16vw;
    min-width: 24px;
  }
  .site-title {
    font-size: 1em;
    max-width: 38vw;
  }
  .user-controls {
    width: auto;
    justify-content: flex-end;
    margin-top: 0;
    margin-bottom: 0;
    gap: 0.7em;
    flex-shrink: 1;
    flex: 1 1 auto;
  }
  .cart-btn {
    margin-right: 0;
    left: 0;
    min-width: 28px;
    min-height: 28px;
  }
  .profile-icon {
    margin-left: 0;
  }
  .container {
    padding: 0 2vw;
  }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 25px;
  }
  #search-input, #sort-select {
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    min-width: 0;
    max-width: 100vw;
  }
  .grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}
@media (max-width: 400px) {
  .site-title {
    font-size: 0.85em;
    max-width: 28vw;
  }
  .logo {
    height: 20px;
    max-width: 12vw;
    min-width: 18px;
  }
}
@media (max-width: 600px) {
  .modal-content, .cart-modal-content, .user-modal-content {
    max-width: 99vw !important;
    width: 99vw !important;
    padding: 10px 1vw 10px 1vw;
  }
}
