/**
 * 📊 Dashboard Styles v2.0
 * Лаконичные карточки с метриками
 * Иерархия и каноны дизайна
 */

/* ===== DASHBOARD CONTAINER ===== */
.dashboard-container {
    width: 100%;
    padding: 24px;
    background: var(--bg-primary);
}

/* ===== HEADER ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.dashboard-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== SECTIONS ===== */
.dashboard-section {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.subsection {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.subsection-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

/* ===== CARDS GRID ===== */
.cards-grid {
    display: grid;
    gap: 16px;
}

.cards-grid.cards-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cards-grid.cards-5 {
    grid-template-columns: repeat(5, 1fr);
}

.cards-grid.cards-6 {
    grid-template-columns: repeat(6, 1fr);
}

.mt-16 {
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 1400px) {
    .cards-grid.cards-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    .cards-grid.cards-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

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

/* ===== METRIC CARD ===== */
.metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: var(--bg-accent);
    border-radius: 10px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

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

.metric-icon {
    font-size: 20px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 6px;
}

.metric-value.small {
    font-size: 18px;
}

.metric-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== CARD TYPES ===== */
.metric-card.primary {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}
.metric-card.primary .metric-value {
    color: var(--primary);
}

.metric-card.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}
.metric-card.success .metric-value {
    color: var(--success);
}

.metric-card.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}
.metric-card.warning .metric-value {
    color: var(--warning);
}

.metric-card.danger {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}
.metric-card.danger .metric-value {
    color: var(--danger);
}

.metric-card.info {
    border-color: var(--info);
    background: rgba(59, 130, 246, 0.1);
}
.metric-card.info .metric-value {
    color: var(--info);
}

.metric-card.muted {
    border-color: var(--border-medium);
    background: var(--bg-accent);
}
.metric-card.muted .metric-value {
    color: var(--text-primary);
}

/* ===== ACTIONS ===== */
.dashboard-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.action-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.primary {
    background: var(--primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--secondary);
}

.action-btn.secondary {
    background: var(--bg-accent);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.action-btn.secondary:hover {
    background: var(--bg-secondary);
}

/* ===== LOADING & ERROR ===== */
.dashboard-loading,
.dashboard-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-secondary);
}

.dashboard-error .error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.dashboard-error h3 {
    color: var(--danger);
    margin-bottom: 8px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* ===== KEY METRICS HIGHLIGHT ===== */
.dashboard-section:first-of-type .metric-card {
    padding: 24px 20px;
}

.dashboard-section:first-of-type .metric-value {
    font-size: 32px;
}

/* Главные KPI крупнее */
.cards-grid.cards-6 .metric-card:first-child,
.cards-grid.cards-4 .metric-card:first-child {
    position: relative;
}

.cards-grid.cards-6 .metric-card:first-child::after,
.cards-grid.cards-4 .metric-card:first-child::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    border: 2px solid currentColor;
    opacity: 0.3;
    pointer-events: none;
}
