/* ==========================================================================
   CUSTOMER DATABASE & DIRECTORY COMMAND CENTER
   Enterprise Matte Dark Design System (#0B0F14 / #111720 / #151C26 / #192231)
   Features:
    - Dual View Modes: High-Density List Table vs. Minimal Google/Odoo Grid Cards
    - Instant Filter Pills & Real-time Live Search
    - Intelligent Fuzzy Name Matching & Google Sheet Auto-Sync
    - Click-to-Edit, Favorite Starring, and CSV Export
   ========================================================================== */

.customer-master-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #0c1017;
  color: #f1f5f9;
  min-height: calc(100vh - 44px);
  padding: 16px 20px 24px 20px;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   1. KPI SUMMARY METRICS
   ========================================================================== */
.customer-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

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

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

.customer-kpi-card {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.customer-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.customer-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-cust-pink {
  background-color: rgba(219, 39, 119, 0.18);
  color: #ec4899;
}

.kpi-cust-green {
  background-color: rgba(16, 185, 129, 0.18);
  color: #10b981;
}

.kpi-cust-blue {
  background-color: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
}

.kpi-cust-amber {
  background-color: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

.customer-kpi-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.customer-kpi-title {
  font-size: 11.5px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.customer-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}

.customer-kpi-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* ==========================================================================
   2. TOOLBAR & FILTER CONTROLS
   ========================================================================== */
.customer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
}

.customer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
  min-width: 280px;
}

.customer-search-box {
  position: relative;
  width: 260px;
}

.customer-search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
}

.customer-search-box input {
  width: 100%;
  background-color: #0c1017;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px 6px 30px;
  font-size: 12px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.customer-search-box input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Customer Filter Pills */
.customer-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
}

.cust-filter-pill {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cust-filter-pill:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.cust-filter-pill.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}

/* Toolbar Right Controls */
.customer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-add-customer-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-add-customer-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-sync-customer-sheet {
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sync-customer-sheet:hover {
  background-color: rgba(16, 185, 129, 0.22);
  border-color: #10b981;
  color: #ffffff;
}

/* ==========================================================================
   3. MINIMAL GOOGLE / ODOO COMPACT GRID CARDS (Matte Dark)
   ========================================================================== */
.customer-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

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

@media (max-width: 640px) {
  .customer-cards-grid {
    grid-template-columns: 1fr;
  }
}

.customer-card-minimal {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 94px;
  min-width: 0;
  position: relative;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  overflow: hidden;
}

.customer-card-minimal:hover {
  background-color: #171f2e;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.cust-card-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-right: 48px;
}

.cust-name-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-bin-line {
  font-size: 11px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cust-bin-tag {
  color: #38bdf8;
  font-weight: 500;
}

.cust-indiv-tag {
  color: #94a3b8;
  font-style: italic;
}

.cust-info-line {
  font-size: 11.5px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-info-line .info-label {
  color: #94a3b8;
  font-size: 11px;
  flex-shrink: 0;
}

.cust-info-line .info-value {
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-info-line .phone-text {
  font-family: 'JetBrains Mono', monospace;
  color: #10b981;
  font-weight: 500;
}

.cust-info-line .orders-text {
  font-family: 'JetBrains Mono', monospace;
  color: #f59e0b;
  font-weight: 600;
}

/* Hover Quick Actions for Customer Cards */
.cust-card-hover-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.customer-card-minimal:hover .cust-card-hover-actions {
  opacity: 1;
}

/* ==========================================================================
   4. HIGH-DENSITY LIST TABLE VIEW
   ========================================================================== */
.customer-table-wrapper {
  background-color: #131926;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.customer-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #f1f5f9;
  text-align: left;
}

.customer-data-table thead th {
  background-color: #171f2e;
  color: #94a3b8;
  font-weight: 600;
  font-size: 11.5px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.customer-data-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.customer-data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.035);
}

.customer-data-table td {
  padding: 11px 10px;
  vertical-align: middle;
}
