/**
 * Виджеты и компоненты UI
 * Переиспользуемые элементы интерфейса
 */

/* ========== СЕЛЕКТОР ПЕРИОДА ========== */

.period-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
}

.period-selector__label {
    font-weight: 500;
    color: #374151;
}

.period-selector__buttons {
    display: flex;
    gap: 0.25rem;
}

.period-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.period-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.period-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
}

.period-selector__hint {
    color: #6b7280;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* ========== БЕЙДЖИ ИСТОЧНИКА ДАННЫХ ========== */

.source-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
    color: white;
}

.source-badge--api {
    background: #10b981;
}

.source-badge--excel {
    background: #6366f1;
}

/* ========== БЕЙДЖИ СТАТУСОВ ========== */

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge--available {
    background: #d1fae5;
    color: #065f46;
}

.status-badge--low {
    background: #fef3c7;
    color: #92400e;
}

.status-badge--critical {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge--transit {
    background: #dbeafe;
    color: #1e40af;
}

/* ========== МОДАЛЬНОЕ ОКНО СИНХРОНИЗАЦИИ ========== */

.sync-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.sync-modal.active {
    display: flex;
}

.sync-modal__content {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.sync-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sync-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.sync-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    line-height: 1;
}

.sync-modal__close:hover {
    color: #374151;
}

/* Прогресс-бар */
.sync-progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.sync-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.sync-status {
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.75rem;
}

.sync-log {
    background: #1f2937;
    color: #e5e7eb;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ========== КОМПАКТНЫЕ КАРТОЧКИ ========== */

.compact-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e8eef5;
}

.compact-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: #1f2937;
}

.compact-card__hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* ========== СТАТИСТИКА В СТРОКУ ========== */

.stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.stats-row__label {
    color: #666;
}

.stats-row__value {
    font-weight: 600;
    color: #374151;
}

.stats-row__value--primary {
    color: #2563eb;
}

.stats-row__value--success {
    color: #10b981;
}

.stats-row__value--warning {
    color: #f59e0b;
}

.stats-row__value--danger {
    color: #ef4444;
}

/* ========== ЦВЕТА ЗНАЧЕНИЙ В ТАБЛИЦАХ ========== */

.value-blue {
    color: #0066cc;
    font-weight: 600;
}

.value-purple {
    color: #7c3aed;
    font-weight: 600;
}

.value-green {
    color: #16a34a;
    font-weight: 600;
}

.value-orange {
    color: #f59e0b;
    font-weight: 600;
}

.value-red {
    color: #ef4444;
    font-weight: 600;
}

/* ========== ИТОГОВЫЕ СТРОКИ ТАБЛИЦ ========== */

.total-row {
    background: #f8fafc;
    font-weight: 600;
    border-top: 2px solid #cbd5e1;
}

.total-row td {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

/* ========== ДИНАМИКА / ТРЕНДЫ ========== */

.trend-up {
    color: #22c55e;
    font-weight: 600;
}

.trend-down {
    color: #ef4444;
    font-weight: 600;
}

.trend-stable {
    color: #6b7280;
}

/* ========== ДНИ ДО КОНЦА ========== */

.days-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
}

.days-badge--critical {
    background-color: #fef3c7;
    color: #000;
}

.days-badge--normal {
    background-color: #d1fae5;
    color: #000;
}

.days-badge--excess {
    background-color: #fee2e2;
    color: #000;
}

/* ========== ИНФОРМАЦИОННЫЕ БЛОКИ ========== */

.info-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.info-block__icon {
    font-size: 1.25rem;
}

.info-block__text {
    font-size: 0.875rem;
    color: #0369a1;
}

/* ========== ВЫПАДАЮЩИЕ ДЕТАЛИ ========== */

.details-toggle {
    cursor: pointer;
    user-select: none;
}

.details-arrow {
    display: inline-block;
    width: 14px;
    color: #0066cc;
    font-size: 0.7rem;
    transition: transform 0.2s;
    margin-right: 0.25rem;
}

.details-arrow.expanded {
    transform: rotate(90deg);
}

/* ========== GRID ДЛЯ КАРТОЧЕК ========== */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ========== КНОПКИ ДЕЙСТВИЙ ========== */

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.compact-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.compact-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

