/* B2B Custom Dashboard Styles - FIXED */

/* Armenian Font */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Armenian:wght@400;500;600;700&display=swap');

/* --- WELCOME SECTION --- */
.b2b-dashboard-welcome {
    background: linear-gradient(135deg, #28462F 0%, #28462F 100%) !important;
    border-radius: 16px !important;
    padding: 32px !important;
    margin-bottom: 32px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important; /* Разрешаем перенос, чтобы не сплющивало */
    box-shadow: 0 4px 20px rgba(231, 38, 55, 0.2) !important;
    color: white !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.b2b-welcome-content {
    flex: 1;
    min-width: 200px; /* Минимальная ширина текста */
}

.b2b-welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px;
    color: white;
    line-height: 1.2;
}

.b2b-welcome-subtitle {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
    color: white;
}

.b2b-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    white-space: nowrap; /* Чтобы статус не ломался */
}

.b2b-status-badge svg {
    flex-shrink: 0;
}

.b2b-status-badge.b2b-status-approved {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

.b2b-status-badge.b2b-status-pending {
    background: rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.4);
}

.b2b-status-badge.b2b-status-rejected {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.4);
}

.b2b-status-indicator {
    flex-shrink: 0;
}

/* --- STATS GRID (Исправлено "в одну линию") --- */
.b2b-dashboard-stats {
    display: grid !important;
    /* Ровно 2 колонки, если экран позволяет */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important; 
    gap: 24px !important;
    margin-bottom: 32px !important;
    width: 100% !important;
}

.b2b-stat-card {
    background: white !important;
    border-radius: 12px !important;
    padding: 24px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e5e7eb !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease;
}

.b2b-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.b2b-stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #28462F 0%, #28462F 100%);
    border-radius: 12px;
    color: white;
    flex-shrink: 0;
}

.b2b-stat-content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1;
    min-width: 0;
}

.b2b-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.2;
}

.b2b-stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* --- INFO & ORDERS CARDS --- */
.b2b-info-card,
.b2b-orders-card {
    background: white !important;
    border-radius: 12px !important;
    padding: 24px !important;
    margin-bottom: 32px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e5e7eb !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.b2b-info-header,
.b2b-orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
}

.b2b-info-title,
.b2b-orders-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.b2b-info-title svg,
.b2b-orders-title svg {
    color: #28462F;
}

.b2b-info-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- TABLES --- */
.b2b-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.b2b-info-row:last-child {
    border-bottom: none;
}

.b2b-info-label {
    font-weight: 600;
    color: #374151;
    font-size: 15px;
}

.b2b-info-value {
    color: #111827;
    font-size: 15px;
}

/* --- ORDERS LIST --- */
.b2b-orders-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.b2b-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.b2b-order-item:last-child {
    border-bottom: none;
}

.b2b-order-item:hover {
    background: #f9fafb;
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
    border-radius: 8px;
}

.b2b-order-main {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 0;
}

.b2b-order-number {
    font-weight: 700;
    color: #28462F;
    font-size: 15px;
    min-width: 70px;
}

.b2b-order-date {
    font-size: 14px;
    color: #6b7280;
    min-width: 90px;
}

.b2b-order-status {
    min-width: 110px;
}

.b2b-order-status span {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.b2b-status-processing {
    background: #DBEAFE;
    color: #1E40AF;
}

.b2b-status-completed {
    background: #D1FAE5;
    color: #065F46;
}

.b2b-status-cancelled {
    background: #FEE2E2;
    color: #991B1B;
}

.b2b-status-failed {
    background: #FEE2E2;
    color: #991B1B;
}

.b2b-status-pending,
.b2b-status-on-hold {
    background: #FEF3C7;
    color: #92400E;
}

.b2b-order-total {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
    min-width: 100px;
    text-align: right;
}

.b2b-order-total del {
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
}

.b2b-order-total ins {
    text-decoration: none;
    color: #111827;
}

.b2b-order-actions {
    margin-left: 16px;
    flex-shrink: 0;
}

.b2b-order-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #28462F;
    color: #ffffff !important;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.b2b-order-view:hover {
    background: #1c3322;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 70, 47, 0.3);
}

.b2b-order-view svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* --- VIEW ALL LINK --- */
.b2b-view-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #28462F !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.b2b-view-all:hover {
    color: #1c3322 !important;
}

.b2b-view-all svg {
    transition: transform 0.2s ease;
}

.b2b-view-all:hover svg {
    transform: translateX(3px);
}

.b2b-orders-body {
    display: block;
}

.b2b-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.b2b-empty-state svg {
    margin-bottom: 20px;
}

.b2b-empty-text {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 24px;
}

.b2b-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, #28462F 0%, #28462F 100%);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(231, 38, 55, 0.2);
}

.b2b-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 38, 55, 0.3);
}

/* --- CUSTOM DASHBOARD CONTAINER --- */
.b2b-custom-dashboard,
.b2b-dashboard {
    font-family: "Noto Sans Armenian", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #111827 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    min-height: 400px !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .b2b-dashboard-welcome {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px;
    }
    
    .b2b-dashboard-stats {
        grid-template-columns: 1fr !important;
    }
    
    .b2b-stat-card {
        padding: 16px !important;
    }
    
    .b2b-welcome-title {
        font-size: 24px;
    }

    .b2b-order-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .b2b-order-main {
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .b2b-order-number {
        min-width: auto;
    }

    .b2b-order-date {
        min-width: auto;
    }

    .b2b-order-status {
        min-width: auto;
    }

    .b2b-order-total {
        min-width: auto;
        text-align: left;
    }

    .b2b-order-actions {
        margin-left: 0;
        width: 100%;
        margin-top: 4px;
    }

    .b2b-order-view {
        width: 100%;
        justify-content: center;
    }
}
