body {
    font-family: Arial, sans-serif;
}

h1, h2 {
    color: #333;
}

form {
    margin-bottom: 20px;
}

ul {
    list-style-type: none;
    padding-left: 0;
}

li {
    margin: 5px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

table {
    margin-top: 10px; /* Отступ перед таблицами */
    margin-bottom: 20px; /* Отступ после таблиц */
    width: 100%; /* Опционально: таблицы будут занимать всю ширину контейнера */
    border-collapse: collapse; /* Убираем промежутки между ячейками */
}

th, td {
    padding: 10px; /* Добавляем отступы внутри ячеек таблицы */
    border: 1px solid #ddd; /* Легкая рамка для ячеек */
    text-align: left; /* Текст по левому краю */
}

th {
    background-color: #f4f4f4; /* Фон для заголовков таблицы */
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

#pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    align-items: center;
    gap: 10px;
}

#pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
}

#pagination button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

#pagination span {
    margin: 0 10px;
    font-weight: 500;
    color: #495057;
}

.pagination-button {
    margin: 0 5px;
    padding: 5px 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    cursor: pointer;
}

.pagination-button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-button:hover {
    background-color: #e9ecef;
}

#filter-container {
    margin-bottom: 20px;
}

#archive-table {
    width: 100%;
    border-collapse: collapse;
}

#archive-table th, #archive-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

/* Стили для пагинации */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.pagination-controls button {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    cursor: pointer;
    border-radius: 4px;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: #e9ecef;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls .page-number {
    min-width: 35px;
}

.pagination-controls .page-number.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Стили для модального окна архива */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

/* Стили для карты овчарен */

/* Селектор овчарен */
.barns-selector {
    margin-bottom: 30px;
}

.barns-selector h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

.barns-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 0 20px;
}

.barn-selector-card {
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 20px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 180px;
    max-width: 220px;
    flex: 0 0 auto;
}

.barn-selector-card:hover {
    background-color: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.3);
}

.barn-selector-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
}

.barn-selector-card .barn-stats {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Контейнер выбранной овчарни */
.selected-barn-container {
    margin-top: 20px;
}

.barn-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.barn-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

#back-to-list {
    padding: 8px 16px;
    font-size: 14px;
}

.no-barns {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px;
    border: 1px dashed #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Существующие стили овчарен */
.barn-container {
    margin-bottom: 30px;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    background-color: #f9f9f9;
}

.barn-title {
    text-align: center;
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.5em;
    font-weight: bold;
}

.barn-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 50px 10px;
    table-layout: fixed;
}

.section-cell {
    width: 300px;
    height: 120px;
    border: 2px solid #666;
    border-radius: 5px;
    padding: 10px;
    vertical-align: top;
    background-color: white;
    position: relative;
}

.section-cell.empty-placeholder {
    border: none;
    background: none;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.section-number {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
}

.animals-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.animal-count {
    display: block;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    color: #000;
    cursor: pointer;
    transition: background-color 0.2s;
}

.animal-count:hover {
    background-color: #e0e0e0;
}

.animal-count.makers {
    color: #000;
}

.animal-count.rams {
    color: #000;
}

.animal-count.ewes {
    color: #000;
}

.animal-count.sheep {
    color: #000;
}

.empty-section {
    text-align: center;
    color: #999;
    font-style: italic;
    margin-top: 20px;
}

.empty-barn {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
    border: 1px dashed #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.animal-item {
    padding: 5px;
    border-bottom: 1px solid #eee;
    font-family: monospace;
}

.animal-item:last-child {
    border-bottom: none;
}

.animal-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.animal-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Стили для чекбоксов в модальном окне */
.select-all-container {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.select-all-container label {
    margin: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.animal-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-family: monospace;
}

.animal-item:last-child {
    border-bottom: none;
}

.animal-item label {
    cursor: pointer;
    margin: 0;
}

.animal-checkbox {
    margin-right: 8px;
}

#move-animals-container {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

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

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

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

.btn-success:hover {
    background-color: #218838;
}

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

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

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* Дополнительные стили для модального окна карты мест */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    text-align: center;
}

.modal-close {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal-close:hover {
    background-color: #0056b3;
}

/* Стили для главной страницы - статистика */
.statistics-container {
    margin: 20px 0;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    border-radius: 6px;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
    text-align: center;
    color: #007bff;
}

.stat-details {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.stat-details p {
    margin: 5px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    color: #6c757d;
}

.stat-details span {
    font-weight: 500;
    color: #495057;
}

.animal-type-section {
    margin: 8px 0;
}

.animal-type-section strong {
    color: #495057;
}

.status-breakdown {
    margin-left: 15px;
    font-size: 12px;
    color: #6c757d;
}

.status-breakdown div {
    margin: 2px 0;
}

.navigation-section {
    margin-top: 40px;
}

.navigation-section ul {
    list-style: none;
    padding: 0;
}

.navigation-section li {
    margin: 10px 0;
}

.navigation-section a {
    display: inline-block;
    padding: 12px 24px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.navigation-section a:hover {
    background-color: #0056b3;
}

/* Стили для модального окна экспорта */
.export-modal-content {
    max-width: 600px;
    width: 90%;
}

.export-filters {
    margin: 20px 0;
}

.filter-group {
    margin: 15px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #f9f9f9;
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.filter-group input[type="number"] {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

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

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

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

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

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

.btn-success:hover {
    background-color: #218838;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Стили для годовой статистики */
.year-selector {
    margin-bottom: 15px;
    text-align: center;
}

.year-selector label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 500;
    color: #495057;
}

.year-selector select {
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: white;
    color: #495057;
    font-size: 14px;
}

.yearly-stats {
    margin-top: 10px;
}

.yearly-stat-section {
    margin: 10px 0;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.yearly-stat-section:last-child {
    border-bottom: none;
}

.yearly-stat-section strong {
    display: block;
    margin-bottom: 5px;
    color: #495057;
    font-size: 13px;
}

.yearly-stat-section div {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.yearly-stat-section small {
    color: #868e96;
    font-size: 11px;
}

/* Стили для календаря с ветеринарными событиями */
.has-note {
    background-color: #e3f2fd !important;
    position: relative;
}

.has-vet-treatment {
    background-color: #fff3e0 !important;
    position: relative;
}

.has-vet-expiring {
    background-color: #fff8e1 !important;
    position: relative;
}

.has-weighing {
    background-color: #007bff !important;
    color: white !important;
    position: relative;
}

.has-multiple-events {
    position: relative;
}

.color-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    display: flex;
}

.color-segment {
    flex: 1;
    height: 100%;
}

.color-segment.notes {
    background-color: #2196f3;
}

.color-segment.vet_treatments {
    background-color: #ff9800;
}

.color-segment.vet_expiring {
    background-color: #ffc107;
}

.event-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.event-marker.note {
    background-color: #2196f3;
}

.event-marker.vet-treatment {
    background-color: #ff9800;
}

.event-marker.vet-expiring {
    background-color: #ffc107;
}

.event-item {
    border-left: 4px solid #dee2e6;
}

.vet-treatment-event {
    border-left-color: #ff9800 !important;
}

.vet-expiring-event {
    border-left-color: #ffc107 !important;
}

.note-event {
    border-left-color: #2196f3 !important;
}

.animal-list {
    font-size: 14px;
}

.animal-item {
    border-bottom: 1px solid #f0f0f0;
}

.animal-item:last-child {
    border-bottom: none;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #495057;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Стили для заметок в календаре */
.list-group-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.list-group-item div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

/* Специальные стили для модального окна календаря */
#lambingModal .modal-body {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#lambingModal .list-group-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.5;
}

#lambingModal .list-group-item div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    line-height: 1.5;
}

.legend-marker.notes {
    background-color: #2196f3;
}

.legend-marker.weighing {
    background-color: #007bff;
}

.legend-marker.vet-treatments {
    background-color: #ff9800;
}

.legend-marker.vet-expiring {
    background-color: #ffc107;
}

/* Стили для кнопок навигации */
.navigation-buttons {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.navigation-buttons .btn {
    min-width: 80px;
    transition: all 0.2s ease;
}

.navigation-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.navigation-buttons .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.navigation-buttons .btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Исправление цвета текста кнопки "Панель Администратора" при наведении */
.btn-outline-primary:hover {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
}

/* Дополнительно для всех outline кнопок */
.btn-outline-secondary:hover {
    color: white !important;
}

/* Специальные стили для кнопок пагинации */
#pagination .btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
    background-color: transparent;
}

#pagination .btn-outline-primary:hover {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
}

#pagination .btn-outline-primary:focus {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Дополнительные стили для всех кнопок пагинации */
.pagination .btn-outline-primary:hover,
div[id="pagination"] .btn-outline-primary:hover,
.btn.btn-outline-primary.btn-sm:hover {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
}

/* Переопределяем Bootstrap стили для outline кнопок */
.btn-outline-primary:not(:disabled):not(.disabled):hover {
    color: white !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
}