/* ==== БАЗОВЫЕ СТИЛИ ==== */
.body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white !important;
    min-height: 100vh;
    line-height: 1.6;
}

/* Фикс для футера */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
  flex: 1; /* занимает всё доступное пространство */
}

.container.my-5 {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    position: relative;
    bottom: 0;
    width: 100%;
    text-align: center;
    padding: 20px 0;
    margin-top: auto; /* важно для прижатия к низу */
}

/* Градиенты и цвета */
.gradient-bg {
    background: linear-gradient(135deg, #6A0DAD 0%, #8A2BE2 100%) !important;
}

.btn-gradient {
    background: linear-gradient(135deg, #8A2BE2 0%, #00BFFF 100%);
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #00BFFF 0%, #8A2BE2 100%);
    color: white;
    transform: translateY(-2px);
}

.text-primary {
    color: #6A0DAD !important;
}

.text-secondary {
    color: #7f8c8d !important;
}

/* ==== ОТЗЫВЧИВЫЕ ИЗОБРАЖЕНИЯ ==== */
.profile-img {
    width: 100%;
    max-width: 250px;
    height: auto;
    aspect-ratio: 5/6;
    object-fit: cover;
    border: 4px solid #8A2BE2;
    box-shadow: 0 8px 25px rgba(138, 43, 226, 0.3);
}

/* Изображения проектов */
.project-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-bottom: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

.project-card:hover img {
    transform: scale(1.05);
}

/* Responsive images */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* ==== АДАПТИВНЫЕ ФОРМЫ ==== */
.form-control {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    font-size: inherit;
    width: 100%;
}

.form-control:focus {
    border-color: #8A2BE2;
    box-shadow: 0 0 0 0.2rem rgba(138, 43, 226, 0.25);
}

.form-label {
    font-weight: 500;
    color: #6A0DAD;
    margin-bottom: 0.5rem;
    display: block;
}

/* Группы форм */
.form-group {
    margin-bottom: 1rem;
}

/* Адаптивные текстовые области */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ==== АДАПТИВНЫЕ ТАБЛИЦЫ ==== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.responsive-table th,
.responsive-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.responsive-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #6A0DAD;
}

/* ==== МАСШТАБИРУЕМЫЕ ЭЛЕМЕНТЫ ==== */
.scalable-element {
    transition: all 0.3s ease;
}

.scalable-element:hover {
    transform: scale(1.02);
}

/* Кнопки */
.btn {
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Карточки */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Навыки */
.skill-item {
    margin-bottom: 1.5rem;
}

.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    height: 12px;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Навигация */
.navbar-nav .nav-link {
    color: white !important;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Фильтры проектов */
.btn-outline-primary {
    border-color: #6A0DAD;
    color: #6A0DAD;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    background-color: #6A0DAD;
    border-color: #6A0DAD;
    color: white;
    transform: translateY(-1px);
}

/* Бейджи */
.badge.bg-primary {
    background: linear-gradient(135deg, #8A2BE2 0%, #00BFFF 100%) !important;
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

/* Стили для дневника */
.progress-item {
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.progress-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.progress-item:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.course-progress {
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

.course-progress:hover {
    transform: translateX(5px);
}

/* Иконки статусов */
.bi-check-circle-fill.text-success {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.bi-check-circle-fill.text-success:hover {
    transform: scale(1.2);
}

.bi-clock.text-warning {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.bi-clock.text-warning:hover {
    transform: scale(1.2);
}

/* Контактная информация */
.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 8px;
}

.contact-info p:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.contact-info .bi {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.contact-info p:hover .bi {
    transform: scale(1.2);
}

/* ==== СТИЛИ ДЛЯ ДОСТУПНОСТИ ==== */

/* Индикатор фокуса */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 3px solid #8A2BE2;
    outline-offset: 2px;
}

/* Состояния для скринридеров */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Контраст для текста */
.text-primary {
    color: #6A0DAD !important;
}

.text-secondary {
    color: #5a6268 !important; /* Улучшенный контраст */
}

/* Состояния форм */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Индикаторы обязательных полей */
.text-danger {
    color: #dc3545 !important;
}

/* Улучшение контраста для ссылок */
a {
    color: #6A0DAD;
    text-decoration: underline;
}

a:hover {
    color: #4a0a8a;
}

/* Доступные иконки */
.bi[aria-hidden="true"] {
    pointer-events: none;
}

/* Живые регионы */
[aria-live] {
    pointer-events: none;
}

/* Состояния навигации */
.navbar-nav .nav-link:focus {
    background-color: rgba(255, 255, 255, 0.3);
    outline: 2px solid white;
}

/* Улучшение видимости фокуса для кнопок */
.btn:focus:not(:focus-visible) {
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid #8A2BE2;
    outline-offset: 2px;
}

/* Адаптация для высококонтрастного режима */
@media (prefers-contrast: high) {
    .btn-gradient {
        border: 2px solid white;
    }
    
    .card {
        border: 1px solid #6A0DAD;
    }
}

/* Поддержка reduced-motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scalable-element:hover {
        transform: none !important;
    }
}

/* ===== АДАПТИВНОСТЬ ===== */

/* Большие планшеты и маленькие десктопы */
@media (max-width: 1199.98px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .profile-img {
        max-width: 220px;
    }
    
    .project-card img {
        aspect-ratio: 4/3;
    }
}

/* Планшеты */
@media (max-width: 991.98px) {
    .container.my-5 {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
    
    .display-4 {
        font-size: 2.2rem;
    }
    
    h1, .h1 {
        font-size: 1.8rem;
    }
    
    h2, .h2 {
        font-size: 1.6rem;
    }
    
    .profile-img {
        max-width: 200px;
        margin-bottom: 1.5rem;
    }
    
    /* Адаптивные формы для планшетов */
    .form-control {
        padding: 0.875rem;
        font-size: 16px; /* Убираем zoom на iOS */
    }
    
    /* Адаптивные таблицы */
    .responsive-table {
        font-size: 0.9rem;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 0.5rem;
    }
    
    /* Навигация для планшетов */
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        margin: 0.5rem 0;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    /* Карточки проектов */
    .project-card .card-body {
        padding: 1.5rem !important;
    }
    
    .project-card img {
        aspect-ratio: 3/2;
    }
}

/* Мобильные устройства (ландшафт) */
@media (max-width: 767.98px) {
    body {
        font-size: 0.95rem;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .display-4 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    h1, .h1 {
        font-size: 1.6rem;
    }
    
    h2, .h2 {
        font-size: 1.4rem;
        margin-bottom: 1.5rem;
    }
    
    .profile-img {
        max-width: 180px;
    }
    
    /* Адаптивные формы для мобильных */
    .form-control {
        padding: 0.75rem;
        font-size: 16px;
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    /* Адаптивные таблицы - вертикальный скролл */
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 8px;
    }
    
    .responsive-table {
        min-width: 600px; /* Принудительный горизонтальный скролл */
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Шапка */
    header.py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* Навигация */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Кнопки */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }
    
    .btn-group .btn {
        width: auto;
    }
    
    /* Карточки */
    .card-body {
        padding: 1.25rem;
    }
    
    .project-card .card-body {
        padding: 1rem !important;
    }
    
    .project-card img {
        aspect-ratio: 16/9;
        height: 180px;
    }
    
    /* Прогресс-бары */
    .progress {
        height: 10px;
    }
    
    /* Контактная информация */
    .contact-info p {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    /* Фильтры проектов */
    .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Маленькие мобильные устройства */
@media (max-width: 575.98px) {
    body {
        font-size: 0.9rem;
    }
    
    .container.my-5 {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    h1, .h1 {
        font-size: 1.4rem;
    }
    
    h2, .h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .profile-img {
        max-width: 150px;
    }
    
    /* Адаптивные формы для маленьких экранов */
    .form-control {
        padding: 0.625rem;
        font-size: 16px;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    /* Адаптивные таблицы */
    .responsive-table {
        min-width: 500px;
        font-size: 0.8rem;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 0.375rem 0.5rem;
    }
    
    /* Шапка */
    header.py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    .display-4.mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Навигация */
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Кнопки */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        width: auto;
    }
    
    /* Сетки */
    .row.g-4 {
        gap: 1rem !important;
    }
    
    .col-md-6, .col-lg-6 {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* Карточки */
    .card-body {
        padding: 1rem;
    }
    
    .project-card .card-body {
        padding: 0.75rem !important;
    }
    
    .project-card img {
        height: 160px;
    }
    
    /* Прогресс-бары */
    .progress {
        height: 8px;
    }
    
    /* Иконки */
    .bi {
        font-size: 0.9em;
    }
    
    /* Записи прогресса */
    .progress-item {
        padding: 0.5rem;
    }
    
    .progress-item .fw-medium {
        font-size: 0.9rem;
    }
    
    /* Футер */
    footer.py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* Очень маленькие устройства */
@media (max-width: 375px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .profile-img {
        max-width: 130px;
    }
    
    .display-4 {
        font-size: 1.5rem;
    }
    
    h1, .h1 {
        font-size: 1.3rem;
    }
    
    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .navbar-toggler {
        font-size: 0.8rem;
    }
    
    .project-card img {
        height: 140px;
    }
    
    .responsive-table {
        min-width: 400px;
        font-size: 0.75rem;
    }
}

/* Высокие экраны */
@media (min-height: 800px) and (max-width: 767.98px) {
    .container.my-5 {
        margin-top: 3rem !important;
        margin-bottom: 3rem !important;
    }
}

/* Печать */
@media print {
    .navbar,
    .btn,
    footer {
        display: none !important;
    }
    
    .container {
        max-width: none;
    }
    
    body {
        background: white !important;
        font-size: 12pt;
    }
    
    .project-card img {
        max-width: 200px !important;
    }
}

/* Предотвращение масштабирования на iOS */
@supports (-webkit-touch-callout: none) {
    .form-control {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
}

/* Поддержка темной темы */
@media (prefers-color-scheme: dark) {
    .body {
        background: #1a1a1a !important;
        color: #ffffff;
    }
    
    .card {
        background: #2d2d2d;
        color: #ffffff;
    }
    
    .form-control {
        background: #2d2d2d;
        border-color: #444;
        color: #ffffff;
    }
    
    .form-control:focus {
        background: #2d2d2d;
        color: #ffffff;
    }
}

/* ===== ПОЛНАЯ ПОДДЕРЖКА ТЕМНОЙ ТЕМЫ ===== */
@media (prefers-color-scheme: dark) {
    .body {
        background: #1a1a1a !important;
        color: #e0e0e0 !important;
    }
    
    /* Карточки */
    .card {
        background: #2d2d2d !important;
        color: #e0e0e0 !important;
        border: 1px solid #444 !important;
    }
    
    /* Формы */
    .form-control {
        background: #2d2d2d !important;
        border-color: #555 !important;
        color: #e0e0e0 !important;
    }
    
    .form-control:focus {
        background: #2d2d2d !important;
        border-color: #8A2BE2 !important;
        color: #e0e0e0 !important;
        box-shadow: 0 0 0 0.2rem rgba(138, 43, 226, 0.25) !important;
    }
    
    .form-label {
        color: #b19cd9 !important;
    }
    
    /* Тексты */
    .text-primary {
        color: #b19cd9 !important;
    }
    
    .text-secondary {
        color: #a0a0a0 !important;
    }
    
    .text-muted {
        color: #888 !important;
    }
    
    /* Прогресс-бары */
    .progress {
        background-color: #444 !important;
    }
    
    /* Таблицы */
    .responsive-table th {
        background-color: #333 !important;
        color: #b19cd9 !important;
    }
    
    .responsive-table td {
        background-color: #2d2d2d !important;
        color: #e0e0e0 !important;
        border-bottom-color: #444 !important;
    }
    
    .responsive-table {
        color: #e0e0e0 !important;
    }
    
    /* Кнопки outline */
    .btn-outline-primary {
        border-color: #b19cd9 !important;
        color: #b19cd9 !important;
    }
    
    .btn-outline-primary:hover,
    .btn-outline-primary.active {
        background-color: #b19cd9 !important;
        border-color: #b19cd9 !important;
        color: #1a1a1a !important;
    }
    
    /* Ховер-эффекты */
    .progress-item:hover {
        background-color: #333 !important;
    }
    
    .contact-info p:hover {
        background-color: #333 !important;
    }
    
    /* Alert */
    .alert-info {
        background-color: #2a3b4d !important;
        border-color: #355d80 !important;
        color: #b8d4f0 !important;
    }
    
    /* Ссылки */
    a {
        color: #b19cd9 !important;
    }
    
    a:hover {
        color: #d4c2f0 !important;
    }
    
    /* Badges */
    .badge.bg-primary {
        background: linear-gradient(135deg, #8A2BE2 0%, #00BFFF 100%) !important;
        color: white !important;
    }
    
    /* Убираем белые фоны */
    .bg-white {
        background-color: #2d2d2d !important;
    }
    
    /* Тени для лучшей читаемости */
    .shadow-sm {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    }
    
    .card:hover {
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4) !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Исправление цвета текста в полях ввода */
    .form-control {
        color: #e0e0e0 !important;
    }
    
    .form-control::placeholder {
        color: #888 !important;
    }
    
    textarea.form-control {
        color: #e0e0e0 !important;
    }
}