html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  padding-top: 72px; /* Увеличиваем отступ для контента под фиксированной навигацией */
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

.card.floating {
    transition: transform 0.3s ease;
}

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

.card-img-top {
    height: 200px;
    object-fit: cover;
}

.btn-group {
    flex-wrap: wrap;
}

.btn-group .btn {
    margin: 2px;
}

@media (max-width: 768px) {
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin: 2px 0;
        width: 100%;
        text-align: left;
    }

    #districtsCollapse {
        width: 100%;
    }

    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
    }

    .d-flex.justify-content-between h5 {
        margin-bottom: 10px;
    }

    .btn-outline-primary.d-md-none {
        width: 100%;
        margin-top: 10px;
    }
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-container {
    background-color: #f8f9fa;
    padding: 20px 0;
    margin-bottom: 20px;
}

/* Стили для ссылок в контенте */
:root {
    --main-green: #006B5F;
    --active-green: #005348;
}

main a {
    color: var(--main-green);
    text-decoration: none;
    font-weight: 500;
}

main a:hover {
    color: #000;
    text-decoration: underline;
}

.list-group-item a {
    color: var(--main-green);
    text-decoration: none;
    font-weight: 500;
}

.list-group-item a:hover {
    color: #000;
    text-decoration: underline;
}

/* Стили для вкладок */
.nav-tabs .nav-link {
    color: var(--main-green) !important;
    background-color: #fff;
    border: 1px solid #dee2e6;
}



.nav-tabs .nav-item .nav-link {
    color: var(--main-green) !important;
}

.nav-tabs .nav-item .nav-link:hover {
    color: white !important;
}

.nav-tabs .nav-link.active {
    color: #fff !important;
    background-color: var(--main-green);
    border-color: var(--main-green);
    font-weight: 500;
}

/* Стили для кнопок */
.btn-primary {
    background-color: var(--main-green);
    border-color: var(--main-green);
    color: white;
}

.btn-primary:hover {
    background-color: #005347;
    border-color: #005347;
    color: white;
}

.btn-outline-primary {
    color: var(--main-green);
    border-color: var(--main-green);
}

.btn-outline-primary:hover {
    background-color: var(--main-green);
    border-color: var(--main-green);
    color: white;
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--main-green);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar {
    padding: 0;
    background-color: var(--main-green) !important;
    border: none !important;
    box-shadow: none !important;
}

.navbar > .container {
    max-width: 1320px;
    padding-right: 0;
    display: flex;
    align-items: center;
    padding-left: 12px;
    position: relative;
    justify-content: space-between;
}

.navbar-nav {
    width: 800px;
    position: static;
    transform: none;
    display: flex;
    justify-content: center;
    margin: 0 auto;
    flex-wrap: nowrap;
}

.nav-item {
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    min-width: 120px;
    text-align: center;
}

.nav-link {
    color: white !important;
    padding: 1rem 0.8rem !important;
    font-weight: normal;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border: none;
    transition: background-color 0.2s;
    display: block;
    width: 100%;
    text-align: center;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--active-green) !important;
    color: white !important;
}

.navbar-brand {
    color: white !important;
    font-weight: normal;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right: 0;
}

.navbar-brand img {
    height: 40px;
    width: auto;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

.dropdown-menu {
    min-width: 200px;
    padding: 0.5rem 0;
    margin: 0;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

.dropdown-divider {
    margin: 0.5rem 0;
}

.badge {
    margin-left: 0.5rem;
}

.navbar-collapse {
    display: flex !important;
    flex-grow: 1;
}

.navbar-nav.ms-auto {
    position: static;
    transform: none;
    width: auto;
    margin-left: auto !important;
    justify-content: flex-end;
    padding-right: 1rem;
}

@media screen and (min-width: 576px) {
    .navbar-expand-sm .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
}

@media (max-width: 1200px) {
    .nav-item {
        min-width: 110px;
    }
}

@media (max-width: 992px) and (min-width: 577px) {
    .navbar-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-item {
        min-width: 100px;
        flex: 1;
        max-width: 150px;
    }
    
    .nav-link {
        padding: 0.8rem 0.5rem !important;
        font-size: 0.8rem;
        text-align: center;
    }
}

@media (max-width: 992px) {
    .navbar-nav {
        position: static;
        transform: none;
        padding-left: 0;
        width: 100%;
        margin-left: 0;
        flex-direction: column;
    }

    .navbar-collapse {
        display: none !important;
    }

    .navbar-collapse.show {
        display: flex !important;
        flex-direction: column;
        width: 100%;
    }

    .navbar-nav.ms-auto {
        margin: 0 !important;
        width: 100%;
        order: 2;
        padding-right: 0;
    }

    .navbar > .container {
        padding-right: 12px;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .navbar-toggler {
        margin: 8px 0;
        padding: 8px;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .nav-item {
        min-width: auto;
        width: 100%;
    }

    .nav-link {
        padding: 12px 16px !important;
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    .navbar-brand img {
        height: 30px;
    }

    .navbar-toggler {
        padding: 4px 8px;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    }
}

/* Стили для страницы ошибки */
.error-page {
    padding: 60px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

.error-content {
    max-width: 600px;
    margin: 0 auto;
}

.error-page .display-1 {
    font-size: 8rem;
    font-weight: 700;
    color: var(--main-green);
    margin-bottom: 1rem;
    line-height: 1;
}

.error-page h2 {
    color: #333;
    margin-bottom: 1.5rem;
}

.error-page .lead {
    color: #666;
    margin-bottom: 2rem;
}

.error-actions {
    margin-top: 2rem;
}

.error-actions .btn {
    min-width: 160px;
    margin: 0.5rem;
}

@media (max-width: 576px) {
    .error-page .display-1 {
        font-size: 6rem;
    }

    .error-actions .btn {
        min-width: 140px;
        margin: 0.25rem;
    }
}

/* Стили для панели редактирования */
.edit-header {
    position: sticky;
    top: 72px; /* Увеличиваем отступ сверху, чтобы не наезжать на основную навигацию */
    z-index: 1020;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: -16px; /* Компенсируем отступ от body */
}

.edit-header .container {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Стили для полноэкранного просмотра изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-modal-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: calc(90vh - 100px);
    margin-top: 50px;
    object-fit: contain;
    animation: zoomIn 0.3s;
    cursor: pointer;
}

.document-modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1200px;
    max-height: calc(90vh - 100px);
    margin-top: 50px;
    animation: zoomIn 0.3s;
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;
}

@keyframes zoomIn {
    from { transform: scale(0.8); }
    to { transform: scale(1); }
}

.image-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.3s;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: #fff;
    text-decoration: none;
}

.image-modal-caption {
    margin: 20px auto 0;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #fff;
    padding: 15px 20px;
    height: auto;
    font-size: 1.1rem;
    line-height: 1.5;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    cursor: default;
    -webkit-user-select: text;
    user-select: text;
}

.image-modal-caption:empty {
    display: none;
}

/* Стрелки навигации для модального окна изображений */
.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 2rem;
    padding: 15px 20px;
    cursor: pointer;
    z-index: 10001;
    transition: background-color 0.3s, opacity 0.3s;
    opacity: 0.7;
    border-radius: 5px;
}

.image-modal-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.image-modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.image-modal-prev {
    left: 20px;
}

.image-modal-next {
    right: 20px;
}

.image-modal-nav i {
    display: block;
}

/* Стили для кликабельных изображений */
.photo-bg,
.preview-img-box img,
.photo-clickable {
    cursor: pointer;
    transition: opacity 0.3s;
}

.photo-bg:hover,
.preview-img-box img:hover,
.photo-clickable:hover {
    opacity: 0.8;
}

/* Стили для кликабельных документов */
.document-preview {
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.document-preview:hover {
    background-color: #e9ecef !important;
    transform: scale(1.02);
}

/* Стили для изображений в модальном окне дополнительных фото */
#photos-modal img,
#photos-modal .img-fluid {
    cursor: pointer;
    transition: opacity 0.3s;
}

#photos-modal img:hover,
#photos-modal .img-fluid:hover {
    opacity: 0.8;
}

/* Стили для индикатора наличия фото на карточке памятника */
.photo-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 107, 95, 0.9);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.photo-indicator i {
    font-size: 16px;
}

/* Новости (лента на главной) */
.news-card .card-body {
    padding-top: 1.25rem;
}

.news-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-thumbnail {
    width: 118px;
    height: 72px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 10px;
    background: #f1f3f5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.news-thumbnail-placeholder {
    width: 118px;
    height: 72px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: #e9ecef;
}

.news-body {
    min-width: 0;
}

.news-date {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.2rem;
}

.news-title-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.2;
}

.news-title-link:hover {
    text-decoration: underline;
}

.news-excerpt {
    color: #212529;
    margin-top: 0.25rem;
    font-size: 0.95rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-icons {
    margin-top: 0.4rem;
    color: #6c757d;
    font-size: 0.85rem;
    display: flex;
    gap: 14px;
    align-items: center;
}

.news-icons i {
    margin-right: 0.35rem;
}
