/* Global Reset & Typography */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f6f6f7;
  color: #202223;
  margin: 0;
  padding: 0;
}

/* Storefront Header */
.storefront-header {
  background: #ffffff;
  border-bottom: 1px solid #e1e3e5;
  padding: 16px 24px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 18px;
  color: #1a1a1a;
}

.nav-links a {
  text-decoration: none;
  color: #5c5f62;
  margin-left: 20px;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #008060;
}

.admin-link {
  background: #f1f8f5;
  color: #008060 !important;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
}

/* Product Card Layout */
.page-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.product-customizer-card {
  display: flex;
  gap: 40px;
  background: #ffffff;
  padding: 36px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.product-preview-column {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mockup-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background-color: #f1f2f3;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.mockup-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}

.preview-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(32, 34, 35, 0.85);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.preview-badge.ai-badge {
  background: #008060;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  z-index: 10;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #008060;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-note {
  font-size: 13px;
  color: #6d7175;
  margin-top: 14px;
  text-align: center;
  line-height: 1.5;
}

/* Controls Column */
.product-controls-column {
  flex: 1;
}

.product-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #008060;
  letter-spacing: 0.5px;
}

.product-title {
  font-size: 26px;
  margin: 8px 0 12px 0;
  line-height: 1.3;
}

.product-price {
  font-size: 22px;
  font-weight: 700;
  color: #202223;
  margin-bottom: 20px;
}

.original-price {
  font-size: 16px;
  color: #8c9196;
  text-decoration: line-through;
  font-weight: normal;
  margin-left: 8px;
}

.product-divider {
  height: 1px;
  background: #e1e3e5;
  margin-bottom: 24px;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid #c9cccf;
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: #008060;
  box-shadow: 0 0 0 2px rgba(0, 128, 96, 0.2);
}

.field-hint {
  display: block;
  font-size: 12px;
  color: #6d7175;
  margin-top: 5px;
}

.actions-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 28px 0;
}

.btn {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background-color: #008060;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #004c3f;
}

.btn-secondary {
  background-color: #2c6ecb;
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: #1f5199;
}

.product-perks {
  border-top: 1px solid #e1e3e5;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perk-item {
  font-size: 13px;
  color: #444746;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================= */
/* MERCHANT ADMIN PORTAL STYLING            */
/* ========================================= */
.admin-body {
  background: #f4f6f8;
}

.admin-topbar {
  background: #1a1a1a;
  color: #ffffff;
  padding: 14px 24px;
}

.topbar-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h2 {
  margin: 0;
  font-size: 18px;
}

.brand small {
  color: #8c9196;
}

.btn-storefront {
  background: #2c6ecb;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.admin-layout {
  display: flex;
  max-width: 1400px;
  margin: 24px auto;
  gap: 24px;
  padding: 0 20px;
}

.admin-sidebar {
  width: 240px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 16px 0;
  height: fit-content;
}

.admin-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-menu li {
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: #444746;
  transition: background 0.2s;
}

.admin-menu li:hover {
  background: #f1f2f3;
}

.admin-menu li.active {
  background: #eef7f2;
  color: #008060;
  font-weight: 600;
  border-left: 4px solid #008060;
}

.admin-content {
  flex: 1;
  background: #ffffff;
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e3e5;
}

.pane-header h3 {
  margin: 0 0 6px 0;
}

.pane-header p {
  margin: 0;
  color: #6d7175;
  font-size: 14px;
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.template-card {
  border: 1px solid #e1e3e5;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
  transition: all 0.2s;
  position: relative;
}

.template-card-active {
  border: 2px solid #008060;
  box-shadow: 0 4px 12px rgba(0, 128, 96, 0.15);
}

.template-image-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.template-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.active-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #008060;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.template-info {
  padding: 14px;
}

.template-info h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
}

.template-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-activate {
  background: #2c6ecb;
  color: #ffffff;
}

.btn-delete {
  background: #ff4d4f;
  color: #ffffff;
}

.status-active-text {
  font-size: 12px;
  color: #008060;
  font-weight: 700;
}

/* Admin Table */
.orders-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #e1e3e5;
  font-size: 14px;
}

.admin-table th {
  background: #f9fafb;
  color: #5c5f62;
  font-weight: 600;
}

.table-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-letter {
  background: #e3effd;
  color: #1f5199;
  font-size: 14px;
}

.badge-status {
  background: #e3f1df;
  color: #108043;
}

.btn-table-action {
  color: #2c6ecb;
  text-decoration: none;
  font-weight: 600;
}

/* Settings Form */
.settings-card {
  max-width: 600px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.api-status-box {
  background: #f9fafb;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e1e3e5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-indicator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.green { background-color: #108043; }
.status-dot.yellow { background-color: #eed202; }

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h4 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
