/* ERP-style layout & theme – OM Sales PO (ui.md) */

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

:root {
  /* ui.md color palette */
  --oms-primary: #2C3E50;
  --oms-secondary: #34495E;
  --oms-success: #27AE60;
  --oms-warning: #F39C12;
  --oms-danger: #E74C3C;
  --oms-bg-light: #F5F7FA;
  /* Map to existing Zoho vars for compatibility */
  --zoho-primary: #2C3E50;
  --zoho-primary-hover: #1a252f;
  --zoho-primary-light: rgba(44, 62, 80, 0.08);
  --zoho-bg: #F5F7FA;
  --zoho-sidebar-bg: #ffffff;
  --zoho-border: #e8eaed;
  --zoho-card-bg: #ffffff;
  --zoho-text: #2C3E50;
  --zoho-text-muted: #6b7280;
  --zoho-radius: 8px;
  --zoho-radius-lg: 10px;
  --zoho-sidebar-width: 260px;
  --zoho-sidebar-collapsed-width: 72px;
  --zoho-topbar-height: 56px;
  --zoho-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --zoho-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --oms-gradient-main: linear-gradient(135deg, #1f3c88 0%, #2C3E50 55%, #3a6073 100%);
  --oms-gradient-soft: linear-gradient(135deg, #f0f4ff 0%, #f7fbff 45%, #eef4ff 100%);
  --oms-gradient-card: linear-gradient(140deg, rgba(31,60,136,0.08), rgba(44,62,80,0.04));
  --oms-gradient-kpi-primary: linear-gradient(135deg, rgba(31,60,136,0.16) 0%, rgba(44,62,80,0.08) 55%, rgba(58,96,115,0.04) 100%);
  --oms-gradient-kpi-warning: linear-gradient(135deg, rgba(243,156,18,0.18) 0%, rgba(243,156,18,0.08) 55%, rgba(249,203,109,0.04) 100%);
  --oms-gradient-kpi-success: linear-gradient(135deg, rgba(39,174,96,0.18) 0%, rgba(39,174,96,0.08) 55%, rgba(72,186,120,0.04) 100%);
  --oms-gradient-kpi-danger: linear-gradient(135deg, rgba(231,76,60,0.18) 0%, rgba(231,76,60,0.08) 55%, rgba(242,105,90,0.04) 100%);
  --oms-gradient-kpi-secondary: linear-gradient(135deg, rgba(52,73,94,0.16) 0%, rgba(52,73,94,0.08) 55%, rgba(96,116,138,0.04) 100%);
}

* {
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at 12% 8%, #edf4ff 0%, #f5f7fa 38%, #f5f7fa 100%);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--zoho-text);
  font-size: 14px;
  line-height: 1.5;
}

/* ----- Top bar (ERP-style) ----- */
.zoho-topbar {
  height: var(--zoho-topbar-height);
  background: linear-gradient(90deg, #ffffff 0%, #f7faff 100%);
  border-bottom: 1px solid #dde6f4;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--zoho-shadow);
}

.zoho-topbar-search {
  max-width: 320px;
  flex: 1;
  min-width: 120px;
}

.zoho-topbar-search .form-control {
  border-radius: 20px;
  padding-left: 2.25rem;
  background: var(--oms-bg-light);
  border: 1px solid var(--zoho-border);
}

.zoho-topbar-search .search-wrap {
  position: relative;
}

.zoho-topbar-search .bi-search {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--zoho-text-muted);
  pointer-events: none;
}

.zoho-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoho-topbar-actions .btn-link-nav {
  color: var(--zoho-text-muted);
  padding: 0.5rem;
  border-radius: var(--zoho-radius);
  transition: color 0.15s, background 0.15s;
}

.zoho-topbar-actions .btn-link-nav:hover {
  color: var(--zoho-primary);
  background: var(--zoho-primary-light);
}

.zoho-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--zoho-text);
  font-weight: 600;
  font-size: 1.0625rem;
}

.zoho-topbar-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--oms-gradient-main);
  box-shadow: 0 6px 14px rgba(44, 62, 80, 0.25);
  position: relative;
}

.zoho-topbar-brand-icon.has-logo {
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(44, 62, 80, 0.18);
}

.zoho-topbar-brand-icon.has-logo::after {
  display: none;
}

.zoho-topbar-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  display: block;
  border-radius: 9px;
}

.zoho-topbar-brand-icon::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
}

.zoho-topbar-brand span:not(.zoho-topbar-brand-icon) {
  color: transparent;
  background: var(--oms-gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ----- App layout: sidebar + main + footer ----- */
.zoho-app-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - var(--zoho-topbar-height));
}

.zoho-app-layout .d-flex.min-h-0 {
  flex: 1;
  min-width: 0;
}

.zoho-app-layout .zoho-main {
  flex: 1;
  min-width: 0;
}

.zoho-app-layout .zoho-footer {
  flex-shrink: 0;
}

.zoho-sidebar {
  width: var(--zoho-sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid var(--zoho-border);
  padding: 1rem 0;
  overflow-y: auto;
  transition: width 0.2s ease;
  display: flex;
  flex-direction: column;
}

.zoho-sidebar-section.border-top {
  margin-top: auto;
}

.zoho-app-layout.sidebar-collapsed .zoho-sidebar {
  width: var(--zoho-sidebar-collapsed-width);
}

.zoho-app-layout.sidebar-collapsed .zoho-sidebar-section-title {
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
}

.zoho-app-layout.sidebar-collapsed .zoho-sidebar-nav .zoho-sidebar-label {
  display: none;
}

.zoho-app-layout.sidebar-collapsed .zoho-sidebar-nav a {
  justify-content: center;
  padding: 0.5rem;
}

.zoho-sidebar-nav a .bi {
  flex-shrink: 0;
}

.zoho-sidebar-nav .zoho-sidebar-label {
  white-space: nowrap;
}

.zoho-sidebar-section {
  padding: 0 0.75rem;
  margin-bottom: 1rem;
}

.zoho-sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--zoho-text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.zoho-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zoho-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  color: var(--zoho-text);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: var(--zoho-radius);
  border-left: 3px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.zoho-sidebar-nav a span:not(.bi) {
  white-space: nowrap;
}

.zoho-sidebar-nav a:hover {
  background: rgba(31, 60, 136, 0.08);
  transform: translateX(2px);
}

.zoho-sidebar-nav a.active {
  background: var(--zoho-primary-light);
  color: var(--zoho-primary);
  font-weight: 600;
  border-left-color: var(--zoho-primary);
}

.zoho-sidebar-nav a i {
  font-size: 1.125rem;
  opacity: 0.9;
}

.zoho-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
  overflow-x: auto;
}

.oms-hero {
  background: var(--oms-gradient-main);
  border-radius: 16px;
  padding: 1.1rem 1.25rem;
  color: #fff;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(31, 60, 136, 0.22);
}

.oms-hero::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -36px;
  top: -60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.oms-hero .zoho-page-title {
  color: #fff;
}

.oms-hero-subtitle {
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  font-size: 0.85rem;
}

@media (min-width: 992px) {
  .zoho-main {
    padding: 1.75rem 2rem;
  }
}

/* ----- Main content area (white card) ----- */
.zoho-content-card {
  background: linear-gradient(180deg, #ffffff 0%, #fdfeff 100%);
  border: 1px solid #e6edf8;
  border-radius: var(--zoho-radius-lg);
  box-shadow: 0 10px 25px rgba(31, 60, 136, 0.06);
  overflow: hidden;
}

.zoho-content-card .card-header {
  background: var(--oms-gradient-soft);
  border-bottom: 1px solid #e6edf8;
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--zoho-text);
}

.zoho-content-card .card-body {
  padding: 1.25rem;
}

/* ----- Page title bar ----- */
.zoho-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.zoho-page-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--zoho-text);
  margin: 0;
}

/* ----- Grid (Zoho-style 12-col) ----- */
.zoho-grid {
  display: grid;
  gap: 1rem;
}

.zoho-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 575px) {
  .zoho-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ----- KPI / stat widgets (ui.md: Blue Total, Orange Pending, Green Confirmed, Red Cancelled) ----- */
.zoho-kpi {
  background: var(--oms-gradient-card);
  border: 1px solid var(--zoho-border);
  border-radius: var(--zoho-radius);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--zoho-primary);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
  overflow: hidden;
}

.zoho-kpi::after {
  content: "";
  position: absolute;
  inset: -30px -40px auto auto;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.18) 35%, rgba(255, 255, 255, 0) 70%);
  transform: rotate(15deg);
  opacity: 0.65;
  pointer-events: none;
}

.zoho-kpi:hover {
  box-shadow: 0 12px 26px rgba(31, 60, 136, 0.12);
  transform: translateY(-2px);
}

.zoho-kpi-primary { border-left-color: var(--oms-primary); background: var(--oms-gradient-kpi-primary); }
.zoho-kpi-primary .value { color: var(--oms-primary); }
.zoho-kpi-warning { border-left-color: var(--oms-warning); background: var(--oms-gradient-kpi-warning); }
.zoho-kpi-warning .value { color: var(--oms-warning); }
.zoho-kpi-success { border-left-color: var(--oms-success); background: var(--oms-gradient-kpi-success); }
.zoho-kpi-success .value { color: var(--oms-success); }
.zoho-kpi-danger { border-left-color: var(--oms-danger); background: var(--oms-gradient-kpi-danger); }
.zoho-kpi-danger .value { color: var(--oms-danger); }
.zoho-kpi-secondary { border-left-color: var(--oms-secondary); background: var(--oms-gradient-kpi-secondary); }
.zoho-kpi-secondary .value { color: var(--oms-secondary); }

.zoho-kpi .label {
  font-size: 0.8125rem;
  color: var(--zoho-text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.zoho-kpi .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--zoho-text);
  line-height: 1.2;
}

/* ----- Tables (ui.md: sticky header, row hover, status badges) ----- */
.zoho-table {
  width: 100%;
  margin: 0;
  font-size: 0.9375rem;
}

.zoho-table thead th {
  background: var(--oms-bg-light);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--zoho-text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--zoho-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 var(--zoho-border);
}

/* Status badges: Pending=Yellow, Sent=Blue, Confirmed=Green, Cancelled=Red */
.badge-status-pending { background: var(--oms-warning); color: #fff; }
.badge-status-sent { background: var(--zoho-primary); color: #fff; }
.badge-status-confirmed { background: var(--oms-success); color: #fff; }
.badge-status-cancelled { background: var(--oms-danger); color: #fff; }
.badge-status-draft { background: var(--oms-secondary); color: #fff; }
.badge-status-completed { background: var(--oms-success); color: #fff; }

.zoho-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}

.zoho-table tbody tr:hover {
  background: #fafbfc;
}

.zoho-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ----- Buttons ----- */
.btn-primary {
  background: var(--oms-gradient-main);
  border-color: #1f3c88;
}

.btn-primary:hover {
  filter: brightness(1.04);
  border-color: #1f3c88;
}

.btn {
  border-radius: var(--zoho-radius);
  font-weight: 500;
  font-size: 0.9375rem;
  box-shadow: 0 2px 7px rgba(44, 62, 80, 0.08);
}

.btn-sm {
  border-radius: 6px;
  font-size: 0.8125rem;
}

/* ----- Forms ----- */
.form-control,
.form-select {
  border-radius: var(--zoho-radius);
  border-color: var(--zoho-border);
  font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--zoho-primary);
  box-shadow: 0 0 0 3px var(--zoho-primary-light);
}

.form-label {
  font-weight: 500;
  color: var(--zoho-text);
  font-size: 0.875rem;
}

/* ----- Cards (generic) ----- */
.oms-card {
  border: 1px solid var(--zoho-border);
  border-radius: var(--zoho-radius-lg);
  box-shadow: var(--zoho-shadow);
  background: var(--zoho-card-bg);
  overflow: hidden;
}

.oms-card .card-header {
  background: #fafbfc;
  border-bottom: 1px solid var(--zoho-border);
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.oms-card .card-body {
  padding: 1.25rem;
}

/* ----- Legacy class mapping ----- */
.oms-main-content {
  background: linear-gradient(180deg, #ffffff 0%, #fcfeff 100%);
  border: 1px solid #e6edf8;
  border-radius: var(--zoho-radius-lg);
  box-shadow: 0 14px 28px rgba(31, 60, 136, 0.07);
  padding: 1.5rem;
}

@media (min-width: 992px) {
  .oms-main-content {
    padding: 1.75rem;
  }
}

.oms-table thead th {
  background: #fafbfc;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--zoho-text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--zoho-border);
}

.oms-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f1f3;
}

.oms-kpi {
  border: 1px solid var(--zoho-border);
  border-radius: var(--zoho-radius);
  background: var(--zoho-card-bg);
  border-left: 4px solid var(--zoho-primary);
  padding: 1rem 1.25rem;
}

.oms-kpi .label {
  color: var(--zoho-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.oms-kpi .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--zoho-text);
}

/* ----- Mobile: sidebar as offcanvas ----- */
.zoho-sidebar.d-none.d-lg-block {
  display: none !important;
}

@media (min-width: 992px) {
  .zoho-sidebar.d-none.d-lg-block {
    display: block !important;
  }
}

.zoho-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--zoho-border);
  background: var(--oms-gradient-soft);
  padding: 1rem 1.25rem;
}

.zoho-offcanvas .list-group-item {
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--zoho-radius);
  margin: 2px 0.5rem;
}

.zoho-offcanvas .list-group-item.active {
  background: var(--zoho-primary-light);
  color: var(--zoho-primary);
  font-weight: 600;
  border-left-color: var(--zoho-primary);
}

/* ----- Login ----- */
.min-vh-50 {
  min-height: 50vh;
}

.login-auth-wrap {
  position: relative;
}

.login-auth-card {
  border-radius: 16px;
  overflow: hidden;
}

.login-auth-card .card-body {
  background: linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
}

.login-brand-wrap {
  width: 100%;
}

.login-brand-logo {
  display: block;
  width: clamp(56px, 18vw, 88px);
  max-width: 88px;
  max-height: 44px;
  margin: 0 auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(31, 60, 136, 0.18));
}

.login-brand-fallback {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

/* ----- Flash (SweetAlert) ----- */
.oms-flash {
  margin: 0;
  padding: 0;
  opacity: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ----- Footer (ui.md layout) ----- */
.zoho-footer {
  padding: 0.75rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--zoho-text-muted);
  border-top: 1px solid var(--zoho-border);
  background: linear-gradient(90deg, #f7faff 0%, #f2f7ff 100%);
  margin-top: auto;
}

/* ----- Table search bar above table ----- */
.oms-table-toolbar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--zoho-border);
  background: var(--zoho-card-bg);
}

.oms-table-toolbar .form-control {
  max-width: 260px;
}
