/* ===============================================
   WHOLESALE-COMPONENTS.CSS
   Domain-specific components for Wholesale Platform
   Order cards, Customer intelligence, RFM displays
   =============================================== */

/* ===============================================
   CUSTOMER CARDS - Compact Layout with Icon
   =============================================== */

.customer-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-md);  /* 12px */
    box-shadow: none;
    border: 1px solid var(--border-light);
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
    min-height: 90px;
}

.customer-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
    border-color: var(--color-primary);
}

.customer-card.interactive {
    cursor: pointer;
}

/* Row 1: Icon + Name + RFM Badges */
.customer-card-row-1 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);  /* 8px */
    margin-bottom: var(--space-xs);  /* 4px - reduced from 12px */
}

.customer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-primary);
    flex-shrink: 0;
    line-height: 1;
}

.customer-name {
    font-size: var(--text-lg);  /* 15px */
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
    flex: 1;  /* Take available space */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-rfm {
    display: flex;
    gap: var(--space-xs);  /* 4px */
    align-items: center;
    flex-shrink: 0;
}

.rfm-score {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.rfm-score.score-5 { background: #dcfce7; color: #15803d; }
.rfm-score.score-4 { background: #d1fae5; color: #166534; }
.rfm-score.score-3 { background: #fed7aa; color: #9a3412; }
.rfm-score.score-2 { background: #fecaca; color: #991b1b; }
.rfm-score.score-1 { background: #fee2e2; color: #7f1d1d; }

/* Row 2: Segment (Indented) */
.customer-card-row-2 {
    padding-left: 28px;  /* Align with name (icon 20px + gap 8px) */
    margin-bottom: 6px;  /* Reduced from 12px */
}

.customer-segment {
    font-size: var(--text-xs);  /* 12px */
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* Separator */
.customer-card-separator {
    border-top: 1px solid var(--border-light);
    margin: 6px 0;  /* Reduced from 24px total (12px + 12px) */
}

/* Row 3: Inline Metrics */
.customer-card-row-3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);  /* 12px */
    font-size: var(--text-sm);  /* 13px */
    color: var(--text-secondary);
}

.customer-metric-inline {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1.4;
}

.customer-metric-inline .metric-value {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* ===============================================
   ORDER CARDS
   =============================================== */

.order-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.order-number {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.order-status {
    padding: 4px var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.order-status.confirmed { background: #dcfce7; color: #15803d; }
.order-status.pending { background: #fef3c7; color: #b45309; }
.order-status.processing { background: #dbeafe; color: #1e40af; }
.order-status.delivered { background: #dcfce7; color: #166534; }

.order-customer {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: var(--line-height-normal);
}

.order-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.order-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.order-detail-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
}

.order-detail-value {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* ===============================================
   INVENTORY STATUS
   =============================================== */

.inventory-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
}

.inventory-status.in-stock {
    background: #dcfce7;
    color: #15803d;
}

.inventory-status.low-stock {
    background: #fef3c7;
    color: #b45309;
}

.inventory-status.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.inventory-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ===============================================
   ALERT BOXES
   =============================================== */

.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
    line-height: var(--line-height-normal);
}

.alert.alert-info {
    background: #f0fdf4;
    border-color: var(--color-primary);
    color: #166534;
}

.alert.alert-success {
    background: #f0fdf4;
    border-color: var(--color-success);
    color: #15803d;
}

.alert.alert-warning {
    background: #fffbeb;
    border-color: var(--color-warning);
    color: #b45309;
}

.alert.alert-error {
    background: #fef2f2;
    border-color: var(--color-error);
    color: #991b1b;
}

.alert strong {
    font-weight: var(--font-weight-semibold);
}

/* ===============================================
   QUICK STATS BAR - High Density, Flat Design
   =============================================== */

.quick-stats {
    display: flex;
    gap: var(--space-md);  /* 12px - More compact */
    padding: var(--space-md);  /* 12px - More compact */
    background: var(--bg-white);  /* #ffffff - white pops on light beige panel */
    border-radius: var(--radius-md);
    box-shadow: none;  /* Flat design, no shadow */
    border: 1px solid var(--border-light);
}

.quick-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;  /* Tighter spacing */
    min-width: 120px;  /* Ensure readability */
}

.quick-stat-label {
    font-size: var(--text-xs);  /* 12px */
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.quick-stat-value {
    font-size: var(--text-lg);  /* 15px - More compact */
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.2;
    margin: 2px 0;
}

.quick-stat-change {
    font-size: var(--text-sm);  /* 13px */
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
}

.quick-stat-change.positive {
    color: var(--color-success);
}

.quick-stat-change.negative {
    color: var(--color-error);
}

.quick-stat-change.neutral {
    color: var(--text-muted);
}

.quick-stat-change.warning {
    color: var(--color-warning);
}

.quick-stat-change.error {
    color: var(--color-error);
}

/* ===============================================
   PROGRESS INDICATORS
   =============================================== */

.progress-bar-container {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.progress-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.progress-bar-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.progress-bar-value {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 999px;
    transition: width 0.4s var(--ease-out);
}

.progress-bar-fill.success {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.progress-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-bar-fill.error {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

