/* ================================================================
   Material Design – Jewelry Admin Panel
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* ===== Variables ===== */
:root {
  --primary:          #1976D2;
  --primary-dark:     #0D47A1;
  --primary-subtle:   rgba(25, 118, 210, 0.08);
  --on-primary:       #FFFFFF;
  --surface:          #FFFFFF;
  --background:       #F5F5F5;
  --error:            #D32F2F;
  --success:          #388E3C;
  --text-hi:          rgba(0, 0, 0, 0.87);
  --text-med:         rgba(0, 0, 0, 0.60);
  --text-dis:         rgba(0, 0, 0, 0.38);
  --divider:          rgba(0, 0, 0, 0.12);
  --shadow-1: 0 1px 3px rgba(0,0,0,.20), 0 1px 2px rgba(0,0,0,.12);
  --shadow-2: 0 3px 6px rgba(0,0,0,.15), 0 2px 4px rgba(0,0,0,.12);
  --shadow-4: 0 6px 10px rgba(0,0,0,.14), 0 1px 18px rgba(0,0,0,.12), 0 3px 5px rgba(0,0,0,.20);
  --radius:   4px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }

/* ===== Base ===== */
body {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 14px;
  background: var(--background);
  color: var(--text-hi);
  min-height: 100vh;
}

/* ================================================================
   APP BAR
   ================================================================ */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: var(--on-primary);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-4);
}

.app-bar-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.15px;
  flex: 1;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--on-primary);
  font-size: 20px;
  border-radius: 50%;
  opacity: 0.85;
  transition: background 0.2s, opacity 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}
.back-link:hover { opacity: 1; background: rgba(255,255,255,.15); }

/* ================================================================
   NAVIGATION TABS
   ================================================================ */
.tabs {
  background: var(--primary-dark);
  display: flex;
  padding: 0 16px;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 20px;
  height: 48px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover  { color: rgba(255,255,255,.9); }
.tab.active { color: #fff; border-bottom-color: #fff; }

/* ================================================================
   LAYOUT
   ================================================================ */
.container {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 24px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

/* ================================================================
   TOOLBAR (row above table / search form)
   ================================================================ */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 24px 16px;
}

/* ================================================================
   SEARCH / FILTER FORM
   ================================================================ */
.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 0 24px 20px;
  border-bottom: 1px solid var(--divider);
}

.search-form input[type="text"],
.search-form select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text-hi);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 140px;
}
.search-form input[type="text"]:focus,
.search-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(25,118,210,.15);
}

/* ================================================================
   TABLE
   ================================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead { border-bottom: 2px solid var(--divider); }

th {
  padding: 14px 16px;
  text-align: left;
  color: var(--text-med);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: transparent;
}

td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
  color: var(--text-hi);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0,0,0,.025); }

/* ================================================================
   STATUS CHIPS
   ================================================================ */
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.chip-active   { background: #E8F5E9; color: #2E7D32; }
.chip-inactive { background: #FFEBEE; color: #C62828; }

/* ================================================================
   BUTTONS
   ================================================================ */

/* Contained primary – submit buttons */
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 24px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background 0.15s, box-shadow 0.2s;
}
button[type="submit"]:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-2);
}
button[type="submit"].btn-danger            { background: var(--error); }
button[type="submit"].btn-danger:hover      { background: #B71C1C; box-shadow: var(--shadow-2); }

/* Generic button (type="button") */
button[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
button[type="button"]:hover { background: var(--primary-subtle); }

/* Create / Add (green link-button) */
.create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background 0.15s, box-shadow 0.2s;
}
.create-btn:hover { background: #2E7D32; box-shadow: var(--shadow-2); }

/* Reset / outlined */
.btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  background: transparent;
  color: var(--text-med);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-reset:hover { background: rgba(0,0,0,.05); }

/* Table row actions */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.2s;
}
.edit-btn         { background: var(--primary); }
.edit-btn:hover   { background: var(--primary-dark); box-shadow: var(--shadow-1); }
.delete-btn       { background: var(--error); }
.delete-btn:hover { background: #B71C1C; box-shadow: var(--shadow-1); }

/* Remove subproduct row button */
.btn-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-remove:hover { background: #B71C1C; }

/* Add subproduct row button */
#add-subproduct-btn {
  border: 1px dashed var(--primary) !important;
  color: var(--primary) !important;
  background: transparent !important;
  box-shadow: none !important;
  margin-bottom: 24px;
}
#add-subproduct-btn:hover { background: var(--primary-subtle) !important; }

/* ================================================================
   FORM CARD
   ================================================================ */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 32px;
  max-width: 640px;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-med);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  font-family: 'Roboto', sans-serif;
  font-size: 15px;
  color: var(--text-hi);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(25,118,210,.15);
}
.field textarea { resize: vertical; min-height: 96px; }
.field input[type="file"] { padding: 8px 14px; font-size: 13px; cursor: pointer; }

/* ================================================================
   SECTION TITLE (inside form-card)
   ================================================================ */
.section-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-hi);
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  letter-spacing: 0.1px;
}

/* ================================================================
   SUBPRODUCT ROWS (create_product)
   ================================================================ */
#subproduct-rows { margin-bottom: 4px; }

.subproduct-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #FAFAFA;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.subproduct-row .field {
  flex: 1;
  min-width: 130px;
  margin-bottom: 0;
}

/* ================================================================
   SUBPRODUCT TABLE (edit_product)
   ================================================================ */
.subproduct-table { width: 100%; border-collapse: collapse; margin-top: 16px; }

.subproduct-table th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-med);
  border-bottom: 2px solid var(--divider);
  text-align: left;
  background: transparent;
}
.subproduct-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}
.subproduct-table tbody tr:last-child td { border-bottom: none; }
.subproduct-table tbody tr:hover { background: rgba(0,0,0,.025); }

.subproduct-thumb {
  max-height: 200px;
  border-radius: var(--radius);
  display: block;
  object-fit: contain;
  align-self: flex-start;
  cursor: zoom-in;
}

/* ================================================================
   LIGHTBOX
   ================================================================ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-4);
}

/* ================================================================
   PHOTO PREVIEW
   ================================================================ */
.photo-preview { margin-bottom: 8px; }
.photo-preview p {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-med);
  margin-bottom: 8px;
}
.photo-preview img {
  max-width: 160px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  display: block;
}

/* ================================================================
   ERROR / ALERT
   ================================================================ */
.error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFEBEE;
  color: var(--error);
  border-left: 4px solid var(--error);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
}

/* ================================================================
   MISC
   ================================================================ */
hr { border: none; border-top: 1px solid var(--divider); margin: 28px 0; }

.empty-state {
  text-align: center;
  color: var(--text-dis);
  padding: 40px 0;
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
