/* ============================================================
   MORETECH ERP — UI COMPONENTS
   File: erp_components.css
   Version: v2026.6
   Scope: Tables, Cards, Toggles, Media, Shared Components
============================================================ */

/* ------------------------------------------------------------
   ERP TABLE & CARD CONTAINERS
------------------------------------------------------------ */
.erp-table-card {
    background: var(--erp-bg-white);
    border-radius: var(--erp-radius);
    border: 1px solid var(--erp-border-light);
    padding: 12px 16px;
    overflow-x: auto; /* Mobile safe */
}

/* Table thumbnails */
.product-thumb {
    width: 55px;
    height: 55px;
    border-radius: var(--erp-radius-sm);
    object-fit: cover;
    cursor: pointer;
}

/* Text truncation helper */
.truncate {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile adjustment */
@media (max-width: 768px) {
    .truncate {
        max-width: 160px;
    }
}

/* ------------------------------------------------------------
   ERP PILL TAGS (Supplier / Status / Labels)
------------------------------------------------------------ */
.supplier-pill {
    background: #f2f4f7;
    border: 1px solid #d0d5dd;
    color: #344054;
    padding: 3px 8px;
    font-size: 0.70rem;
    border-radius: 6px;
    margin-right: 4px;
    display: inline-block;
    white-space: nowrap;
}

.supplier-pill.primary {
    background: #d9eaff;
    border-color: #84c5ff;
    color: #083e6b;
}

/* ------------------------------------------------------------
   ERP TOGGLE SWITCH (Standard)
------------------------------------------------------------ */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    vertical-align: middle;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: #ccc;
    transition: var(--erp-transition);
    border-radius: 22px;
}

.slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    transition: var(--erp-transition);
    border-radius: 50%;
}

input:checked + .slider {
    background: #28a745;
}

input:checked + .slider::before {
    transform: translateX(20px);
}

/* ------------------------------------------------------------
   GENERIC ERP CARDS & SECTIONS
------------------------------------------------------------ */
.erp-tab-card {
    background: var(--erp-bg-white);
    border: 1px solid var(--erp-border-light);
    border-radius: var(--erp-radius);
    padding: 22px 26px;
    margin-bottom: 25px;
}

/* Section titles */
.erp-section-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--erp-text-dark);
}

/* Inline info labels */
.info-title {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--erp-text-medium);
}

/* ------------------------------------------------------------
   HERO / MEDIA COMPONENTS
------------------------------------------------------------ */
.erp-hero-box {
    background: var(--erp-bg-white);
    border: 1px solid var(--erp-border-light);
    border-radius: var(--erp-radius);
    padding: 25px 28px;
    margin-bottom: 30px;
    box-shadow: var(--erp-shadow);
}

.erp-hero-box h3 {
    font-size: 1.45rem;
    line-height: 1.3;
}

/* Large hero image */
.hero-thumb-lg {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--erp-radius);
    border: 1px solid var(--erp-border-light);
    background: #fafafa;
}

/* Responsive hero */
@media (max-width: 768px) {
    .hero-thumb-lg {
        width: 110px;
        height: 110px;
    }
}

/* Legacy hero image (kept for compatibility) */
.hero-thumb {
    width: 100%;
    max-width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: var(--erp-radius);
    background: #fafafa;
    border: 1px solid var(--erp-border-light);
}

/* Gallery thumbnails */
.gallery-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--erp-radius-sm);
    border: 1px solid var(--erp-border-light);
    cursor: pointer;
    transition: var(--erp-transition);
}

.gallery-thumb:hover {
    transform: scale(1.04);
}

/* ------------------------------------------------------------
   ERP TOOL BUTTONS (Icon Actions)
------------------------------------------------------------ */
.erp-tool-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--erp-border-light);
    background: #f8f9fb;
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--erp-transition);
    text-decoration: none;
}

.erp-tool-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.erp-tool-btn i {
    pointer-events: none;
}

/* ------------------------------------------------------------
   GLOBAL ERP FOOTER
------------------------------------------------------------ */
.erp-footer {
    margin-top: 40px;
    padding: 18px 25px;
    background: #fafafa;
    border-top: 1px solid var(--erp-border);
    text-align: center;
    color: var(--erp-text-light);
    font-size: 0.85rem;
}
/* ------------------------------------------------------------
   STATUS BADGES (Generic)
------------------------------------------------------------ */
.badge-status {
    font-size: 0.80rem;
    font-weight: 500;
}

/* ------------------------------------------------------------
   ERP TABS (Bootstrap-based, ERP flavored)
------------------------------------------------------------ */
.erp-tabs .nav-link {
    font-weight: 500;
    color: var(--erp-text-medium);
    transition: var(--erp-transition);
}

.erp-tabs .nav-link.active {
    color: #0d6efd;
    font-weight: 600;
}
/* ============================================================
   ERP PAGE HEADER
============================================================ */
.erp-page {
    padding: 24px 28px;
}

.erp-page-header {
    margin-bottom: 20px;
}

.erp-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--erp-text-dark);
}

.erp-page-subtitle {
    font-size: 0.85rem;
    color: var(--erp-text-light);
}

/* ============================================================
   KPI TEXT
============================================================ */
.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--erp-text-light);
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--erp-text-dark);
}

/* ============================================================
   CHART CARD
============================================================ */
.chart-card {
    background: var(--erp-bg-white);
    border: 1px solid var(--erp-border-light);
    border-radius: var(--erp-radius);
    padding: 20px 22px;
    height: 100%;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--erp-text-dark);
}
/* ============================================================
   ERP TABLE ENHANCEMENTS
============================================================ */
.erp-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--erp-text-light);
    background: #fafafa;
    border-bottom: 1px solid var(--erp-border-light);
}

.erp-table tbody td {
    vertical-align: middle;
}

/* Status badge (ERP unified) */
.badge-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
/* ============================================================
   ERP TOOLBAR
============================================================ */
.erp-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================================
   CUSTOMER LOOKUP CARD
============================================================ */
.customer-card {
    background: #ffffff;
    border: 1px solid var(--erp-border-light);
    border-radius: var(--erp-radius);
    padding: 20px 22px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
    height: 100%;
}

.customer-card .section-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin: 18px 0 10px;
    color: var(--erp-text-dark);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.customer-card .muted-line {
    font-size: 0.8rem;
    color: var(--erp-text-light);
}

/* ============================================================
   KEY VALUE GRID
============================================================ */
.customer-card .kv {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    font-size: 0.82rem;
    margin-bottom: 6px;
}

.customer-card .kv .k {
    font-weight: 600;
    color: var(--erp-text-medium);
}

.customer-card .kv .v {
    color: var(--erp-text-dark);
}

/* ============================================================
   CUSTOMER CARD ACTIONS
============================================================ */
.customer-card .card-actions .btn {
    font-size: 0.75rem;
    padding: 4px 10px;
}
/* ============================================================
   PROFILE KEY-VALUE GRID
============================================================ */
.profile-kv {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.profile-kv div {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.profile-kv span {
    color: var(--erp-text-light);
}

.profile-kv strong {
    font-weight: 600;
    color: var(--erp-text-dark);
}
/* ============================================================
   ERP PAYMENT TYPE CARDS
   Scope: Banking – Add Payment UI
============================================================ */

/* Payment container (legacy compatibility) */
.payment-card {
    background: var(--erp-bg-white);
    border: 1px solid var(--erp-border-light);
    border-radius: var(--erp-radius);
    padding: 22px 26px;
    box-shadow: var(--erp-shadow);
    margin-bottom: 22px;
}

/* Section title inside payment card */
.payment-card h4 {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 18px;
    color: var(--erp-text-dark);
}

/* Payment type selector */
.payment-type {
    cursor: pointer;
    border: 1px solid var(--erp-border-light);
    border-radius: 14px;
    padding: 20px 16px;
    background: #ffffff;
    text-align: center;
    transition: var(--erp-transition);
}

/* Icon */
.payment-type i {
    font-size: 26px;
    margin-bottom: 8px;
    display: block;
}

/* Hover state */
.payment-type:hover {
    background: #f8f9fb;
    border-color: #cfe2ff;
    transform: translateY(-2px);
    box-shadow: var(--erp-shadow-hover);
}

/* Active (selected payment type) */
.payment-type.active {
    border-color: #0d6efd;
    background: #eef4ff;
}

/* Text inside */
.payment-type div {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--erp-text-dark);
}

/* ============================================================
   VISIBILITY HELPERS
   (Legacy support – prefer Bootstrap d-none)
============================================================ */
.hidden {
    display: none !important;
}
/* ======================================================
   WEBSITE TEMPLATE MANAGER (Sections Grid)
   Place in: /BMP360/layouts/CSS/erp_components.css
====================================================== */

.builder-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:#f1f5f9;
  border:1px solid rgba(0,0,0,.06);
  color:#334155;
  font-weight:700;
  font-size:.82rem;
}

.builder-badge{
  border-radius:999px;
  padding:8px 12px;
  font-weight:800;
}

.section-card{
  overflow:hidden;
}

.section-key{
  font-size:.78rem;
  font-weight:800;
  color:#475569;
  background:#f8fafc;
  border:1px solid rgba(0,0,0,.06);
  border-radius:999px;
  padding:6px 10px;
}

.section-status-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  border:2px solid rgba(0,0,0,.08);
}

.section-status-dot.status-enabled{ background:#22c55e; }
.section-status-dot.status-disabled{ background:#94a3b8; }

.section-bg-icon{
  position:absolute;
  right:16px;
  top:16px;
  font-size:48px;
  opacity:.10;
  pointer-events:none;
}
/* ===============================
   Overlay Manager – List Cards
================================ */

.om-card {
  background: #fff;
  border: 1px solid var(--erp-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all .18s ease;
}

.om-card:hover {
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.om-card.active {
  border-left: 5px solid #0d6efd;
  background: linear-gradient(180deg, #ffffff, #f7faff);
}
.om-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.om-name {
  font-weight: 600;
  font-size: .95rem;
}
.om-meta {
  font-size: .75rem;
  color: #6b7280;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.om-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}
/* =========================================================
   WEBSITE REQUESTS – ERP UI
   Scope: request_list.php
========================================================= */

/* ================= KPI ================= */
.req-kpi {
  background: linear-gradient(135deg, #f8fafc, #eef2f7);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.06);
}

.req-kpi .kpi {
  flex: 1;
  min-width: 140px;
  background: #ffffff;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
}

.kpi-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #64748b;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

/* ================= TABLE ================= */
.req-table-card,
.erp-table-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 38px rgba(0,0,0,.06);
  overflow: hidden;
}

.erp-table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .55px;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

/* ================= ROW STATES ================= */
tr.row-new {
  border-left: 4px solid #facc15;
}

tr.row-unlinked {
  border-left: 4px solid #ef4444;
}

tr.row-closed {
  opacity: .65;
}

/* ================= BADGES ================= */
.badge-soft {
  display: inline-block;
  padding: 4px 8px;
  font-size: .7rem;
  border-radius: 10px;
  font-weight: 600;
}

.badge-linked {
  background: rgba(34,197,94,.12);
  color: #15803d;
}

.badge-unlinked {
  background: rgba(239,68,68,.12);
  color: #b91c1c;
}

/* ================= FILTER CARD ================= */
.erp-tab-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.05);
}

/* ================= STATUS SELECT ================= */
.status-select {
  min-width: 130px;
  font-size: .8rem;
}

/* ================= ACTION BUTTONS ================= */
.table .btn-sm {
  --bs-btn-padding-y: 0.25rem;
  --bs-btn-padding-x: 0.5rem;
  --bs-btn-font-size: 0.75rem;
}

/* ================= PAGINATION ================= */
.pagination .page-link {
  border-radius: 10px;
  font-size: .8rem;
}

.pagination .page-item.active .page-link {
  background: #2563eb;
  border-color: #2563eb;
}
/* ============================================================
   ERP — INVOICE LIST SHARED COMPONENTS
   Scope: Invoice / Proforma / Credit Notes
============================================================ */

/* Quick stats */
.quick-stats-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.quick-box {
  background: #ffffff;
  border: 1px solid var(--erp-border-light);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}

.quick-box h5 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--erp-text-medium);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.quick-box .value-main {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--erp-text-dark);
}

.quick-box .value-sub {
  font-size: .72rem;
  color: var(--erp-text-light);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
}

.status-paid {
  background: #e8f7ef;
  color: #1e7e34;
}

.status-unpaid {
  background: #fff4e5;
  color: #b45309;
}

.status-disabled {
  background: #fde8e8;
  color: #b91c1c;
}

/* Multi-currency badge */
.mc-badge {
  background: #eef2ff;
  color: #4338ca;
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  margin-left: 6px;
}

/* Total column */
.total-block {
  line-height: 1.15;
}

.total-block .currency-code {
  font-size: .7rem;
  color: var(--erp-text-light);
}
/* =========================================================
   ERP ALERT SYSTEM
========================================================= */

.erp-alert {
    border-radius: 14px;
    padding: 18px 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.25);
}

.erp-alert-content {
    line-height: 1.4;
}

.erp-alert-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.erp-alert-text {
    font-size: 14px;
    opacity: 0.9;
}

/* ICON */
.erp-alert-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

/* ===== TYPES ===== */

.erp-alert-success {
    background: linear-gradient(135deg, #e8f8f0, #d1f2e3);
    color: #0f5132;
}

.erp-alert-success .erp-alert-icon {
    background: #0f5132;
    color: #fff;
}

.erp-alert-danger {
    background: linear-gradient(135deg, #fdeaea, #f8d7da);
    color: #842029;
}

.erp-alert-danger .erp-alert-icon {
    background: #842029;
    color: #fff;
}

.erp-alert-warning {
    background: linear-gradient(135deg, #fff4e5, #ffe8c2);
    color: #664d03;
}

.erp-alert-warning .erp-alert-icon {
    background: #664d03;
    color: #fff;
}

.erp-alert-info {
    background: linear-gradient(135deg, #e7f1ff, #d6e4ff);
    color: #084298;
}

.erp-alert-info .erp-alert-icon {
    background: #084298;
    color: #fff;
}
/* =========================================================
   ERP ACTION DROPDOWN (Page Commands)
   Scope: Purchase Orders / Payments / Suppliers
========================================================= */

.erp-action-dropdown .dropdown-menu {
    min-width: 240px;
    padding: 10px;
}

.erp-action-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    font-weight: 500;
}

.erp-action-dropdown .dropdown-item i {
    width: 18px;
    text-align: center;
    opacity: 0.85;
}

.erp-action-dropdown .dropdown-item.text-danger:hover {
    background: #fdeaea;
}

.erp-action-dropdown .dropdown-item.text-warning:hover {
    background: #fff4e5;
}

.erp-action-dropdown .dropdown-item.text-primary:hover {
    background: #eef4ff;
}
.erp-kv-row span:last-child {
    font-size: 0.95rem;
}
/* =========================================================
   ERP Chart Containers (Standard)
========================================================= */

.erp-chart-box {
    position: relative;
    width: 100%;
    height: 300px; /* default chart height */
}

.erp-chart-box.sm {
    height: 220px;
}

.erp-chart-box.lg {
    height: 360px;
}

.erp-chart-box canvas {
    width: 100% !important;
    height: 100% !important;
}
/* =========================================================
   ERP QUICK ACTIONS (Dashboard Entry Point)
========================================================= */

.erp-quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.erp-quick-actions .quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--erp-border-light);
    background: #ffffff;
    color: var(--erp-text-dark);
    transition: all 0.15s ease;
}

.erp-quick-actions .quick-action-btn:hover {
    background: var(--erp-bg-soft);
    transform: translateY(-1px);
}

.erp-quick-actions .primary {
    background: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
}

.erp-quick-actions .primary:hover {
    background: #0b5ed7;
}
/* =========================================================
   ERP EMPTY STATE (Standard)
========================================================= */

.erp-empty-state {
    text-align: center;
    padding: 40px 20px;
    border: 1px dashed var(--erp-border-light);
    border-radius: 14px;
    background: var(--erp-bg-soft);
}

.erp-empty-state i {
    font-size: 32px;
    color: var(--erp-text-muted);
    margin-bottom: 10px;
}

.erp-empty-state h6 {
    font-weight: 600;
    margin-bottom: 6px;
}

.erp-empty-state p {
    font-size: 0.85rem;
    color: var(--erp-text-muted);
    margin-bottom: 12px;
}
