/* Redesigned Premium SaaS Dashboard stylesheet for MP Analytics */

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --success: #16a34a;
    --success-light: #f0fdf4;
    --success-border: #bbf7d0;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-border: #fef3c7;
    
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --danger-border: #fee2e2;
    
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-border: #bfdbfe;
    
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #0f172a;      /* slate-900 */
    --text-muted: #64748b;      /* slate-500 */
    --border-color: #e2e8f0;    /* slate-200 */
    
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.03), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    margin: 0;
    padding: 48px 24px;
    -webkit-font-smoothing: antialiased;
}

.report-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 56px; /* Больше воздуха (16-24px дополнительно) для легкости чтения */
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out both;
}

.animate-pulse-subtle {
    animation: pulseSubtle 3s infinite ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseSubtle {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--shadow-lg);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 12px 20px -3px rgba(37, 99, 235, 0.12), 0 8px 12px -4px rgba(37, 99, 235, 0.08);
    }
}

/* Header */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-circle {
    width: 46px;
    height: 46px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.logo {
    width: 26px;
    height: 26px;
}

.logo-meta {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

.logo-subtext {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-title {
    text-align: right;
}

.header-title h1 {
    font-size: 1.6rem;
    margin: 0 0 8px 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.meta-badges {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.meta-badge.company .badge-dot {
    background: var(--success);
}

.meta-badge.date .badge-dot {
    background: var(--primary);
}

/* Marketplace specific badges */
.meta-badge.marketplace.wb {
    color: #e11d48; /* rose-600 */
    border-color: #fecdd3;
    background-color: #fff1f2;
}
.meta-badge.marketplace.wb .badge-dot {
    background-color: #e11d48;
}

.meta-badge.marketplace.ozon {
    color: #2563eb; /* blue-600 */
    border-color: #bfdbfe;
    background-color: #eff6ff;
}
.meta-badge.marketplace.ozon .badge-dot {
    background-color: #2563eb;
}

/* Sections */
.section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

/* 1. KPI Panel */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-border);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-icon {
    font-size: 1.2rem;
}

.kpi-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

.kpi-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* KPI Card Inactive / Placeholder */
.kpi-card.kpi-inactive {
    background: #fafafa;
    border-style: dashed;
    border-color: #cbd5e1;
}

.kpi-card.kpi-inactive:hover {
    border-color: #94a3b8;
}

.kpi-card.kpi-inactive::before {
    background: #94a3b8;
}

.kpi-card.kpi-inactive .kpi-value {
    color: #94a3b8;
    font-weight: 500;
}

.kpi-card.kpi-inactive .kpi-subtitle {
    color: #94a3b8;
}

/* 2. Store Status Banner */
.store-status-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.store-status-banner:hover {
    transform: scale(1.005);
}

.status-badge-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 0.95rem;
    color: var(--text-color);
}

.status-description {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Status variants */
.store-status-banner.status-healthy {
    background-color: var(--success-light);
    border: 1px solid var(--success-border);
}
.store-status-banner.status-warning {
    background-color: var(--warning-light);
    border: 1px solid var(--warning-border);
}
.store-status-banner.status-critical {
    background-color: var(--danger-light);
    border: 1px solid var(--danger-border);
}

/* 3. Today Detected Section */
.summary-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .summary-layout {
        grid-template-columns: 1fr;
    }
}

.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.summary-card-icon {
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-card-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.summary-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Card variants based on alert level */
.summary-card.low-stock-card {
    border-bottom: 4px solid var(--warning);
}
.summary-card.low-stock-card:hover {
    border-color: var(--warning);
    background-color: var(--warning-light);
}
.summary-card.low-stock-card .summary-card-icon {
    background: var(--warning-light);
    color: var(--warning);
}
.summary-card.low-stock-card .summary-card-value {
    color: var(--warning);
}

.summary-card.sales-drop-card {
    border-bottom: 4px solid var(--info);
}
.summary-card.sales-drop-card:hover {
    border-color: var(--info);
    background-color: var(--info-light);
}
.summary-card.sales-drop-card .summary-card-icon {
    background: var(--info-light);
    color: var(--info);
}
.summary-card.sales-drop-card .summary-card-value {
    color: var(--info);
}

.summary-card.no-sales-card {
    border-bottom: 4px solid var(--danger);
}
.summary-card.no-sales-card:hover {
    border-color: var(--danger);
    background-color: var(--danger-light);
}
.summary-card.no-sales-card .summary-card-icon {
    background: var(--danger-light);
    color: var(--danger);
}
.summary-card.no-sales-card .summary-card-value {
    color: var(--danger);
}

/* 4. Sales Leader Card */
.leader-card {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 60%, #ffffff 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 220px;
    border: 1px solid #fde68a;
    position: relative;
    overflow: hidden;
}

.leader-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0) 70%);
    pointer-events: none;
}

.leader-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leader-tag {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}

.leader-icon {
    font-size: 1.3rem;
}

.leader-card-body {
    margin: 16px 0;
}

.leader-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #000000; /* Чёрный цвет для наименования товара */
    margin: 0 0 6px 0;
    line-height: 1.4;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.leader-sku {
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
}

.leader-card-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #fde047;
    padding-top: 14px;
}

.leader-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-lbl {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.leader-card.empty {
    background: var(--bg-color);
    color: var(--text-muted);
    justify-content: center;
    align-items: center;
    border: 2px dashed #cbd5e1;
}

/* 5 & 6. Sales Analytics Layout */
.sales-analytics-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .sales-analytics-layout {
        grid-template-columns: 1fr;
    }
}

.sales-metrics-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sales-metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.sales-metric-card:hover {
    transform: translateX(4px);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
}

.metric-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.metric-card-icon.revenue {
    background: var(--primary-light);
    color: var(--primary);
}
.metric-card-icon.quantity {
    background: var(--success-light);
    color: var(--success);
}
.metric-card-icon.avg-check {
    background: var(--warning-light);
    color: var(--warning);
}

.metric-card-content {
    display: flex;
    flex-direction: column;
}

.metric-card-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.metric-card-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-color);
}

/* Sales Chart Col */
.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
}

.chart-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    padding: 0;
    border-radius: 0;
    text-transform: none;
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
}

/* Top Sales Rating */
.products-list-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-rank-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.product-rank-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
}

.rank-badge.rank-1 {
    background: #fef3c7;
    color: #d97706;
}
.rank-badge.rank-2 {
    background: #e2e8f0;
    color: #475569;
}
.rank-badge.rank-3 {
    background: #ffedd5;
    color: #ea580c;
}
.rank-badge.rank-other {
    background: var(--bg-color);
    color: var(--text-muted);
}

.product-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.product-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 500px;
}

.product-item-revenue {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-color);
}

.product-item-row.sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-item-sku {
    font-weight: 500;
}

.product-item-qty {
    font-weight: 600;
}

/* 7 & 8. Attention Required Subsections */
.subsection {
    margin-bottom: 28px;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.title-indicator.yellow { background-color: var(--warning); }
.title-indicator.red { background-color: var(--danger); }
.title-indicator.blue { background-color: var(--info); }

.attention-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

/* Task-like Ticket Styling */
.attention-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.attention-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Left colored borders and styles */
.attention-card.border-warning {
    border-left: 4px solid var(--warning);
}
.attention-card.border-warning:hover {
    border-color: var(--warning-border) var(--warning-border) var(--warning-border) var(--warning);
}

.attention-card.border-danger {
    border-left: 4px solid var(--danger);
}
.attention-card.border-danger:hover {
    border-color: var(--danger-border) var(--danger-border) var(--danger-border) var(--danger);
}

.attention-card.border-info {
    border-left: 4px solid var(--info);
}
.attention-card.border-info:hover {
    border-color: var(--info-border) var(--info-border) var(--info-border) var(--info);
}

.attention-card-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.attention-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.attention-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.attention-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.attention-sku {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attention-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-color);
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 12px;
}

.attention-stat-row {
    display: flex;
    justify-content: space-between;
}

.stat-label {
    color: var(--text-muted);
}

.attention-card-footer {
    display: flex;
    align-items: center;
}

.recommendation-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

/* 9. Actions section */
.actions-summary-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0 0 16px 0;
}

.actions-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-task-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
}

.action-task-card:hover {
    transform: translateY(-2px);
    border-color: var(--success-border);
    box-shadow: var(--shadow-md);
}

.task-checkbox-container {
    flex-shrink: 0;
}

.task-number {
    width: 28px;
    height: 28px;
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.task-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
}

.task-product-name {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.task-detail {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-status-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Footer Section */
.report-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.report-footer p {
    margin: 4px 0;
}

.report-footer .footer-subline {
    font-size: 0.75rem;
    font-style: italic;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 32px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.empty-state-simple {
    padding: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-color);
    border-radius: var(--radius);
    text-align: center;
    border: 1px dashed var(--border-color);
}



/* Shared report layout: grid children may shrink within a mobile viewport. */
.report-container > *,
.report-container section,
.report-container [class$="-grid"] > *,
.sales-chart-col,
.sales-list-col,
.attention-meta {
    min-width: 0;
}
.demo-report-banner {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius);
    padding: 24px;
}
.demo-report-banner h2 { margin-top: 0; }
@media (max-width: 480px) {
    body { padding: 16px 12px; }
    .report-container { gap: 28px; }
    .report-header { flex-direction: column; align-items: flex-start; }
    .kpi-grid, .attention-cards-grid { grid-template-columns: minmax(0, 1fr); }
    .meta-badge { white-space: normal; overflow-wrap: anywhere; }
    .kpi-value { font-size: clamp(24px, 7vw, 36px); overflow-wrap: anywhere; }
    .demo-report-cta .btn { width: 100%; }
}
