/* Общие стили для всей страницы */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Стили для шапки (хедера) */
header {
    background-color: #4a90e2;
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    text-align: left;
}

.view-mode {
    background-color: #27ae60;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
}

/* Основной контейнер с плоскостью и панелью просмотра */
main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Координатная плоскость */
.plane {
    flex: 1;
    background-color: #1a1a1a;
    position: relative;
    cursor: crosshair;
    overflow: hidden;
    min-height: 500px;
}

/* Центральная точка */
.center-point {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    border: 3px solid #333;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    z-index: 30;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

/* Линии осей */
.line {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.line-north {
    width: 6px;
    background-color: #00ff00;
}

.line-south {
    width: 6px;
    background-color: #ffff00;
}

.line-west {
    height: 6px;
    background-color: #808080;
}

.line-east {
    height: 6px;
    background-color: #ff0000;
}

/* Буквы сторон света */
.direction-label {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 0 5px black;
    transform: translate(-50%, -50%);
}

.label-north {
    color: #00ff00;
}

.label-south {
    color: #ffff00;
}

.label-west {
    color: #808080;
}

.label-east {
    color: #ff0000;
}

/* Контейнер для линий от точек до осей */
.lines-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 35;
}

/* Стили для SVG линий */
.point-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Контейнер для пользовательских точек */
.points-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 40;
    pointer-events: none;
}

/* Стили для контейнера точки с именем */
.user-point-container {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 50;
    cursor: pointer;
}

/* Сама точка - без изменений при наведении/нажатии */
.user-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #000000;
    transition: none;
}

/* Цвета для точек */
.user-point.color-north {
    background-color: #00ff00;
}

.user-point.color-south {
    background-color: #ffff00;
}

.user-point.color-west {
    background-color: #808080;
}

.user-point.color-east {
    background-color: #ff0000;
}

/* Имя точки - абсолютное позиционирование ровно над точкой */
.point-name-label {
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
    font-family: Arial, sans-serif;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    display: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    
    /* Позиционирование ровно над точкой */
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    z-index: 51;
}

/* Показываем имя при наведении на контейнер */
.user-point-container:hover .point-name-label {
    display: block;
}

/* Для выбранной точки имя всегда видно */
.user-point-container.selected .point-name-label {
    display: block;
    background-color: #4a90e2;
    border-color: white;
}

/* Минимальная подсветка для выбранной точки */
.user-point-container.selected .user-point {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Индикатор координат мыши */
.mouse-coordinates {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.5em;
    font-weight: bold;
    border: 2px solid #4a90e2;
    z-index: 100;
    pointer-events: none;
    text-align: center;
}

.view-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 340px;
    background-color: rgba(44, 62, 80, 0.95);
    color: white;
    border-radius: 10px;
    border: 2px solid #4a90e2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 200;
    backdrop-filter: blur(5px);
    transition: width 0.3s ease;
    overflow: hidden;
}

/* Стили для свернутой панели */
.view-panel.collapsed {
    width: 60px;
}

.view-panel.collapsed .panel-content {
    display: none;
}

.view-panel.collapsed .panel-header h3 {
    display: none;
}

.view-panel.collapsed .points-count {
    display: none;
}

.view-panel.collapsed .panel-header-right {
    width: 100%;
    display: flex;
    justify-content: center;
}

.view-panel.collapsed .toggle-btn {
    margin: 0;
}

/* Заголовок панели */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #4a90e2;
    border-bottom: 2px solid #357abd;
    cursor: pointer;
}

.panel-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2em;
}

.panel-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.points-count {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.9em;
}

/* Кнопка сворачивания */
.toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.panel-content {
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    transition: opacity 0.3s ease;
}

/* Информация о выделенной точке */
.selected-point-info {
    background-color: #34495e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #4a90e2;
}

.selected-point-info h4 {
    color: #4a90e2;
    margin-bottom: 10px;
    font-size: 1em;
}

.info-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
}

.info-content .point-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

/* Элементы управления масштабом */
.zoom-controls {
    background-color: #34495e;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
}

.zoom-controls button {
    margin: 0;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-controls button:hover {
    background-color: #357abd;
}

.zoom-controls span {
    min-width: 60px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.zoom-hint {
    border-top: 1px solid #4a90e2;
    margin-top: 8px;
    padding-top: 8px;
    font-size: 12px;
    color: #ecf0f1;
    width: 100%;
    text-align: center;
}

/* Список точек */
.points-list-header {
    margin: 20px 0 10px;
}

.points-list-header h4 {
    color: #4a90e2;
}

.points-list {
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid #34495e;
    border-radius: 5px;
    padding: 10px;
}

.empty-list {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
    font-style: italic;
}

.point-item {
    background-color: #34495e;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 4px solid transparent;
}

.point-item:hover {
    background-color: #3d566e;
    transform: translateX(2px);
}

/* Выделенный элемент в списке */
.point-item.selected {
    background-color: #4a90e2;
    border-left: 4px solid #f1c40f;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.point-info {
    flex: 1;
}

.point-coords {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    margin-bottom: 3px;
    color: white;
}

.point-coords strong {
    color: #f1c40f;
}

.point-color-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid black;
}

.point-color-badge.color-north { background-color: #00ff00; }
.point-color-badge.color-south { background-color: #ffff00; }
.point-color-badge.color-west { background-color: #808080; }
.point-color-badge.color-east { background-color: #ff0000; }

.point-details {
    font-size: 0.8em;
    color: #bdc3c7;
}

/* Секция линий */
.lines-section {
    margin-top: 30px;
    border-top: 2px solid #4a90e2;
    padding-top: 20px;
}

.lines-section h4 {
    color: #4a90e2;
    margin-bottom: 15px;
}

.lines-list {
    max-height: 150px;
    overflow-y: auto;
    border: 2px solid #34495e;
    border-radius: 5px;
    padding: 10px;
}

.line-item {
    background-color: #34495e;
    border-radius: 5px;
    padding: 8px;
    margin-bottom: 8px;
    border-left: 4px solid transparent;
}

.line-info {
    font-size: 0.9em;
}

.line-points {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: white;
}

.line-color-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid black;
}

.line-color-badge.color-north { background-color: #00ff00; }
.line-color-badge.color-south { background-color: #ffff00; }
.line-color-badge.color-west { background-color: #808080; }
.line-color-badge.color-east { background-color: #ff0000; }

/* Подвал */
footer {
    background-color: #333;
    color: white;
    padding: 12px 20px;
}

.copyright {
    font-size: 1em;
    text-align: left;
}

/* Скроллбары */
.points-list::-webkit-scrollbar,
.lines-list::-webkit-scrollbar {
    width: 8px;
}

.points-list::-webkit-scrollbar-track,
.lines-list::-webkit-scrollbar-track {
    background: #2c3e50;
    border-radius: 4px;
}

.points-list::-webkit-scrollbar-thumb,
.lines-list::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.points-list::-webkit-scrollbar-thumb:hover,
.lines-list::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

/* Для Firefox */
.points-list,
.lines-list {
    scrollbar-width: thin;
    scrollbar-color: #4a90e2 #2c3e50;
}

/* Секция ферм */
.farms-section {
    margin-top: 30px;
    border-top: 2px solid #4a90e2;
    padding-top: 20px;
}

.farms-section h4 {
    color: #4a90e2;
    margin-bottom: 15px;
}

.farms-list {
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid #34495e;
    border-radius: 5px;
    padding: 10px;
}

.farm-item {
    background-color: #34495e;
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    border: 1px solid #4a90e2;
}

.farm-item:hover {
    background-color: #3d566e;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.farm-item.selected {
    background-color: #4a90e2;
    border-left: 4px solid #f1c40f;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.farm-info {
    flex: 1;
}

.farm-name {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
    font-size: 1.1em;
}

.farm-name strong {
    color: #f1c40f;
}

.farm-coords {
    font-size: 0.9em;
    color: #ecf0f1;
    margin-bottom: 3px;
    font-family: 'Courier New', monospace;
}

.farm-details {
    font-size: 0.8em;
    color: #bdc3c7;
}

/* Стили для цветных меток */
.point-color-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid black;
}

.point-color-badge.color-north { background-color: #00ff00; }
.point-color-badge.color-south { background-color: #ffff00; }
.point-color-badge.color-west { background-color: #808080; }
.point-color-badge.color-east { background-color: #ff0000; }

/* Скроллбар для списка ферм */
.farms-list::-webkit-scrollbar {
    width: 8px;
}

.farms-list::-webkit-scrollbar-track {
    background: #2c3e50;
    border-radius: 4px;
}

.farms-list::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.farms-list::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

/* Для Firefox */
.farms-list {
    scrollbar-width: thin;
    scrollbar-color: #4a90e2 #2c3e50;
}

/* Добавьте эти стили в конец существующего файла styles-view.css */

/* Медиа-запросы для мобильных устройств */
@media (max-width: 768px) {
    /* Уменьшаем панель на мобильных */
    .view-panel {
        width: 280px;
        top: 10px;
        right: 10px;
    }
    
    /* Уменьшаем шрифт координат */
    .mouse-coordinates {
        font-size: 1em;
        padding: 8px 16px;
        bottom: 15px;
        left: 15px;
    }
    
    /* Увеличиваем размер точек для удобства касания */
    .user-point {
        width: 20px;
        height: 20px;
    }
    
    /* Увеличиваем область касания для точек */
    .user-point-container {
        padding: 10px;
    }
    
    /* Увеличиваем кнопки для касания */
    .btn-small, .toggle-btn {
        min-height: 44px;
    }
    
    .btn-small {
        min-width: 44px;
    }
    
    /* Увеличиваем отступы для удобства касания */
    .panel-content {
        padding: 15px;
    }
    
    /* Увеличиваем элементы списка для касания */
    .point-item, .farm-item {
        padding: 15px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .view-panel {
        width: 240px;
    }
    
    .mouse-coordinates {
        font-size: 0.9em;
        padding: 6px 12px;
    }
    
    .point-name-label {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
    .view-panel {
        width: 320px;
    }
}