/* ========================================================
   STARTAI PRODUCT PURCHASE SOLD (MODERN SAAS DASHBOARD UI)
   ======================================================== */

.startai-sold-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    margin: 15px 0 40px 0;
}

/* 1. Module Header */
.startai-sold-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.sold-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.sold-header-text {
    display: flex;
    flex-direction: column;
}

.sold-main-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}

.sold-sub-title {
    font-size: 13.5px;
    color: #64748b;
    margin: 3px 0 0 0;
}

/* 2. KPI Summary Cards Grid */
.startai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

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

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

.startai-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.startai-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
    border-color: #cbd5e1;
}

.kpi-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-wrap.blue {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

.kpi-icon-wrap.green {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #dcfce7;
}

.kpi-icon-wrap.amber {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fef3c7;
}

.kpi-icon-wrap.purple {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #f3e8ff;
}

.kpi-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kpi-label {
    font-size: 12.5px;
    color: #64748b;
    font-weight: 500;
}

.kpi-value {
    font-size: 21px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    margin: 2px 0 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-subtext {
    font-size: 11.5px;
    color: #94a3b8;
}

/* 3. Search & Filter Bar */
.startai-sold-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}

.startai-search-wrap {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.startai-search-wrap:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.startai-search-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border: none;
    outline: none;
    font-size: 14px;
    color: #1e293b;
    background: transparent;
}

.startai-search-input::placeholder {
    color: #94a3b8;
}

.startai-search-btn {
    width: 46px;
    height: 40px;
    border: none;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.startai-search-btn:hover {
    background: #1d4ed8;
}

/* Filter Tabs */
.startai-filter-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.filter-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-tab-btn:hover {
    color: #0f172a;
}

.filter-tab-btn.active {
    background: #ffffff;
    color: #2563eb;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-tab-btn .tab-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}

.filter-tab-btn.active .tab-badge {
    background: #eff6ff;
    color: #2563eb;
}

/* 4. Top Summary Result Bar */
.startai-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.startai-top-bar .result-count {
    font-size: 13.5px;
    color: #64748b;
}

.startai-top-bar .result-count b {
    color: #0f172a;
    font-weight: 600;
}

/* 5. Table Layout & Dimensions */
.startai-table-wrap {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

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

.startai-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 14px;
    border-bottom: 1.5px solid #e2e8f0;
    vertical-align: middle;
}

.startai-table tbody tr.item {
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.startai-table tbody tr.item:hover {
    background-color: #f8fafc;
}

.startai-table tbody tr.item.opened {
    background-color: #eff6ff !important;
}

.startai-table tbody tr.item > td {
    padding: 12px 14px;
    font-size: 13.5px;
    color: #334155;
    vertical-align: middle;
}

/* Column Widths */
.col-index { width: 45px; text-align: center !important; }
.col-product { min-width: 260px; }
.col-buyer { min-width: 170px; }
.col-date { width: 130px; }
.col-qty { width: 60px; text-align: center !important; }
.col-price { width: 115px; }
.col-total { width: 120px; }
.col-status { width: 125px; text-align: center !important; }
.col-action { width: 110px; text-align: center !important; }

/* 6. Cell Badges & Components */
.badge-index {
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.prod-cell-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prod-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.prod-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px dashed #cbd5e1;
}

.prod-info-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.prod-name-link {
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
    transition: color 0.15s;
}

.prod-name-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.prod-sub-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-code {
    display: inline-block;
    padding: 2px 6px;
    background: #e2e8f0;
    color: #334155;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.cat-label {
    font-size: 12px;
    color: #64748b;
}

/* Buyer Cell */
.buyer-main-name {
    font-weight: 600;
    color: #0f172a;
}

.buyer-phone-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #0284c7;
    margin-top: 2px;
}

.badge-no-order {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
}

/* Date Cell */
.time-main {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: #334155;
    font-weight: 500;
}

.time-sub {
    font-size: 12px;
    color: #64748b;
}

.time-sub .lbl-post {
    color: #94a3b8;
}

/* Qty & Price Cells */
.qty-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.qty-badge.ordered {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.qty-badge.stock {
    background: #f1f5f9;
    color: #475569;
}

.price-val {
    font-size: 13.5px;
    color: #475569;
}

.total-val {
    font-size: 14px;
    font-weight: 700;
    color: #2563eb;
}

.val-dash {
    display: inline-block;
    color: #94a3b8;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.05em;
}

/* 7. Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-badge.status-inactive {
    background: #f1f5f9;
    color: #64748b;
}
.status-badge.status-inactive .badge-dot { background: #94a3b8; }

.status-badge.status-pending {
    background: #fef3c7;
    color: #b45309;
}
.status-badge.status-pending .badge-dot { background: #f59e0b; }

.status-badge.status-processing {
    background: #eff6ff;
    color: #1d4ed8;
}
.status-badge.status-processing .badge-dot { background: #3b82f6; }

.status-badge.status-completed {
    background: #f0fdf4;
    color: #15803d;
}
.status-badge.status-completed .badge-dot { background: #22c55e; }

/* 8. ACTION BUTTON ("CHI TIẾT" COLUMN - UPGRADED MODERN PILL) */
.btn-action-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 6px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    border: none;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.22);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-action-view:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.32);
    color: #ffffff !important;
}

.btn-action-view:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-action-view svg {
    flex-shrink: 0;
}

/* 9. Expandable Details Row */
.startai-table tbody tr.ext {
    display: none;
    background: #f8fafc;
}

.startai-table tbody tr.ext.opened {
    display: table-row;
}

.startai-table tbody tr.ext > td {
    padding: 16px 20px;
    border-bottom: 1.5px solid #e2e8f0;
}

.ext-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
    font-size: 13px;
}

.ext-details-grid .ext-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ext-details-grid .ext-item.full-width {
    grid-column: 1 / -1;
}

.ext-label {
    font-weight: 600;
    color: #64748b;
    min-width: 110px;
}

.ext-val {
    color: #1e293b;
    word-break: break-word;
}

.ext-val.font-code {
    font-family: monospace;
    font-weight: 600;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #0f172a;
}

.ext-val.font-semibold {
    font-weight: 600;
}

.prop-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-right: 6px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #334155;
}

/* 10. Loading & Empty States */
.startai-loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.startai-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 14px auto;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: startai-spin 0.8s linear infinite;
}

@keyframes startai-spin {
    to { transform: rotate(360deg); }
}

.startai-empty-state {
    text-align: center;
    padding: 50px 20px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    margin-top: 10px;
}

.startai-empty-state .empty-icon {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.startai-empty-state h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.startai-empty-state p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}
