/* Основные стили для приложения "Карта развития ребёнка" */

/* Theme variables */
:root {
    --app-bg: #f3f6fb;
    /* Более деловая палитра */
    --app-sidebar-bg: #1f3a4a;
    --app-sidebar-bg-2: #1a3140;
    --app-sidebar-text: rgba(255, 255, 255, 0.92);
    --app-sidebar-muted: rgba(255, 255, 255, 0.65);
    --app-card-radius: 14px;
    --app-shadow: 0 10px 28px rgba(18, 38, 63, 0.12);
    --app-shadow-soft: 0 6px 18px rgba(18, 38, 63, 0.10);
    --app-border: rgba(15, 23, 42, 0.10);
    --app-accent: #1e4b68;
    --app-accent-2: #2c5f7f;
    --app-tile-radius: 16px;
}

/* Bootstrap palette overrides (уменьшаем «ядовитый» синий) */
:root {
    --bs-primary: #1e4b68;
    --bs-primary-rgb: 30, 75, 104;
    --bs-link-color: #1e4b68;
    --bs-link-hover-color: #173a51;

    /* Более спокойные warning/danger для делового вида */
    --bs-warning: #b26a00;
    --bs-warning-rgb: 178, 106, 0;
    --bs-danger: #9b2c2c;
    --bs-danger-rgb: 155, 44, 44;
}

/* Preserve Bootstrap bg-opacity-* behavior */
.bg-primary {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #173a51;
    --bs-btn-hover-border-color: #173a51;
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #143246;
    --bs-btn-active-border-color: #143246;
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: rgba(30, 75, 104, 0.55);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #173a51;
    --bs-btn-active-border-color: #173a51;
}

.badge.bg-primary {
    background-color: var(--bs-primary) !important;
}

/* Buttons: make warning/danger readable and less яркими */
.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-warning);
    --bs-btn-border-color: var(--bs-warning);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #8f5600;
    --bs-btn-hover-border-color: #8f5600;
    --bs-btn-focus-shadow-rgb: var(--bs-warning-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #744600;
    --bs-btn-active-border-color: #744600;
}

.btn-outline-warning {
    --bs-btn-color: #5c3a00;
    --bs-btn-border-color: rgba(178, 106, 0, 0.45);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-warning);
    --bs-btn-hover-border-color: var(--bs-warning);
    --bs-btn-focus-shadow-rgb: var(--bs-warning-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #8f5600;
    --bs-btn-active-border-color: #8f5600;
}

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bs-danger);
    --bs-btn-border-color: var(--bs-danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #7b2121;
    --bs-btn-hover-border-color: #7b2121;
    --bs-btn-focus-shadow-rgb: var(--bs-danger-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #641b1b;
    --bs-btn-active-border-color: #641b1b;
}

.btn-outline-danger {
    --bs-btn-color: #5a1f1f;
    --bs-btn-border-color: rgba(155, 44, 44, 0.45);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-danger);
    --bs-btn-hover-border-color: var(--bs-danger);
    --bs-btn-focus-shadow-rgb: var(--bs-danger-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #7b2121;
    --bs-btn-active-border-color: #7b2121;
}

.badge.bg-warning {
    background-color: var(--bs-warning) !important;
    color: #fff !important;
}

.badge.bg-danger {
    background-color: var(--bs-danger) !important;
}

body.app-body {
    background: var(--app-bg);
}

/* Layout */
.app-layout {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--app-sidebar-bg), var(--app-sidebar-bg-2));
    color: var(--app-sidebar-text);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1500;
    box-shadow: 14px 0 28px rgba(0, 0, 0, 0.18);
}

.app-sidebar__inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px 18px;
}

.app-brand {
    display: flex;
    gap: 10px;
    align-items: center;
    text-decoration: none;
    color: var(--app-sidebar-text);
}

.app-brand:hover {
    color: #fff;
}

.app-brand__mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.app-brand__logo-wrap {
    flex-shrink: 0;
    padding: 3px 5px;
    border-radius: 10px;
    background: #fff;
    line-height: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-brand__logo-wrap--compact {
    padding: 2px 4px;
    border-radius: 8px;
}

.app-brand__logo {
    height: 42px;
    width: auto;
    display: block;
    object-fit: contain;
}

.app-brand__logo--compact {
    height: 28px;
}

.app-brand__mark i {
    font-size: 1.2rem;
}

.app-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.app-brand__title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.app-brand__subtitle {
    font-size: 0.9rem;
    color: var(--app-sidebar-muted);
}

.app-nav {
    padding: 6px 10px 14px 10px;
    overflow: auto;
    flex: 1;
}

.app-nav__section {
    padding: 12px 10px 6px 10px;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--app-sidebar-muted);
}

.app-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--app-sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    margin: 2px 0;
}

.app-nav__link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    opacity: 0.95;
}

.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(2px);
    color: #fff;
}

.app-nav__link.is-active {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
    color: #fff;
}

.app-sidebar__user {
    padding: 14px 14px 14px 14px;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.app-user {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-user__avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.app-user__avatar i {
    font-size: 1.3rem;
}

.app-user__meta {
    min-width: 0;
    flex: 1;
}

.app-user__name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.12;
}

.app-user__role {
    font-size: 0.78rem;
    color: var(--app-sidebar-muted) !important;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    /* IMPORTANT: do not create a low stacking context for the whole app.
       Otherwise Bootstrap modal backdrop (appended to body) can cover modals
       rendered inside .app-main, leaving only the dark overlay clickable. */
}

.app-content {
    padding: 22px 22px 0 22px;
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.app-footer {
    padding: 16px 22px 18px 22px;
}

.app-footer__inner {
    border-top: 1px solid var(--app-border);
    padding-top: 12px;
}

.app-messages {
    padding: 16px 22px 0 22px;
}

/* Mobile topbar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 2000;
    background: linear-gradient(90deg, var(--app-sidebar-bg), var(--app-sidebar-bg-2));
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    padding: 10px 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

/* Ensure menus overlay tables/cards */
.dropdown-menu {
    z-index: 3000;
}

.table-responsive {
    position: relative;
    z-index: 1;
}

/* Modals must be above everything */
.modal-backdrop {
    z-index: 5900 !important;
}

.modal {
    z-index: 6000 !important;
}

/* Development icons in circles */
.dev-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background-color: rgba(var(--bs-primary-rgb), 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
}

.dev-icon-circle i {
    color: #fff;
    font-size: 1.4em;
}

.app-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

.app-topbar__menu {
    border-radius: 12px;
}

.app-topbar .btn {
    transform: none;
    box-shadow: none;
}

/* Cards */
.card {
    border-radius: var(--app-card-radius);
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: var(--app-shadow-soft);
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--app-shadow);
}

/* Tiles (dashboard-style) */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
}

.tile {
    border-radius: var(--app-tile-radius);
    color: #fff;
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.2rem 1.1rem;
    box-shadow: var(--app-shadow);
    min-height: 108px;
    display: block;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(18, 38, 63, 0.22);
    color: #fff;
}

.tile__content {
    position: relative;
    z-index: 1;
    max-width: 72%;
}

.tile__title {
    font-size: 0.78rem;
    opacity: 0.92;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.tile__value {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.1;
    margin-top: 0.2rem;
}

/* ~¼ площади блока: крупная иконка выходит за край и обрезается */
.tile__icon {
    position: absolute;
    right: -14%;
    bottom: -16%;
    font-size: 5.5rem;
    line-height: 1;
    color: #fff;
    opacity: 0.22;
    transform: scale(1.55);
    transform-origin: 100% 100%;
    pointer-events: none;
    z-index: 0;
}

.tile--teal {
    background: linear-gradient(135deg, #2c5f7f, #1e4b68);
}

.tile--orange {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.tile--green {
    background: linear-gradient(135deg, #15803d, #0f766e);
}

.tile--blue {
    background: linear-gradient(135deg, #1e4b68, #2c5f7f);
}

/* Режим демонстрации (баннер в подвале) */
.app-privacy-banner {
    font-size: 0.8125rem;
    animation: none !important;
    margin-bottom: 0.75rem;
}

.app-privacy-banner .alert-link {
    font-weight: 600;
}

/* Dashboard summary — stat cards with cropped corner icon (~25% visible area) */
.dashboard-stat {
    --stat-accent: var(--bs-primary);
    --stat-accent-rgb: var(--bs-primary-rgb);
    --stat-size: 128px;
    position: relative;
    overflow: hidden;
    container-type: inline-size;
    min-height: var(--stat-size);
    padding: 1.2rem 1.15rem 1.1rem;
    border-radius: var(--app-card-radius);
    border: 1px solid var(--app-border);
    background: linear-gradient(
        152deg,
        #ffffff 0%,
        #ffffff 48%,
        rgba(var(--stat-accent-rgb), 0.11) 100%
    );
    box-shadow: var(--app-shadow-soft);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dashboard-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: var(--app-card-radius) 0 0 var(--app-card-radius);
    background: var(--stat-accent);
}

.dashboard-stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow);
}

.dashboard-stat__content {
    position: relative;
    z-index: 1;
    max-width: 70%;
    text-align: left;
}

.dashboard-stat__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.52);
    margin-bottom: 0.4rem;
}

.dashboard-stat__value {
    font-size: 2.05rem;
    font-weight: 800;
    line-height: 1;
    color: var(--stat-accent);
    letter-spacing: -0.03em;
}

.dashboard-stat__hint {
    font-size: 0.7rem;
    color: rgba(15, 23, 42, 0.48);
    margin-top: 0.4rem;
    line-height: 1.25;
}

/* Иконка ~½ стороны блока + выход за край → видимая часть ≈ ¼ площади */
.dashboard-stat__icon {
    position: absolute;
    right: -14%;
    bottom: -16%;
    font-size: 58cqmin;
    line-height: 1;
    color: var(--stat-accent);
    opacity: 0.2;
    transform: scale(1.55);
    transform-origin: 100% 100%;
    pointer-events: none;
    z-index: 0;
}

.dashboard-stat--primary {
    --stat-accent: #1e4b68;
    --stat-accent-rgb: 30, 75, 104;
}

.dashboard-stat--teal {
    --stat-accent: #0f766e;
    --stat-accent-rgb: 15, 118, 110;
}

.dashboard-stat--indigo {
    --stat-accent: #3730a3;
    --stat-accent-rgb: 55, 48, 163;
}

.dashboard-stat--success {
    --stat-accent: #15803d;
    --stat-accent-rgb: 21, 128, 61;
}

.dashboard-stat--warning {
    --stat-accent: #b26a00;
    --stat-accent-rgb: 178, 106, 0;
}

.dashboard-stat--muted {
    --stat-accent: #64748b;
    --stat-accent-rgb: 100, 116, 139;
}

@supports not (font-size: 1cqmin) {
    .dashboard-stat__icon {
        font-size: 5.5rem;
        right: -14%;
        bottom: -16%;
    }
}

@media (max-width: 576px) {
    .dashboard-stat {
        --stat-size: 112px;
        padding: 1rem 0.95rem;
    }

    .dashboard-stat__value {
        font-size: 1.7rem;
    }

    .dashboard-stat__icon {
        font-size: 4.25rem;
        right: -0.7rem;
        bottom: -0.85rem;
        transform: scale(1.4);
    }

    .tile {
        min-height: 100px;
    }

    .tile__icon {
        font-size: 4.25rem;
        right: -0.55rem;
        bottom: -0.65rem;
        transform: scale(1.35);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .tile-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .app-content {
        padding: 14px 12px 0 12px;
    }
    .app-messages {
        padding: 12px 12px 0 12px;
    }
    .app-footer {
        padding: 14px 12px 16px 12px;
    }
    .tile-grid {
        grid-template-columns: 1fr;
    }
}

/* Анимации для кнопок */
.btn {
    transition: all 0.3s ease;
    border-radius: 0.375rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Анимации для навигации */
.navbar-nav .nav-link {
    transition: all 0.3s ease;
    border-radius: 0.25rem;
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

/* Анимации для карточек */
.card {
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Анимации для форм */
.form-control, .form-select {
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Индикаторы уровней развития */
.level-indicator {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.level-low {
    background-color: #dc3545;
    color: white;
}

.level-basic {
    background-color: #ffc107;
    color: #000;
}

.level-elevated {
    background-color: #198754;
    color: white;
}

.level-high {
    background-color: #0d6efd;
    color: white;
}

/* Анимация для индикаторов */
.level-indicator:hover {
    transform: scale(1.1);
}

/* Радио кнопки для оценки */
.evaluation-radio-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.evaluation-radio-group .btn-check:checked + .btn {
    transform: scale(1.1);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Анимация появления элементов */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Компактный дизайн */
.table-sm {
    font-size: 0.875rem;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
}

/* Стили для загрузки */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Стили для уведомлений */
.alert {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Блоки развития в форме оценки */
.development-block {
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.development-block:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
}

.development-block-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #dee2e6;
}

/* Критерий в форме оценки */
.criterion-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.criterion-item:hover {
    background-color: #e9ecef;
}

.criterion-text {
    font-weight: 500;
    margin-bottom: 0.75rem;
}

/* Итоговые суммы по типам развития */
.development-total {
    padding: 1rem;
    background-color: #f0f0f0;
    border-radius: 0.375rem;
    margin-top: 1rem;
    font-weight: 600;
}

/* Адаптивные таблицы */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Фильтры */
.filter-panel {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

/* Поиск */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-right: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

