/* Flex-контейнер для верхней шапки */
.topbar-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 45%;
    margin: 0 auto;
    padding: 0 10%;
}
.lang-select-top {
    min-width: 120px;
    margin-left: 30px;
}
.lang-select-top select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 1em;
}
/* Фиксированное вертикальное меню слева */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 180px;
    height: 100vh;
    background: #222;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 30px 0 0 0;
    z-index: 1100;
    box-shadow: 2px 0 8px #0002;
    align-items: stretch;
}

/* Счетчик статистики в боковой панели - скрывается на мобильных */
.sidebar-counter {
    width: 75%;
    margin: 0 auto;
    text-align: center;
    color: #bbb;
    font-size: 0.98em;
    letter-spacing: 0.5px;
    padding: 12px 0 10px 0;
    opacity: 0.85;
    background: none;
    border-top: 1px solid #333;
    margin-top: 10px;
    position: absolute;
    bottom: 47px; /* выравниваем с footer */
    left: 0;
    right: 0;
}
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    margin-left: 0;
}
.sidebar nav a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 24px;
    width: 90%;
    box-sizing: border-box;
    border-radius: 0 16px 16px 0;
    transition: background 0.2s;
}
.sidebar nav a:hover {
    background: #444;
}
/* Ширина выпадающего меню выбора языка в левой панели */
/* Ширина выпадающего меню выбора языка в левой панели */

/* Скрываем боковую панель на мобильных устройствах */
@media (max-width: 768px) {
    .sidebar {
        display: none !important; /* полностью скрываем боковую панель */
    }
    
    /* Скрываем счетчик статистики на мобильных устройствах */
    .sidebar-counter {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important; /* убираем отступ слева */
        margin-right: 0 !important; /* убираем отступ справа */
        max-width: 100% !important; /* используем всю ширину */
        margin-top: 20px !important; /* уменьшаем отступ сверху */
        padding: 20px !important; /* уменьшаем внутренние отступы */
    }
    
    /* Делаем header полной ширины */
    header {
        padding-left: 0 !important;
        width: 100% !important;
        padding: 15px 0 !important; /* уменьшаем вертикальные отступы */
    }
    
    /* Адаптация верхней навигации для мобильных */
    .topbar-flex {
        max-width: 100% !important;
        padding: 0 15px !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    /* Навигационные ссылки в горизонтальный ряд */
    .topbar-flex nav,
    header nav {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important; /* прокрутка если не помещается */
        gap: 0 !important;
        margin: 0 !important;
    }
    
    .topbar-flex nav a,
    header nav a {
        margin: 0 8px !important; /* уменьшаем отступы между ссылками */
        font-size: 0.9em !important;
        white-space: nowrap !important; /* предотвращаем перенос строк */
        padding: 5px 8px !important;
        border-radius: 3px !important;
        display: inline-block !important;
    }
    
    /* Кнопка выбора языка - уменьшаем на 30% */
    .lang-select-top {
        min-width: 84px !important; /* 120px - 30% = 84px */
        margin-left: 15px !important; /* уменьшаем отступ */
        flex-shrink: 0 !important; /* не сжимаем */
    }
    
    .lang-select-top select {
        padding: 4px 7px !important; /* уменьшаем внутренние отступы на 30% */
        font-size: 0.85em !important; /* уменьшаем шрифт */
        min-width: 70px !important;
        border-radius: 3px !important;
    }
    
    /* Корректируем footer */
    footer {
        padding-left: 0 !important;
        width: 100% !important;
    }
}

/* Для планшетов - применяем те же стили что и для мобильных */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        display: none !important; /* полностью скрываем боковую панель */
    }
    
    /* Скрываем счетчик статистики на планшетах */
    .sidebar-counter {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important; /* убираем отступ слева */
        margin-right: 0 !important; /* убираем отступ справа */
        max-width: 100% !important; /* используем всю ширину */
        margin-top: 20px !important; /* уменьшаем отступ сверху */
        padding: 20px !important; /* уменьшаем внутренние отступы */
    }
    
    /* Делаем header полной ширины */
    header {
        padding-left: 0 !important;
        width: 100% !important;
        padding: 15px 0 !important; /* уменьшаем вертикальные отступы */
    }
    
    /* Адаптация верхней навигации для планшетов */
    .topbar-flex {
        max-width: 100% !important;
        padding: 0 15px !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    /* Навигационные ссылки в горизонтальный ряд */
    .topbar-flex nav,
    header nav {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important; /* прокрутка если не помещается */
        gap: 0 !important;
        margin: 0 !important;
    }
    
    .topbar-flex nav a,
    header nav a {
        margin: 0 8px !important; /* уменьшаем отступы между ссылками */
        font-size: 0.9em !important;
        white-space: nowrap !important; /* предотвращаем перенос строк */
        padding: 5px 8px !important;
        border-radius: 3px !important;
        display: inline-block !important;
    }
    
    /* Кнопка выбора языка */
    .lang-select-top {
        min-width: 84px !important;
        margin-left: 15px !important;
        flex-shrink: 0 !important;
    }
    
    .lang-select-top select {
        padding: 4px 7px !important;
        font-size: 0.85em !important;
        min-width: 70px !important;
        border-radius: 3px !important;
    }
    
    /* Корректируем footer */
    footer {
        padding-left: 0 !important;
        width: 100% !important;
    }
    
    /* Адаптация слайдера для планшетов */
    .slider-container {
        margin-bottom: 20px;
        gap: 5px;
    }
    
    .slider {
        max-width: 100vw;
        margin: 0;
    }
    
    .slider-arrow {
        width: 32px;
        height: 32px;
        font-size: 1.2em;
    }
    
    /* Адаптация описания фото */
    .photo-description {
        max-width: 100vw;
        margin: 10px 0 0 0;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Верхний заголовок */
    h2 {
        font-size: 1.5em;
        margin-bottom: 15px;
        text-align: center;
    }
    
    /* Формы */
    form {
        max-width: 100%;
    }
    
    input, textarea, button {
        font-size: 16px; /* предотвращает зум на iOS */
    }
    
    /* Модальное окно на планшетах */
    #photoModal {
        display: none !important;
    }
    
    /* Только когда модальное окно открыто через JavaScript */
    #photoModal.modal-open {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 9999 !important;
        background: rgba(0,0,0,0.9) !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    #photoModal > div {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #photoModal img {
        max-width: 95vw !important;
        max-height: 85vh !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    /* Описание фото - скрываем на планшетах для экономии места */
    #photoModal #modalDescription {
        display: none !important;
    }
    
    /* Навигация внизу экрана */
    #photoModal > div > div:last-child {
        position: absolute !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 15px !important;
    }
    
    /* Кнопки навигации */
    #photoModal button {
        padding: 12px 18px !important;
        font-size: 14px !important;
        border-radius: 20px !important;
        background: rgba(0,0,0,0.7) !important;
        color: #fff !important;
        border: 1px solid rgba(255,255,255,0.3) !important;
        cursor: pointer !important;
    }
    
    /* Счетчик фото */
    #photoModal #modalCounter {
        background: rgba(0,0,0,0.7) !important;
        padding: 8px 12px !important;
        border-radius: 15px !important;
        font-size: 14px !important;
        color: #fff !important;
    }
    
    /* Кнопка закрытия */
    #photoModal > div > span {
        position: absolute !important;
        top: 20px !important;
        right: 20px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 28px !important;
        background: none !important;
        z-index: 10000 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 0 !important;
        color: rgba(255,255,255,0.7) !important;
        border: none !important;
        font-weight: normal !important;
        opacity: 0.7 !important;
        transition: opacity 0.3s ease !important;
    }
    
    /* При наведении делаем чуть более заметной */
    #photoModal > div > span:hover {
        opacity: 1 !important;
        color: rgba(255,255,255,0.9) !important;
    }
}

main {
    max-width: 900px;
    margin: 90px auto 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Тень для изображений на странице 'Обо мне' */
#about .responsive-img {
    width: 30%;
    height: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.18);
    border-radius: 14px;
    background: #fff;
}
.slide img,
.slide-img {
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.18);
    border-radius: 14px;
    background: #fff;
    max-width: 100%;
    max-height: 100%; /* используем 100% высоты слайда */
    width: auto;
    height: auto;
    object-fit: contain; /* сохраняем пропорции и помещаем максимально в контейнер */
}
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0 0 80px 0; /* отступ снизу для footer */
    background: #f4f4f4;
    color: #222;
    -webkit-user-select: none; /* запрет выделения для WebKit браузеров */
    -moz-user-select: none; /* запрет выделения для Firefox */
    -ms-user-select: none; /* запрет выделения для Internet Explorer */
    user-select: none; /* стандартное CSS свойство */
}
header {
    background: #222;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    -webkit-user-select: none; /* запрет выделения для WebKit браузеров */
    -moz-user-select: none; /* запрет выделения для Firefox */
    -ms-user-select: none; /* запрет выделения для Internet Explorer */
    user-select: none; /* стандартное CSS свойство */
}
nav a {
    color: #fff;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
}
nav a:hover {
    text-decoration: underline;
}

/* Слайдер */
.slider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}
.slider {
    position: relative;
    width: 100%;
    max-width: 90vw;
    aspect-ratio: 25/18;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    background: #eee;
    padding-bottom: 40px; /* увеличиваем подложку вниз на 40px */
}
.slide {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition: opacity var(--slider-speed, 500ms) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px; /* небольшой отступ от краев подложки */
    box-sizing: border-box;
}
.slide.active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

/* Можно менять скорость анимации через переменную ниже */
:root {
    --slider-speed: 500ms;
}

/* Подложка для описания фото */
.photo-description {
    background: #f8f8f8;
    padding: 15px 20px;
    margin: 10px auto 0 auto;
    max-width: 90vw;
    text-align: center;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    color: #333;
    font-size: 16px;
    line-height: 1.4;
    position: relative;
    -webkit-user-select: none; /* запрет выделения для WebKit браузеров */
    -moz-user-select: none; /* запрет выделения для Firefox */
    -ms-user-select: none; /* запрет выделения для Internet Explorer */
    user-select: none; /* стандартное CSS свойство */
}

.description-text {
    display: none;
    opacity: 0;
    transition: opacity 300ms ease;
    -webkit-user-select: none; /* запрет выделения для WebKit браузеров */
    -moz-user-select: none; /* запрет выделения для Firefox */
    -ms-user-select: none; /* запрет выделения для Internet Explorer */
    user-select: none; /* стандартное CSS свойство */
}

.description-text.active {
    display: block;
    opacity: 1;
}

.slider-arrow {
    background: #222;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    user-select: none;
}
.slider-arrow:hover {
    background: #444;
}
section {
    margin-bottom: 40px;
}
form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%; /* Увеличиваем максимальную ширину формы в два раза */
}
input, textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    -webkit-user-select: text; /* разрешаем выделение в полях ввода */
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

textarea {
    min-height: 200px; /* Увеличиваем высоту в два раза */
    width: 100%; /* Используем всю доступную ширину формы */
    resize: both; /* Разрешаем изменение размера в обе стороны */
    font-family: inherit; /* Наследуем шрифт от родителя */
    box-sizing: border-box; /* Включаем padding в общий размер */
}
button {
    background: #222;
    color: #fff;
    border: none;
    padding: 10px 0;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
button:hover {
    background: #444;
}
footer {
    text-align: center;
    padding: 0.8% 0;
    background: #222;
    color: #fff;
    position: fixed;
    width: 100%;
    bottom: 0;
    z-index: 1000; /* добавляем z-index выше слайдов */
}

/* Стили для админ панели загрузки */
.upload-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    transition: background-color 0.3s ease;
}

.upload-form.drag-over {
    background: #e9ecef;
    border: 2px dashed #007bff;
}

.image-preview {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    text-align: center;
    transition: border-color 0.3s ease;
}

.image-preview:hover {
    border-color: #007bff;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.photo-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

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

.photo-thumbnail {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

.description-edit-form {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Стили для уведомлений */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Стили для админ-секции в навигации */
.admin-nav-section {
    border-top: 1px solid #444;
    margin-top: 15px;
    padding-top: 15px;
}

.admin-nav-section a {
    color: #ffa500 !important;
    font-weight: 500;
    font-size: 0.9em;
    margin-bottom: 8px;
    padding: 6px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.admin-nav-section a:hover {
    color: #ffcc66 !important;
    background: rgba(255, 165, 0, 0.1);
}

.admin-nav-section a:first-child {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 12px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.admin-logout {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #444;
    font-size: 0.85em !important;
    color: #ff6b6b !important;
}

.admin-logout:hover {
    color: #ff9999 !important;
    background: rgba(255, 107, 107, 0.1);
}

/* Дополнительная мобильная адаптация */
@media (max-width: 768px) {
    /* Адаптация слайдера для мобильных */
    .slider-container {
        margin-bottom: 20px;
        gap: 5px;
    }
    
    .slider {
        max-width: 100vw;
        margin: 0;
    }
    
    .slider-arrow {
        width: 32px;
        height: 32px;
        font-size: 1.2em;
    }
    
    /* Адаптация описания фото */
    .photo-description {
        max-width: 100vw;
        margin: 10px 0 0 0;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Верхний заголовок */
    h2 {
        font-size: 1.5em;
        margin-bottom: 15px;
        text-align: center;
    }
    
    /* Формы */
    form {
        max-width: 100%;
    }
    
    input, textarea, button {
        font-size: 16px; /* предотвращает зум на iOS */
    }
    
    /* Модальное окно на мобильных - убираем автоматическое открытие */
    #photoModal {
        display: none !important;
    }
    
    /* Только когда модальное окно открыто через JavaScript */
    #photoModal.modal-open {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 9999 !important;
        background: rgba(0,0,0,0.9) !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    #photoModal > div {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #photoModal img {
        max-width: 95vw !important;
        max-height: 85vh !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    /* Описание фото - скрываем на мобильных для экономии места */
    #photoModal #modalDescription {
        display: none !important;
    }
    
    /* Навигация внизу экрана */
    #photoModal > div > div:last-child {
        position: absolute !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 15px !important;
    }
    
    /* Кнопки навигации */
    #photoModal button {
        padding: 12px 18px !important;
        font-size: 14px !important;
        border-radius: 20px !important;
        background: rgba(0,0,0,0.7) !important;
        color: #fff !important;
        border: 1px solid rgba(255,255,255,0.3) !important;
        cursor: pointer !important;
    }
    
    /* Счетчик фото */
    #photoModal #modalCounter {
        background: rgba(0,0,0,0.7) !important;
        padding: 8px 12px !important;
        border-radius: 15px !important;
        font-size: 14px !important;
        color: #fff !important;
    }
    
    /* Кнопка закрытия - делаем неброской и прозрачной */
    #photoModal > div > span {
        position: absolute !important;
        top: 20px !important;
        right: 20px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 28px !important;
        background: none !important;
        z-index: 10000 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 0 !important;
        color: rgba(255,255,255,0.7) !important;
        border: none !important;
        font-weight: normal !important;
        opacity: 0.7 !important;
        transition: opacity 0.3s ease !important;
    }
    
    /* При наведении делаем чуть более заметной */
    #photoModal > div > span:hover {
        opacity: 1 !important;
        color: rgba(255,255,255,0.9) !important;
    }
}

/* Базовые стили модального окна для всех устройств */
#photoModal {
    display: none;
}

#photoModal.modal-open {
    display: block;
}
