/* Reset some defaults */
body, html {
  margin: 0;
  padding: 0;
  font-family: 'Arial', sans-serif;
  background-color: #f2f2f2;
  height: 100%;
  overflow-y: auto;
}

/* Center everything */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Page title */
h1 {
  margin-bottom: 20px;
  color: #333;
}

/* Form container */
.form-container {
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

/* Inputs and Textareas */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
  font-size: 14px;
}

/* Select specifically */
select {
  background: white;
  appearance: none; /* Remove default arrow for consistency */
}

/* Textarea specific adjustments */
textarea {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
button {
  width: 100%;
  padding: 12px;
  background-color: #4CAF50;
  border: none;
  color: white;
  font-size: 16px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-bottom: 15px;
}

/* Save Product button hover */
button:hover {
  background-color: #45a049;
}

/* Add New Category button - different color */
#add-category {
  background-color: #4285F4; /* Blue button */
}

#add-category:hover {
  background-color: #3367d6;
}

/* Checkbox label */
label {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #555;
  margin-bottom: 15px;
}

/* Optional: logout button styling */
.logout-button {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: #f44336;
}

.logout-button:hover {
  background-color: #e53935;
}

.admin-sections {
  width: 100%;
  display: flex;
  justify-content: center;
}
.image-note {
  font-size: 12px;
  color: #777;
  margin-top: 5px;
  margin-bottom: 10px;
  text-align: left;
}

.admin-thumbnail {
  width: 125px;
  height: 125px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 10px;
}

.admin-product-card h3,
.admin-product-card p {
  margin: 4px 0;
  padding: 0;
  line-height: 1.2;
  font-size: 14px;
}

.admin-product-card .price {
  font-weight: bold;
  font-size: 13px;
  margin: 2px 0;
}

.admin-product-card .stock {
  font-size: 12px;
  margin: 2px 0;
  color: green;
}

.admin-product-card .stock.out {
  color: red;
}

.toggle-stock-button.in-stock {
  background-color: #4CAF50; /* Green */
}

.toggle-stock-button.out-of-stock {
  background-color: #FFA500; /* Orange */
}

.toggle-stock-button:hover {
  opacity: 0.9;
}




/*   ---- Shop Layout ----  */




/* Overall Layout */
.shop-layout {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* Sidebar on full left */
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #ccc;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #333;
}


/* Category Buttons */
.tab-button {
  width: 100%;
  padding: 10px 15px;
  background-color: #000000;
  border: none;
  border-radius: 5px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.3s, color 0.3s;
  font-size: 14px;
}

.tab-button:hover {
  background-color: #ddd;
}

.tab-button.active {
  background-color: #4CAF50;
  color: white;
  font-weight: bold;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 40px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center the h1 and products */
}

/* Title */
.main-content h1 {
  margin-bottom: 30px;
}

/* Products Layout */
.products-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Center products under the H1 */
  gap: 20px;
}

/* Product Card */
.product-card {
  background: #fff;
  width: 225px;
  min-height: 300px; 
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.product-card img {
  width: 100%;
  height: 275px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 6px; /* just a little under the image */
}

.product-card h3,
.product-card p {
  margin: 1px 0;
  padding: 0;
  line-height: 1.1;
}

.product-card .price {
  font-weight: bold;
  font-size: 13px;
  margin: 1px 0;
}

.product-card .stock {
  font-size: 12px;
  margin: 1px 0;
  color: green;
}

.product-card .stock.out {
  color: red;
}

.product-card button {
  padding: 6px 12px;
  background-color: #4CAF50;
  border: none;
  color: white;
  font-size: 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: auto;
  margin-top: 8px;
}
.product-card button:hover {
  background-color: #45a049;
}





/* ----Dashboard---- */


/* Admin Management Product Cards */
#product-management {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding: 20px;
  box-sizing: border-box;
}

/* ADMIN version of product cards */
.admin-product-card {
  background: #fff;
  width: 220px;
  min-height: 280px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  transition: box-shadow 0.3s ease;
}

.admin-product-card:hover {
  box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}

/* Buttons inside ADMIN cards */
.admin-product-card button {
  width: 90%;
  margin-top: 8px;
  padding: 8px;
  font-size: 14px;
  background-color: #4CAF50;
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.admin-product-card button:hover {
  background-color: #45a049;
}

/* Delete button special color */
.admin-product-card button.delete-button {
  background-color: #f44336;
}

.admin-product-card button.delete-button:hover {
  background-color: #d32f2f;
}

/* Manage Images button */
.admin-product-card button.manage-images-button {
  background-color: #4285F4;
}

.admin-product-card button.manage-images-button:hover {
  background-color: #3367d6;
}

.admin-buttons {
  margin: 20px 0;
  display: flex;
  gap: 10px;
}

.admin-buttons button {
  padding: 10px 20px;
  background-color: #4CAF50;
  border: none;
  color: white;
  font-size: 16px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.admin-buttons button.active {
  background-color: #2e7d32;
}

.admin-buttons button:hover {
  background-color: #45a049;
}


#add-product-section {
  width: 100%;
  max-width: 450px;
  display: flex;
  justify-content: center;
}

/* Storage Usage Bar */
.storage-usage {
  width: 100%;
  max-width: 450px;
  margin-bottom: 20px;
  text-align: center;
}

.storage-usage .storage-bar {
  background: #ddd;
  border-radius: 10px;
  overflow: hidden;
  height: 20px;
  margin-top: 10px;
}

#storage-bar-fill {
  background: #4CAF50;
  height: 100%;
  width: 0%;
  transition: width 0.5s ease;
}

#edit-product-modal {
  display: none; /* Hides modal by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5); /* semi-transparent background */
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#edit-product-modal .modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
}


.sale-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.sale-toggle-row label {
  font-size: 16px;
}

.sale-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

#sale-options {
  margin-top: 15px;
}

.or-divider {
  text-align: center;
  font-weight: bold;
  margin: 10px 0;
  color: #666;
}

.save-btn, .cancel-btn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  margin-top: 10px;
  border-radius: 5px;
}

.save-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
}

.save-btn:hover {
  background-color: #45a049;
}

.cancel-btn {
  background-color: #f44336;
  color: white;
  border: none;
}

.cancel-btn:hover {
  background-color: #d32f2f;
}





/* ---- PRODUCT PAGE STYLE ---- */
.product-page {
  display: flex;
  flex-wrap: wrap;
  gap: 60px;
  max-width: 1100px;
  margin: 60px auto;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
}

.product-image-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.main-product-image {
  width: 100%;
  max-width: 400px;
  max-height: 500px;
  object-fit: contain;
  border-radius: 8px;
  background: #f4f4f4;
  padding: 10px;
  margin-bottom: 20px;
}

.thumbnail-gallery {
  display: flex;
  margin-top: 15px;
  gap: 10px;
}

.thumbnail-gallery img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border: 2px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  transition: 0.3s;
}

.thumbnail-gallery img:hover {
  border-color: #4CAF50;
}

.product-details-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.product-title {
  font-size: 32px;
  margin-bottom: 10px;
  color: #333;
}

.price-text {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.price-text s {
  color: #888;
  margin-right: 10px;
  font-size: 18px;
}

.price-text .sale {
  color: #e53935;
  font-weight: bold;
}

#add-to-cart-btn {
  padding: 14px;
  font-size: 18px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  max-width: 200px;
}

#add-to-cart-btn:hover {
  background-color: #45a049;
}

#add-to-cart-btn.disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.stock-text {
  font-size: 16px;
  font-weight: bold;
  color: green;
  margin-top: 5px;
  text-align: left;
}

.stock-text.out {
  color: red;
}

.description-section {
  margin-top: 30px;
}

.description-section h2 {
  font-size: 20px;
  margin-bottom: 10px;
  color: #333;
}

.description-text {
  font-size: 16px;
  color: #555;
  line-height: 1.6;
  text-align: left;
}

#manage-images-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#manage-images-modal .modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

.image-item {
  position: relative;
  width: 120px;
  height: 120px;
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.image-item button {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #f44336;
  color: white;
  border: none;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.image-item button:hover {
  background-color: #d32f2f;
}

/* Upload Section */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.upload-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #2196F3;
  color: white;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

.upload-btn:hover {
  background-color: #1976D2;
}

.green-btn {
  width: 100%;
  padding: 12px;
  background-color: #4CAF50;
  color: white;
  border: none;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
}

.green-btn:hover {
  background-color: #45a049;
}

.red-btn {
  width: 100%;
  padding: 12px;
  background-color: #f44336;
  color: white;
  border: none;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
}

.red-btn:hover {
  background-color: #d32f2f;
}

.thumbnail-gallery {
  display: flex;
  flex-wrap: wrap;
  max-width: 360px; /* 3 thumbnails × 120px (including gap) */
  gap: 10px;
  margin: 15px 0;
}

.thumbnail-gallery img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.3s;
}

.thumbnail-gallery img:hover {
  border-color: #4CAF50;
}


.back-button-container {
  width: 50%;
  max-width: 250px;
  margin: 40px auto 0;
  padding-left: 20px;
}

.back-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  font-size: 16px;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.back-button:hover {
  background-color: #45a049;
}

/* Dashboard Wrapper Support */
.dashboard-wrapper {
  min-height: 100vh;
  width: 100%;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-container button[type="button"] {
  background-color: #555;
  color: white;
  font-size: 14px;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
}

.form-container button[type="button"]:hover {
  background-color: #333;
}

.batch-row input,
.batch-row textarea,
.batch-row select {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  box-sizing: border-box;
}



/* Ensure body scrolls when needed */
html, body {
height: 100%;
overflow-x: hidden;
}

.modal {
  display: none;
  position: fixed;
  z-index: 3000; /* ensure it's above everything */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
}


.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin-top: 0;
  text-align: center;
  font-size: 20px;
  text-align: center;
}

.modal-content button {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  margin-bottom: 10px;
}

.gray-btn {
  background-color: #555;
  color: white;
  font-size: 14px;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
  margin-bottom: 12px;
}

.gray-btn:hover {
  background-color: #333;
}

#dropdown-manager-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 10001; /* 👈 higher than the edit modal's 9999 */
}

#dropdown-manager-modal .modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}



/* Mobile Adjustments */
@media (max-width: 768px) {
body {
  overflow-y: auto;
  align-items: flex-start;
  justify-content: flex-start;
}

.admin-sections {
  display: block;
  width: 100%;
  padding: 10px;
}

#product-management-section,
#add-product-section {
  padding: 0 10px;
}

.admin-buttons {
  flex-direction: column;
  align-items: center;
}

.admin-buttons button {
  width: 90%;
  max-width: 300px;
  margin-bottom: 10px;
}

.back-button-container {
  width: 100%;
  text-align: center;
  padding-left: 0;
}

.product-page {
  flex-direction: column;
  gap: 30px;
  padding: 15px;
}

.product-image-section,
.product-details-section {
  width: 100%;
}

.form-container {
  padding: 20px;
}

.product-card {
  width: 100%;
  max-width: 300px;
}

.admin-product-card {
  width: 100%;
  max-width: 300px;
}

.form-container {
  padding: 20px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  font-size: 16px;
  padding: 10px;
}

.batch-row {
  background: #fff;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

.batch-row input,
.batch-row textarea,
.batch-row select {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

#batch-toggle,
#save-batch-wrapper button,
.form-container button[type="button"] {
  width: 100%;
  max-width: 100%;
  font-size: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.modal-content {
  width: 90%;
  max-width: 90%;
  padding: 20px;
  font-size: 16px;
}

/* Adjust button spacing inside modals */
.modal-content button {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  margin-bottom: 12px;
}

/* Adjust select and input fields inside modal */
.modal-content select,
.modal-content input[type="text"] {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  margin-bottom: 12px;
}

}

.admin-menu-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.menu-icon {
  display: none;
  background: #c71585;
  color: white;
  font-size: 1.2em;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.admin-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .menu-icon {
    display: block;
  }

  .admin-buttons {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    background: #ffe4e1;
    padding: 10px;
    border-radius: 10px;
  }

  .admin-buttons.active {
    display: flex;
  }

  .gray-btn {
    width: 100%;
    font-size: 16px;
    padding: 12px;
    margin-bottom: 12px;
  }
}
