/* ===== MODERN MODAL SYSTEM ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.show {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Header */
.modal-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-500);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Modal Body */
.modal-body {
  padding: var(--space-5);
  max-height: 60vh;
  overflow-y: auto;
}

/* Modal Footer */
.modal-footer {
  padding: var(--space-5);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  background: var(--gray-50);
}

/* Login/Register Specific Styles */
.login-modal .modal-content,
.register-modal .modal-content {
  max-width: 400px;
}

/* Form Styles in Modals */
.modal .form-group {
  margin-bottom: var(--space-4);
}

.modal .form-label {
  font-size: 13px;
  margin-bottom: var(--space-2);
}

.modal .form-control {
  font-size: 14px;
  padding: 10px 12px;
}

/* ДОБАВИТЬ В КОНЕЦ ФАЙЛА css/modals.css */

/* Стили для кастомных модальных окон привязки к водоемам */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.custom-modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    font-family: Arial, sans-serif;
}

.custom-modal-content h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 20px;
    text-align: center;
}

.custom-modal-content p {
    margin: 10px 0;
    color: #5a6c7d;
    line-height: 1.5;
}

.waterbody-info {
    background: #e8f4fd;
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    padding: 12px;
    margin: 15px 0;
    text-align: center;
    font-size: 16px;
}

.waterbody-info strong {
    color: #2980b9;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.modal-actions .btn-primary {
    background: #27ae60;
    color: white;
}

.modal-actions .btn-primary:hover {
    background: #219653;
}

.modal-actions .btn-warning {
    background: #e67e22;
    color: white;
}

.modal-actions .btn-warning:hover {
    background: #d35400;
}

.modal-actions .btn-secondary {
    background: #95a5a6;
    color: white;
}

.modal-actions .btn-secondary:hover {
    background: #7f8c8d;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
    .custom-modal-content {
        padding: 20px 15px;
        margin: 20px;
    }
    
    .modal-actions {
        gap: 8px;
    }
    
    .modal-actions .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* Стиль для кнопки "Выбрать другое место" */
.modal-actions .btn-outline {
    background: transparent;
    color: #3498db;
    border: 2px solid #3498db;
}

.modal-actions .btn-outline:hover {
    background: #3498db;
    color: white;
}

/* Увеличиваем отступы между кнопками */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Стили для прогресс-бара загрузки */
.upload-progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.upload-progress-text {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Стили для превью фото */
.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-placeholder {
    text-align: center;
    color: #999;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    width: 100%;
}

/* Стили для выбора видимости */
.visibility-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.visibility-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.visibility-option:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.visibility-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.visibility-option input[type="radio"]:checked + .option-content {
    opacity: 1;
}

.visibility-option input[type="radio"]:checked ~ .option-content .option-icon {
    transform: scale(1.1);
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.option-icon {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.option-info {
    flex: 1;
}

.option-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.option-description {
    font-size: 12px;
    color: var(--gray-600);
}

/* Стили для редактирования */
.edit-info {
    background: var(--gray-50);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.edit-info p {
    margin: 5px 0;
}

.pending-note {
    color: #e67e22;
    font-weight: 500;
    background: #fef5e7;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px !important;
}

.approved-note {
    color: #27ae60;
    font-weight: 500;
    background: #e8f8f0;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px !important;
}

/* Стили для бейджей видимости */
.badge-gray {
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 5px;
}

.badge-blue {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 5px;
}

/* Улучшенные кнопки действий */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-buttons .btn-small {
    padding: 4px 8px;
    font-size: 12px;
    min-width: 32px;
    height: 28px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .visibility-options {
        gap: 8px;
    }
    
    .option-content {
        gap: 8px;
    }
    
    .option-icon {
        font-size: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-buttons .btn-small {
        width: 100%;
        justify-content: center;
    }
}

/* ===== ИСПРАВЛЕНИЕ: МОДАЛЬНОЕ ОКНО НЕ ЗАКРЫВАЕТСЯ ПРИ КЛИКЕ ВНЕ ЕГО ===== */
.fishing-report-modal-content {
    pointer-events: auto; /* Контент модалки должен получать клики */
}

.fishing-report-modal {
    pointer-events: none; /* Затемнение не перехватывает клики для закрытия */
}

.fishing-report-modal.show {
    display: flex !important;
}

.fishing-report-modal.show .fishing-report-modal-content {
    pointer-events: auto; /* Контент модалки получает клики, когда модалка открыта */
}

/* Отключаем закрытие по клику на фон для всех модалок отчета */
#simple-report-modal.modal.show {
    pointer-events: none; /* Затемнение пропускает клики */
}

#simple-report-modal.modal.show .modal-content {
    pointer-events: auto; /* Контент перехватывает клики */
}

/* Отключаем закрытие по клику на фон для любых модальных окон с формой отчета */
.modal:has(.fishing-report-modal-content) {
    pointer-events: none;
}

.modal:has(.fishing-report-modal-content).show .modal-content {
    pointer-events: auto;
}