/* =============================================================================
   МИДА — Модель Имитации Долговременных Адаптаций
   Стили для страниц приложения mida
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Hero section — градиентный баннер (фиолетово-синий, как isometric_science)
   --------------------------------------------------------------------------- */
.mida-hero {
    background: linear-gradient(135deg, #6f42c1 0%, #0d6efd 100%);
    color: #fff;
    padding: 3.5rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.mida-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.mida-hero .subtitle {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 0;
}

.mida-hero .hero-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.85;
}

[data-theme="dark"] .mida-hero {
    background: linear-gradient(135deg, #5a32a3 0%, #0b5ed7 100%);
}

/* ---------------------------------------------------------------------------
   Карточки подсистем (мышечная, эндокринная, иммунная)
   --------------------------------------------------------------------------- */
.subsystem-card {
    border-left: 4px solid #6f42c1;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.subsystem-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.subsystem-card .subsystem-icon {
    font-size: 2.25rem;
    color: #6f42c1;
    margin-bottom: 0.75rem;
}

.subsystem-card.card-endocrine {
    border-left-color: #0d6efd;
}

.subsystem-card.card-endocrine .subsystem-icon {
    color: #0d6efd;
}

.subsystem-card.card-immune {
    border-left-color: #198754;
}

.subsystem-card.card-immune .subsystem-icon {
    color: #198754;
}

[data-theme="dark"] .subsystem-card {
    border-left-color: #9b59b6;
}

[data-theme="dark"] .subsystem-card.card-endocrine {
    border-left-color: #3d8bfd;
}

[data-theme="dark"] .subsystem-card.card-immune {
    border-left-color: #1abc9c;
}

/* ---------------------------------------------------------------------------
   Пресет-карточки
   --------------------------------------------------------------------------- */
.preset-card {
    border-left: 4px solid #0d6efd;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.preset-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.375rem 0.75rem rgba(0, 0, 0, 0.1);
}

.preset-card .card-body {
    display: flex;
    flex-direction: column;
}

.preset-card .preset-description {
    flex-grow: 1;
    font-size: 0.875rem;
}

.preset-card .card-footer {
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .preset-card {
    border-left-color: #3d8bfd;
}

[data-theme="dark"] .preset-card .card-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* ---------------------------------------------------------------------------
   Форма симуляции — строки упражнений
   --------------------------------------------------------------------------- */
.exercise-row {
    background-color: var(--bs-gray-100, #f8f9fa);
    border: 1px solid var(--bs-gray-300, #dee2e6);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: background-color 0.15s, border-color 0.15s;
}

.exercise-row:hover {
    border-color: var(--bs-gray-400, #ced4da);
}

[data-theme="dark"] .exercise-row {
    background-color: var(--bs-gray-800, #343a40);
    border-color: var(--bs-gray-700, #495057);
}

[data-theme="dark"] .exercise-row:hover {
    border-color: var(--bs-gray-600, #6c757d);
}

.exercise-row .exercise-number {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #6f42c1;
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.exercise-row .form-control,
.exercise-row .form-select {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

.exercise-row input[type="number"] {
    width: 100%;
    min-width: 60px;
}

.exercise-row .exercise-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-gray-600, #6c757d);
    margin-bottom: 0.25rem;
}

[data-theme="dark"] .exercise-row .exercise-label {
    color: var(--bs-gray-400, #adb5bd);
}

/* ---------------------------------------------------------------------------
   Сводные карточки результатов (МФ%, МХ%, MG%)
   --------------------------------------------------------------------------- */
.summary-card {
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s;
    height: 100%;
}

.summary-card:hover {
    transform: translateY(-2px);
}

.summary-card .summary-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-card .summary-label {
    font-size: 0.875rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.summary-card.summary-positive {
    background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
    color: #0f5132;
    border: 1px solid #badbcc;
}

.summary-card.summary-negative {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c2c7 100%);
    color: #842029;
    border: 1px solid #f5c2c7;
}

.summary-card.summary-neutral {
    background: linear-gradient(135deg, #e2e3e5 0%, #d3d6d8 100%);
    color: #41464b;
    border: 1px solid #d3d6d8;
}

[data-theme="dark"] .summary-card.summary-positive {
    background: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    color: #d1e7dd;
    border-color: #198754;
}

[data-theme="dark"] .summary-card.summary-negative {
    background: linear-gradient(135deg, #842029 0%, #dc3545 100%);
    color: #f8d7da;
    border-color: #dc3545;
}

[data-theme="dark"] .summary-card.summary-neutral {
    background: linear-gradient(135deg, #41464b 0%, #6c757d 100%);
    color: #e2e3e5;
    border-color: #6c757d;
}

/* ---------------------------------------------------------------------------
   Графики — размер canvas
   --------------------------------------------------------------------------- */
.chart-container {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
}

.chart-container canvas {
    max-height: 400px;
    width: 100% !important;
}

.chart-container.chart-small canvas {
    max-height: 280px;
}

/* ---------------------------------------------------------------------------
   Таблица результатов
   --------------------------------------------------------------------------- */
.results-table {
    font-size: 0.875rem;
}

.results-table thead th {
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle;
}

.results-table tbody td {
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   План тренировок — бейджи дней
   --------------------------------------------------------------------------- */
.training-day-card {
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.training-day-card .day-header {
    font-weight: 600;
    font-size: 0.9rem;
}

.training-day-card .exercise-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    margin: 0.15rem;
}

.training-day-card .exercise-badge.badge-hold {
    background-color: #e8daef;
    color: #6f42c1;
    border: 1px solid #d5bde5;
}

.training-day-card .exercise-badge.badge-rest {
    background-color: #e2e3e5;
    color: #6c757d;
    border: 1px solid #ced4da;
}

[data-theme="dark"] .training-day-card .exercise-badge.badge-hold {
    background-color: rgba(111, 66, 193, 0.2);
    color: #c5a3e0;
    border-color: rgba(111, 66, 193, 0.4);
}

[data-theme="dark"] .training-day-card .exercise-badge.badge-rest {
    background-color: rgba(108, 117, 125, 0.2);
    color: #adb5bd;
    border-color: rgba(108, 117, 125, 0.4);
}

/* ---------------------------------------------------------------------------
   Секция «Импорт из планировщика»
   --------------------------------------------------------------------------- */
.import-card {
    border-left: 4px solid #fd7e14;
    transition: transform 0.2s;
}

.import-card:hover {
    transform: translateY(-2px);
}

[data-theme="dark"] .import-card {
    border-left-color: #e67e22;
}

/* ---------------------------------------------------------------------------
   Загрузочный оверлей (во время симуляции)
   --------------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay .loading-content {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 360px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .loading-overlay .loading-content {
    background: #212529;
    color: #f8f9fa;
}

.loading-overlay .loading-spinner {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

.loading-overlay .loading-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.loading-overlay .loading-subtext {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Шаги формы (визуальный прогресс)
   --------------------------------------------------------------------------- */
.form-step {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bs-gray-200, #e9ecef);
}

.form-step:last-child {
    border-bottom: none;
}

.form-step .step-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #6f42c1 0%, #0d6efd 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Время тренировки (превью)
   --------------------------------------------------------------------------- */
.workout-time-preview {
    background-color: var(--bs-gray-100, #f8f9fa);
    border: 1px solid var(--bs-gray-300, #dee2e6);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.workout-time-preview .time-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0d6efd;
}

.workout-time-preview .time-label {
    font-size: 0.8rem;
    color: var(--bs-gray-600, #6c757d);
}

[data-theme="dark"] .workout-time-preview {
    background-color: var(--bs-gray-800, #343a40);
    border-color: var(--bs-gray-700, #495057);
}

[data-theme="dark"] .workout-time-preview .time-value {
    color: #3d8bfd;
}

/* ---------------------------------------------------------------------------
   Список симуляций — таблица
   --------------------------------------------------------------------------- */
.sim-list-table .sim-name {
    font-weight: 600;
}

.sim-list-table .sim-change-positive {
    color: #198754;
    font-weight: 600;
}

.sim-list-table .sim-change-negative {
    color: #dc3545;
    font-weight: 600;
}

[data-theme="dark"] .sim-list-table .sim-change-positive {
    color: #2ecc71;
}

[data-theme="dark"] .sim-list-table .sim-change-negative {
    color: #e74c3c;
}

/* ---------------------------------------------------------------------------
   Утилиты
   --------------------------------------------------------------------------- */
.text-gradient {
    background: linear-gradient(135deg, #6f42c1 0%, #0d6efd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.border-gradient {
    border-image: linear-gradient(135deg, #6f42c1 0%, #0d6efd 100%) 1;
}
