/* Benjamin_liquore_Store styling
   - Keeps existing palette
   - Modernizes layout across all store pages
*/

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #111;
  --muted: #444;
  --border: #e6e6e6;
  --primary: #007bff;
  --primary2: #3897f0;
  --danger: #ff0000;
  --header-offset: 92px;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg);
  margin: 0;
  font-family: Arial, sans-serif;
  padding: 0;
  min-height: 100vh;
  color: var(--text);
}

html { scroll-behavior: smooth; }

/* -------------------------------------------------
   Auth pages
------------------------------------------------- */
body.auth {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 12px;
}

body.auth form,
.auth-form {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background-color: var(--surface);
  padding: 40px;
  width: min(380px, 92vw);
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  border-radius: 10px;
  gap: 10px;
}

.auth-form h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.auth-form img {
  margin: 0 auto;
  display: block;
}

.auth-form label {
  font-weight: 800;
  color: var(--text);
  margin-top: 6px;
}

.auth-links {
  text-align: center;
  color: var(--muted);
}

.auth-alert {
  border: 1px solid rgba(255, 0, 0, 0.25);
  background: rgba(255, 0, 0, 0.06);
  color: #7a0000;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
}

.auth-success {
  border: 1px solid rgba(0, 123, 255, 0.25);
  background: rgba(0, 123, 255, 0.06);
  color: #003d80;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
.search-input {
  padding: 10px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  color: #000;
  font-family: inherit;
}

input[type="submit"],
.search-button {
  padding: 10px;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  background-color: var(--primary2);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.search-button {
  background-color: var(--primary);
}

.error { color: var(--danger); margin: 0; }
.success { color: var(--primary); margin: 0; }
.signup { text-align: center; margin-top: 10px; }

/* -------------------------------------------------
   Header / Nav
------------------------------------------------- */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav-wrapper {
  width: min(1200px, 96%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

#header img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.store-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.store-brand-text {
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.store-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

.store-nav-link {
  text-decoration: none;
  color: #333;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: transform 140ms ease, background-color 140ms ease, color 140ms ease;
}

.store-nav-link:hover {
  background-color: rgba(0, 123, 255, 0.08);
  color: var(--primary);
  transform: translateY(-1px);
}

.store-nav-link:active {
  transform: translateY(0);
}

.store-nav-logout:hover {
  background-color: rgba(255, 0, 0, 0.08);
  color: #b00000;
}

.store-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: min(420px, 100%);
  justify-content: flex-end;
  flex: 0 1 420px;
}

.store-search .search-input {
  width: 100%;
  min-width: 180px;
}

.store-search .search-input {
  min-width: 0;
}

.store-user {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.store-user-greeting {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.store-alert {
  border: 1px solid rgba(255, 0, 0, 0.25);
  background: rgba(255, 0, 0, 0.06);
  color: #7a0000;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.navbar {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 14px;
}

.hero h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

.nav {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.nav-item a {
  text-decoration: none;
  color: #333;
  font-size: 16px;
}

.nav-item a:hover {
  color: var(--primary);
}

#log-out:hover {
  text-decoration: none;
}

.nav h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.search-input {
  height: 36px;
  padding: 6px 10px;
}

.search-button {
  height: 36px;
  padding: 0 12px;
}

/* -------------------------------------------------
   Shared wrappers
------------------------------------------------- */
.store-main,
.page-main,
.admin-wrap {
  width: min(1200px, 96%);
  margin: 0 auto 60px;
  padding-top: var(--header-offset);
}

.store-head,
.page-head {
  margin: 16px 0 18px;
}

.store-title,
.page-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.store-subtitle,
.page-subtitle {
  margin: 0;
  color: var(--muted);
}

.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  padding: 16px;
}

.empty-state {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* -------------------------------------------------
   Products grid + cards
------------------------------------------------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.product-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
  will-change: transform;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.product-media {
  background: var(--surface);
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.product-card img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  border-radius: 8px;
}

.product-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text);
}

.product-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.35em * 3);
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: #333;
  font-size: 13px;
}

.product-price {
  margin-left: auto;
  font-weight: 800;
  color: var(--primary);
}

/* -------------------------------------------------
   About page
------------------------------------------------- */
.content {
  display: flex;
  gap: 16px;
}

.owner-profile {
  flex: 1;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.owner-profile img {
  width: 100%;
  max-width: 260px;
  height: auto;
}

.about-section { flex: 2; }

/* -------------------------------------------------
   Contact form
------------------------------------------------- */
.contact-form {
  display: grid;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.contact-form label {
  font-weight: 800;
  color: var(--text);
}

/* -------------------------------------------------
   Admin dashboard table (scoped)
------------------------------------------------- */
body.admin { background-color: var(--bg); }

.admin-table-wrap {
  overflow: auto;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
}

table.admin-table th,
table.admin-table td {
  border-bottom: 1px solid #eee;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

table.admin-table th {
  position: sticky;
  top: 0;
  background-color: #4CAF50;
  color: #fff;
}

.stock-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.12);
}

.stock-status--ok {
  background: rgba(76, 175, 80, 0.12);
  color: #1b5e20;
  border-color: rgba(76, 175, 80, 0.35);
}

.stock-status--low {
  background: rgba(255, 0, 0, 0.08);
  color: #7a0000;
  border-color: rgba(255, 0, 0, 0.25);
}

table.admin-table tr:nth-child(even) td {
  background: rgba(0,0,0,0.02);
}

table.admin-table img {
  width: 50px;
  height: 90px;
  object-fit: contain;
}

/* -------------------------------------------------
   Edit product (admin)
------------------------------------------------- */
.edit-form {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

.edit-media {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
  background: var(--surface);
}

#product_image {
  width: 100%;
  height: 240px;
  object-fit: contain;
  border-radius: 8px;
}

.edit-fields {
  display: grid;
  gap: 10px;
}

.edit-fields label {
  font-weight: 800;
  color: var(--text);
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

/* -------------------------------------------------
   Popups / loader
------------------------------------------------- */
.logout-popup {
  display: none;
  position: fixed;
  z-index: 200;
  left: 50%;
  top: 50%;
  width: min(520px, 92vw);
  height: auto;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  transform: translate(-50%, -50%);
  border-radius: 10px;
}

.logout-content {
  background-color: #fefefe;
  margin: 0;
  padding: 20px;
  border: 1px solid #888;
  width: 100%;
  text-align: center;
  border-radius: 10px;
}

.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid #3498db;
  width: 90px;
  height: 90px;
  animation: spin 2s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* -------------------------------------------------
   Interaction polish
------------------------------------------------- */
.search-button,
input[type="submit"],
input[type="text"],
input[type="password"],
input[type="email"],
.search-input,
textarea {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.search-button:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.search-button:active,
input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
.search-input:focus,
textarea:focus,
.search-button:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

@media (max-width: 900px) {
  .nav-wrapper {
    flex-wrap: wrap;
    justify-content: center;
  }

  .store-user {
    display: none;
  }

  .store-search {
    flex: 1;
    min-width: 240px;
  }

  .store-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .content { flex-direction: column; }
  .edit-form { grid-template-columns: 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  .nav-wrapper {
    flex-wrap: wrap;
    align-items: center;
  }

  .store-brand {
    flex: 1 1 240px;
  }

  .store-brand-text {
    max-width: 260px;
  }

  .store-search {
    flex: 1 1 360px;
    width: min(520px, 100%);
  }

  .store-user {
    display: none;
  }

  .store-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .store-nav::-webkit-scrollbar {
    height: 0;
  }

  .store-nav-link {
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .store-brand {
    min-width: 0;
  }

  .store-brand-text {
    font-size: 15px;
  }

  .store-search {
    width: 100%;
    min-width: 0;
  }

  .store-nav {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .store-nav::-webkit-scrollbar {
    height: 0;
  }

  .store-nav-link {
    white-space: nowrap;
  }

  .product-card:hover { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
