/* ==========================================================================
   hannybowl Custom Portals & Checkout Stylesheet (dashboard.css)
   ========================================================================== */

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

:root {
  /* Visual tokens imported from hannybowl's design language */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --bg-cream: #fdf7e7;
  --bg-white: #ffffff;
  --primary-green: #9dd162;
  --secondary-green: #17601c;
  --forest-green: #2c4b08;
  --accent-yellow: #FCBE0F;
  --light-overlay: rgba(44, 75, 8, 0.05);
  --border-green: 2px solid #2c4b08;
  --border-light: 1px solid rgba(44, 75, 8, 0.15);
  
  --shadow-light: 0 10px 30px rgba(23, 96, 28, 0.06);
  --shadow-hover: 0 20px 45px rgba(23, 96, 28, 0.12);
  --transition-smooth: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-fast: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==========================================================================
   Checkout Modal Elements
   ========================================================================== */
.checkout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 75, 8, 0.4);
  backdrop-filter: blur(8px);
  z-index: 1100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.checkout-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.checkout-modal-card {
  background-color: var(--bg-cream);
  border: var(--border-green);
  border-radius: 28px;
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  padding: 30px;
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.checkout-modal-overlay.open .checkout-modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed rgba(44, 75, 8, 0.15);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--forest-green);
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--forest-green);
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-modal-btn:hover {
  transform: scale(1.1);
}

.checkout-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group.full-width {
  grid-column: span 2;
}

.checkout-form-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--forest-green);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkout-form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(44, 75, 8, 0.25);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background-color: var(--bg-white);
  color: var(--forest-green);
  transition: var(--transition-fast);
}

.checkout-form-input:focus {
  outline: none;
  border-color: var(--secondary-green);
  box-shadow: 0 0 0 3px rgba(157, 209, 98, 0.3);
}

select.checkout-form-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%232c4b08' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

.checkout-submit-btn {
  width: 100%;
  background-color: var(--secondary-green);
  color: var(--bg-cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 15px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.checkout-submit-btn:hover {
  background-color: var(--forest-green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.whatsapp-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ==========================================================================
   Customer Portal Layout & Styling
   ========================================================================== */
.portal-body {
  background-color: var(--bg-cream);
  font-family: var(--font-body);
  color: var(--forest-green);
  min-height: 100vh;
}

.portal-nav {
  background-color: var(--bg-white);
  border-bottom: var(--border-green);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.portal-logo img {
  height: 44px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--light-overlay);
  padding: 6px 14px;
  border-radius: 50px;
  border: var(--border-light);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
}

.logout-btn {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.logout-btn:hover {
  text-decoration: underline;
}

.portal-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

@media (max-width: 850px) {
  .portal-content-grid {
    grid-template-columns: 1fr;
  }
}

.portal-card {
  background-color: var(--bg-white);
  border: 1px solid rgba(44, 75, 8, 0.15);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-light);
}

.portal-card-title {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 1.35rem;
  color: var(--forest-green);
  margin-bottom: 20px;
  border-bottom: 2px dashed rgba(44, 75, 8, 0.08);
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Order Tracker Elements */
.tracker-stepper {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 25px 0 15px 0;
}

.tracker-stepper::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: rgba(44, 75, 8, 0.1);
  z-index: 1;
}

.tracker-progress-bar {
  position: absolute;
  top: 15px;
  left: 0;
  height: 4px;
  background-color: var(--secondary-green);
  z-index: 2;
  transition: width 0.5s ease;
}

.step-node {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 25%;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-cream);
  border: 2px solid rgba(44, 75, 8, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--forest-green);
  transition: var(--transition-smooth);
}

.step-node.active .step-circle {
  border-color: var(--secondary-green);
  background-color: var(--secondary-green);
  color: var(--bg-white);
}

.step-node.completed .step-circle {
  border-color: var(--secondary-green);
  background-color: var(--primary-green);
  color: var(--forest-green);
}

.step-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  margin-top: 8px;
  text-align: center;
  color: var(--text-dark);
}

.step-node.active .step-label {
  color: var(--secondary-green);
}

.eta-box {
  background-color: var(--bg-cream);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

/* Subscription Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-header-cell {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--forest-green);
  opacity: 0.7;
}

.calendar-cell {
  background-color: var(--bg-cream);
  border-radius: 10px;
  aspect-ratio: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  font-size: 0.85rem;
  position: relative;
}

.calendar-cell:hover {
  transform: translateY(-2px);
  border-color: var(--forest-green);
}

.calendar-cell.delivered {
  background-color: var(--primary-green);
  color: var(--forest-green);
  cursor: not-allowed;
}

.calendar-cell.skipped {
  background-color: rgba(192, 57, 43, 0.1);
  color: #c0392b;
  border: 1px dashed #c0392b;
}

.calendar-cell.empty {
  opacity: 0.3;
  cursor: default;
}

.calendar-cell.empty:hover {
  transform: none;
  border-color: transparent;
}

.calendar-cell-num {
  font-weight: 700;
}

.calendar-cell-status {
  font-size: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

.calendar-legend {
  display: flex;
  gap: 16px;
  margin-top: 15px;
  font-size: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

/* Login Cover Screen */
.portal-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-cream);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(circle, rgba(157, 209, 98, 0.12) 0%, transparent 80%);
}

.portal-login-card {
  background-color: var(--bg-white);
  border: var(--border-green);
  border-radius: 28px;
  padding: 40px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-hover);
  text-align: center;
}

.portal-login-card img.login-logo {
  height: 60px;
  margin-bottom: 20px;
}

.portal-login-card h2 {
  font-family: var(--font-display);
  font-weight: 850;
  font-size: 1.6rem;
  color: var(--forest-green);
  margin-bottom: 8px;
}

.portal-login-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ==========================================================================
   Admin Dashboard Styling
   ========================================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-cream);
}

.admin-sidebar {
  width: 250px;
  background-color: var(--forest-green);
  color: var(--bg-cream);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--forest-green);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--accent-yellow);
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--bg-cream);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  transition: var(--transition-fast);
}

.admin-nav-item:hover, .admin-nav-item.active {
  background-color: var(--secondary-green);
  color: var(--bg-white);
}

.admin-main-content {
  flex-grow: 1;
  margin-left: 250px;
  padding: 40px;
}

/* Dashboard KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 1000px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background-color: var(--bg-white);
  border: 1px solid rgba(44, 75, 8, 0.12);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-light);
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--forest-green);
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--secondary-green);
  margin-top: 4px;
}

.kpi-sub.warning {
  color: #c0392b;
}

/* Slicing Forecast Matrix */
.forecast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

@media (max-width: 900px) {
  .forecast-grid {
    grid-template-columns: 1fr;
  }
}

.stock-meter {
  margin-bottom: 15px;
}

.stock-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.stock-meter-bar-outer {
  width: 100%;
  height: 12px;
  background-color: var(--bg-cream);
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid rgba(44, 75, 8, 0.08);
}

.stock-meter-bar-inner {
  height: 100%;
  background-color: var(--secondary-green);
  border-radius: 50px;
  transition: width 0.5s ease;
}

.stock-meter-bar-inner.low {
  background-color: #c0392b;
}

/* CRM & Orders Tables */
.admin-table-card {
  background-color: var(--bg-white);
  border-radius: 24px;
  border: 1px solid rgba(44, 75, 8, 0.12);
  padding: 24px;
  box-shadow: var(--shadow-light);
  margin-bottom: 30px;
}

.admin-card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid rgba(44, 75, 8, 0.15);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 220px;
}

.search-input:focus {
  outline: none;
  border-color: var(--secondary-green);
}

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

table.admin-table th, table.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(44, 75, 8, 0.05);
  font-size: 0.85rem;
}

table.admin-table th {
  font-family: var(--font-display);
  font-weight: 750;
  color: var(--forest-green);
  background-color: var(--bg-cream);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table.admin-table tr:hover td {
  background-color: var(--light-overlay);
}

.status-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.status-badge.delivered { background-color: var(--primary-green); color: var(--forest-green); }
.status-badge.scheduled { background-color: var(--accent-yellow); color: var(--forest-green); }
.status-badge.slicing { background-color: #e67e22; color: #fff; }
.status-badge.dispatched { background-color: #3498db; color: #fff; }
.status-badge.paid { background-color: #2ecc71; color: #fff; }
.status-badge.pending { background-color: #e74c3c; color: #fff; }

.action-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--forest-green);
  transition: var(--transition-fast);
}

.action-icon-btn:hover {
  color: var(--secondary-green);
  transform: scale(1.1);
}

.action-icon-btn.whatsapp-direct {
  color: #27ae60;
}

/* Slicing Log Scheduler Board */
.slicing-board-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .slicing-board-grid {
    grid-template-columns: 1fr;
  }
}

.slicing-column {
  background-color: var(--bg-cream);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(44, 75, 8, 0.08);
  min-height: 350px;
}

.slicing-column-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--forest-green);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slicing-column-badge {
  background-color: var(--forest-green);
  color: var(--bg-cream);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 50px;
}

.slicing-card {
  background-color: var(--bg-white);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-light);
  border: 1px solid rgba(44, 75, 8, 0.04);
}

.slicing-card h4 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--forest-green);
  margin-bottom: 4px;
}

.slicing-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.slicing-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(44, 75, 8, 0.08);
}

/* Google Sign-in Styles */
.google-account-row {
  display: flex;
  align-items: center;
  background-color: var(--bg-white);
  border: 1px solid rgba(44, 75, 8, 0.15);
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.google-account-row:hover {
  transform: translateY(-1px);
  border-color: var(--secondary-green);
  box-shadow: var(--shadow-light);
  background-color: var(--light-overlay);
}

.google-avatar-mock {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--primary-green);
  color: var(--forest-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
}

.google-account-details {
  display: flex;
  flex-direction: column;
  margin-left: 14px;
  text-align: left;
}

.google-account-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--forest-green);
}

.google-account-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Super Admin Detailed Upgrades styling */
.slicing-card-whatsapp-btn {
  background-color: #25d366;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
  padding: 0;
}

.slicing-card-whatsapp-btn:hover {
  transform: scale(1.1);
  background-color: #20ba5a;
}

/* Sourcing and Yield forms & tables */
.sourcing-form-container {
  background-color: var(--light-overlay);
  border: var(--border-light);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.sourcing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 10px;
  background-color: var(--bg-white);
  border-radius: 8px;
  overflow: hidden;
  border: var(--border-light);
}

.sourcing-table th, .sourcing-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(44, 75, 8, 0.08);
  text-align: left;
}

.sourcing-table th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--forest-green);
  background-color: rgba(44, 75, 8, 0.03);
}

/* Invoice styled document view */
.invoice-document {
  background-color: var(--bg-white);
  border: 1px solid var(--forest-green);
  border-radius: 12px;
  padding: 24px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #333;
  line-height: 1.5;
  box-shadow: var(--shadow-light);
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px dashed rgba(44, 75, 8, 0.15);
  padding-bottom: 12px;
  margin-bottom: 15px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

.invoice-table th, .invoice-table td {
  padding: 6px 8px;
  text-align: left;
}

.invoice-table th {
  border-bottom: 1px solid #333;
}

.invoice-table td {
  border-bottom: 1px dashed rgba(0,0,0,0.1);
}

.invoice-total-section {
  border-top: 2px solid #333;
  padding-top: 10px;
  text-align: right;
}

/* Margin Indicator Colors */
.kpi-card.margin-green {
  border-left: 6px solid #27ae60;
}
.kpi-card.margin-yellow {
  border-left: 6px solid #f1c40f;
}
.kpi-card.margin-red {
  border-left: 6px solid #e74c3c;
}

/* Cohort retention table */
.cohort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: center;
  background-color: var(--bg-white);
  border: var(--border-light);
}

.cohort-table th, .cohort-table td {
  padding: 10px;
  border: 1px solid rgba(44, 75, 8, 0.15);
}

.cohort-table th {
  background-color: var(--light-overlay);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--forest-green);
}

.cohort-cell-high {
  background-color: rgba(39, 174, 96, 0.15);
  color: #2c4b08;
  font-weight: 700;
}

.cohort-cell-med {
  background-color: rgba(241, 196, 15, 0.15);
  color: #2c4b08;
  font-weight: 700;
}

.cohort-cell-low {
  background-color: rgba(231, 76, 60, 0.08);
  color: #2c4b08;
}

/* QR code mockup */
.qr-mockup-box {
  border: 2px solid var(--forest-green);
  background: white;
  width: 160px;
  height: 160px;
  margin: 15px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qr-mockup-inner {
  border: 1px solid #ccc;
  width: 140px;
  height: 140px;
  background-image: repeating-linear-gradient(45deg, #000 0px, #000 2px, transparent 2px, transparent 10px),
                    repeating-linear-gradient(-45deg, #000 0px, #000 2px, #fff 2px, #fff 10px);
  opacity: 0.85;
}

.qr-mockup-logo {
  position: absolute;
  background: white;
  padding: 4px;
  font-weight: bold;
  font-size: 10px;
  border: 1px solid var(--forest-green);
  color: var(--forest-green);
  border-radius: 4px;
  font-family: var(--font-display);
}


