/* Сброс z-index для всего */
* {
    z-index: auto;
}

/* Основные стили */
body, html { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

#map { 
    width: 100%; 
    height: 100vh; 
    position: relative; 
}

/* Слой для наших маркеров поверх карты */
#custom-markers-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Контейнер маркера - простая версия */
.marker-container {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

/* Точка маркера */
.marker-dot {
    width: 10px;
    height: 10px;
    background-color: #ff4444;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.marker-container:hover .marker-dot {
    transform: scale(1.2);
}

/* Свой маркер (зеленый) */
.marker-container.own-marker .marker-dot {
    background-color: #19ff19;
}

/* Текстовый блок - управляется через JS */
.marker-text {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 120px;
    max-width: 200px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    margin-bottom: 8px;
    z-index: 1002;
    pointer-events: none;
}

/* Показываем текст при наведении */
.marker-container:hover .marker-text {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto !important;
}

/* Стрелка у текстового блока */
.marker-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0,0,0,0.85) transparent transparent transparent;
}

/* Строка с ником и датой */
.marker-username span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.marker-username span span:first-child {
    font-weight: bold;
    color: #ffd700;
    font-size: 13px;
}

.marker-username span span:last-child {
    font-size: 12px;
    opacity: 0.8;
    color: #cccccc;
    font-weight: normal;
    white-space: nowrap;
}

/* Заголовок маркера */
.marker-title {
    color: white;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Попап с подробной информацией */
.marker-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    width: 280px;
    display: none;
    margin-bottom: 15px;
    pointer-events: auto;
    z-index: 2147483647 !important;
    overflow: hidden;
}

.marker-popup.active {
    display: block;
    z-index: 2147483647 !important;
}

.marker-popup:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.popup-header {
    background: #f8f9fa;
    padding: 10px; /* было 12px */
    border-bottom: 1px solid #dee2e6;
}

.popup-username {
    color: #4285f4;
    font-size: 13px; /* было 14px */
    font-weight: bold;
    margin-bottom: 4px;
}

.popup-title {
    color: #333;
    font-size: 16px; /* было 18px */
    font-weight: bold;
    word-wrap: break-word;
}

.popup-content {
    padding: 10px; /* было 12px */
    max-height: 150px;
    overflow-y: auto;
    color: #666;
    font-size: 14px; /* было 16px */
    line-height: 1.5;
    word-wrap: break-word;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f8f9fa;
}

.popup-content::-webkit-scrollbar {
    width: 6px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.popup-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.popup-actions {
    display: flex;
    gap: 8px;
    padding: 10px; /* было 12px */
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.popup-actions button {
    flex: 1;
    padding: 6px; /* было 8px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px; /* было 13px */
    font-weight: 500;
    transition: opacity 0.2s;
}

.popup-actions button:hover {
    opacity: 0.9;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

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

/* Оверлей для неавторизованных */
#auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

#auth-overlay span {
    font-size: 18px;
    display: block;
    margin-top: 10px;
    color: #ffd700;
}

/* Панель авторизации */
.auth-panel {
    position: absolute;
    top: 20px;
    right: 50px;
    z-index: 10001;
    background: white;
    padding: 15px; /* было 20px */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-width: 280px; /* было 300px */
}

.auth-panel h3 {
    margin: 0 0 15px 0; /* было 0 0 20px 0 */
    color: #333;
    font-size: 16px; /* было 18px */
    border-bottom: 2px solid #4285f4;
    padding-bottom: 8px; /* было 10px */
}

.auth-panel input {
    width: 100%;
    padding: 8px; /* было 10px */
    margin: 6px 0; /* было 8px */
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 13px; /* было 14px */
}

.auth-panel input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66,133,244,0.2);
}

.auth-panel button {
    width: 100%;
    padding: 8px; /* было 12px */
    margin: 6px 0; /* было 8px */
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.auth-panel button:hover {
    background: #3367d6;
}

.auth-panel .logout-btn {
    background: #dc3545;
}

.auth-panel .logout-btn:hover {
    background: #c82333;
}

.auth-panel .switch-btn {
    background: transparent;
    color: #4285f4;
    border: 2px solid #4285f4;
}

.auth-panel .switch-btn:hover {
    background: #e8f0fe;
}

/* Ссылки в форме входа */
.auth-links {
    display: flex;
    flex-direction: column;
    gap: 8px; /* было 10px */
    margin-top: 12px; /* было 15px */
}

.link-btn {
    background: none;
    border: none;
    color: #6f42c1;
    cursor: pointer;
    font-size: 12px; /* было 13px */
    text-decoration: underline;
    padding: 4px; /* было 5px */
}

.link-btn:hover {
    color: #5a32a3;
    background: none;
}

/* Информация о лимите маркеров */
.marker-limit-info {
    font-size: 12px;
    margin-bottom: 8px; /* было 10px */
    padding: 6px; /* было 8px */
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #4285f4;
}

.marker-limit-info strong {
    color: #4285f4;
}

/* Сообщения */
.error {
    color: #dc3545;
    font-size: 12px; /* было 13px */
    margin-top: 5px;
    padding: 5px;
    background: #f8d7da;
    border-radius: 4px;
}

.success {
    color: #28a745;
    font-size: 12px; /* было 13px */
    margin-top: 5px;
    padding: 5px;
    background: #d4edda;
    border-radius: 4px;
}

.warning-message {
    color: #856404;
    font-size: 12px; /* было 13px */
    margin-top: 5px;
    padding: 6px; /* было 8px */
    background: #fff3cd;
    border-radius: 4px;
    border: 1px solid #ffeeba;
}

.info-message {
    color: #004085;
    font-size: 12px; /* было 13px */
    margin-top: 5px;
    padding: 6px; /* было 8px */
    background: #cce5ff;
    border-radius: 4px;
    border: 1px solid #b8daff;
}

/* Панель добавления маркера */
.marker-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10001;
    background: white;
    padding: 15px; /* было 20px */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 320px; /* было 350px */
    display: none;
}

.marker-panel.active {
    display: block;
}

.marker-panel h3 {
    margin: 0 0 15px 0; /* было 0 0 20px 0 */
    color: #333;
    font-size: 16px; /* было 18px */
    border-bottom: 2px solid #4285f4;
    padding-bottom: 8px; /* было 10px */
}

/* Поле ввода с счетчиком */
.input-with-counter {
    position: relative;
    margin-bottom: 8px; /* было 10px */
}

.input-with-counter input,
.input-with-counter textarea {
    width: 100%;
    padding: 8px; /* было 10px */
    margin: 6px 0 2px 0; /* было 8px 0 2px 0 */
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 13px; /* было 14px */
}

.input-with-counter textarea {
    min-height: 80px; /* было 100px */
    resize: vertical;
}

/* Счетчики символов */
.char-counter {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 2px;
    padding-right: 5px;
}

.char-counter.warning {
    color: #ffc107;
}

.char-counter.danger {
    color: #dc3545;
    font-weight: bold;
}

.marker-panel button {
    padding: 8px 16px; /* было 10px 20px */
    margin: 6px 4px 0 0; /* было 8px 5px 0 0 */
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
}

.marker-panel .cancel-btn {
    background: #6c757d;
}

.marker-panel .delete-btn {
    background: #dc3545;
}

.marker-panel .hint {
    font-size: 12px;
    color: #666;
    margin-top: 12px; /* было 15px */
    padding-top: 8px; /* было 10px */
    border-top: 1px solid #eee;
}

/* Информация о пользователе */
.user-info {
    font-size: 13px; /* было 14px */
    color: #666;
    margin-bottom: 12px; /* было 15px */
    padding: 8px; /* было 10px */
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4285f4;
}

/* Кнопка администрирования */
.admin-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    margin: 8px 0; /* было 10px */
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.admin-btn:hover {
    background: #5a32a3;
}

/* Панель администрирования */
.admin-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1300px;
    height: 90vh;
    max-height: 800px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    padding: 15px; /* было 20px */
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px; /* было 20px */
    padding-bottom: 8px; /* было 10px */
    border-bottom: 2px solid #6f42c1;
    flex-shrink: 0;
}

.admin-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px; /* было 24px */
}

.close-admin-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 5px 10px;
}

.close-admin-btn:hover {
    color: #333;
}

/* Вкладки админ-панели */
.admin-tabs {
    display: flex;
    gap: 8px; /* было 10px */
    margin-left: 15px; /* было 20px */
}

.tab-btn {
    padding: 6px 12px; /* было 8px 16px */
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    color: #666;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.tab-btn.active {
    background: #6f42c1;
    color: white;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Кнопки действий в админке */
.admin-actions {
    display: flex;
    gap: 8px; /* было 10px */
    margin-bottom: 15px; /* было 20px */
}

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

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

.admin-search {
    display: flex;
    gap: 8px; /* было 10px */
    margin-bottom: 15px; /* было 20px */
    flex-shrink: 0;
}

.admin-search input {
    flex: 1;
    padding: 8px; /* было 10px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
}

.admin-search button {
    padding: 8px 16px; /* было 10px 20px */
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
}

.admin-search button:hover {
    background: #3367d6;
}

.admin-stats {
    margin-bottom: 12px; /* было 15px */
    padding: 8px; /* было 10px */
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
    color: #666;
    flex-shrink: 0;
}

.admin-stats span {
    font-weight: bold;
    color: #6f42c1;
}

/* Таблицы */
.users-table-container,
.codes-table-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px; /* было 20px */
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 200px;
}

.users-table,
.codes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px; /* было 14px */
}

.users-table th,
.codes-table th {
    background: #f8f9fa;
    padding: 10px; /* было 12px */
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-table td,
.codes-table td {
    padding: 8px; /* было 12px */
    border-bottom: 1px solid #dee2e6;
    color: #555;
}

.users-table tr:hover,
.codes-table tr:hover {
    background: #f8f9fa;
}

.loading {
    text-align: center;
    padding: 30px; /* было 40px */
    color: #999;
    font-style: italic;
}

/* Статусы пользователей */
.status-badge {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 4px;
    font-size: 11px; /* было 12px */
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-blocked {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.role-badge {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 4px;
    font-size: 11px; /* было 12px */
    font-weight: 500;
    background: #e2e3e5;
    color: #383d41;
}

.role-admin {
    background: #cce5ff;
    color: #004085;
}

.role-moderator {
    background: #d4edda;
    color: #155724;
}

.verified-badge {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 4px;
    font-size: 11px; /* было 12px */
    font-weight: 500;
}

.verified-badge.verified {
    background: #d4edda;
    color: #155724;
}

.verified-badge.pending {
    background: #fff3cd;
    color: #856404;
}

/* Кнопки действий */
.action-btn {
    padding: 4px 8px; /* было 6px 12px */
    margin: 2px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
    font-weight: 500;
    transition: all 0.2s;
    min-width: 50px; /* было 60px */
}

.action-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.action-btn.edit {
    background: #6f42c1;
    color: white;
}

.action-btn.block {
    background: #ffc107;
    color: #333;
}

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

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

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

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

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

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

/* Пагинация */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* было 20px */
    padding: 8px 0; /* было 10px 0 */
    flex-shrink: 0;
}

.page-btn {
    padding: 6px 12px; /* было 8px 16px */
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #e9ecef;
}

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

#pageInfo {
    font-size: 13px; /* было 14px */
    color: #666;
}

/* Коды приглашений */
.code-value {
    font-family: monospace;
    font-size: 11px; /* было 12px */
    background: #f1f3f5;
    padding: 3px 6px;
    border-radius: 4px;
}

.code-status {
    display: inline-block;
    padding: 2px 6px; /* было 3px 8px */
    border-radius: 12px;
    font-size: 10px; /* было 11px */
    font-weight: 500;
}

.code-status.available {
    background: #d4edda;
    color: #155724;
}

.code-status.used {
    background: #f8d7da;
    color: #721c24;
}

.code-status.expired {
    background: #fff3cd;
    color: #856404;
}

/* Toggle switches */
.toggle-group {
    margin: 15px 0; /* было 20px */
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0; /* было 10px */
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 30px;  /* было 60px */
    height: 17px; /* было 34px */
}


.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 17px; /* было 34px */
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 13px;  /* было 26px */
    width: 13px;   /* было 26px */
    left: 2px;     /* было 4px */
    bottom: 2px;   /* было 4px */
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #6f42c1; /* Добавлено! Этот селектор отвечает за цвет */
}

input:checked + .toggle-slider:before {
    transform: translateX(13px);
}


/* Генерация кодов */
.generate-form {
    margin: 15px 0; /* было 20px */
}

.generated-codes {
    margin: 15px 0; /* было 20px */
    padding: 12px; /* было 15px */
    background: #f8f9fa;
    border-radius: 6px;
}

.generated-codes h5 {
    margin: 0 0 8px 0; /* было 0 0 10px 0 */
    color: #333;
}

.codes-list {
    max-height: 200px;
    overflow-y: auto;
}

.generated-code-item {
    padding: 6px; /* было 8px */
    margin: 4px 0; /* было 5px */
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px; /* было 12px */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.generated-code-item .copy-btn {
    padding: 2px 6px; /* было 2px 8px */
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px; /* было 11px */
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 21000;
}

.modal-content {
    background: white;
    padding: 20px; /* было 30px */
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-content h4 {
    margin: 0 0 15px 0; /* было 0 0 20px 0 */
    color: #333;
    padding-right: 20px;
    font-size: 16px; /* было 18px */
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 8px; /* было 10px */
    margin: 8px 0; /* было 10px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
    box-sizing: border-box;
}

.modal-content p {
    margin-bottom: 12px; /* было 15px */
    color: #666;
    font-size: 13px; /* было 14px */
}

.modal-actions {
    display: flex;
    gap: 8px; /* было 10px */
    margin-top: 15px; /* было 20px */
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 8px; /* было 10px */
    border-top: 1px solid #eee;
}

.modal-actions button {
    flex: 1;
    padding: 8px; /* было 12px */
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.modal-actions button:first-child {
    background: #6f42c1;
    color: white;
}

.modal-actions button:first-child:hover {
    background: #5a32a3;
}

.modal-actions button:last-child {
    background: #6c757d;
    color: white;
}

.modal-actions button:last-child:hover {
    background: #5a6268;
}

/* Модальное окно редактирования пользователя */
.edit-user-modal {
    max-width: 550px !important;
}

.edit-form {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.form-group {
    margin-bottom: 15px; /* было 20px */
}

.form-group label {
    display: block;
    margin-bottom: 4px; /* было 5px */
    color: #555;
    font-size: 12px; /* было 13px */
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px; /* было 10px 12px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
}

.form-group select {
    height: 38px; /* было 42px */
    background-color: white;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px; /* было 100px */
}

.status-display {
    padding: 6px 0; /* было 8px */
}

.role-select option[value="admin"] {
    color: #6f42c1;
    font-weight: bold;
}

.role-select option[value="moderator"] {
    color: #28a745;
}

/* Модальные окна настроек */
.settings-modal,
.generate-modal {
    max-width: 500px;
}

.settings-form {
    margin: 15px 0; /* было 20px */
}

/* Анимации */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Попап снизу (для маркеров вверху экрана) */
.marker-popup.popup-bottom {
    bottom: auto;
    top: 100%;
    margin-top: 15px;
    margin-bottom: 0;
}

.marker-popup.popup-bottom:after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent white transparent;
}

/* Панель сообщений */
.messages-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 700px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px; /* было 20px 25px */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.messages-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.close-messages-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close-messages-btn:hover {
    opacity: 1;
}

.messages-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f5f5f5;
}

/* Контакты */
.contacts-panel {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.contacts-search {
    display: flex;
    padding: 12px; /* было 15px */
    gap: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.contacts-search input {
    flex: 1;
    padding: 8px 10px; /* было 10px 12px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
}

.contacts-search button {
    padding: 8px 12px; /* было 10px 15px */
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px; /* было 16px */
    transition: background 0.2s;
}

.contacts-search button:hover {
    background: #5a32a3;
}

.contacts-tabs {
    display: flex;
    padding: 12px 12px 0; /* было 15px 15px 0 */
    gap: 8px; /* было 10px */
    border-bottom: 1px solid #e0e0e0;
}

.contacts-tab {
    flex: 1;
    padding: 8px; /* было 10px */
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.contacts-tab.active {
    color: #6f42c1;
    border-bottom-color: #6f42c1;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px; /* было 15px */
}

.loading-contacts {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px 12px; /* было 12px 15px */
    margin-bottom: 4px; /* было 5px */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa;
}

.contact-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.contact-item.active {
    background: #e3f2fd;
    border-left: 4px solid #6f42c1;
}

.contact-avatar {
    width: 40px; /* было 45px */
    height: 40px; /* было 45px */
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px; /* было 12px */
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px; /* было 14px */
}

.contact-role-badge {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    background: #6f42c1;
    color: white;
}

.contact-last-message {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.contact-unread {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

/* Чат */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px; /* было 15px 20px */
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.chat-contact-name {
    font-weight: 600;
    color: #333;
    font-size: 15px; /* было 16px */
    margin-right: 10px;
}

.chat-contact-status {
    font-size: 11px; /* было 12px */
    color: #28a745;
}

.chat-actions {
    display: flex;
    gap: 5px;
}

.chat-action-btn {
    padding: 5px 10px; /* было 6px 12px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px; /* было 14px */
    transition: all 0.2s;
}

.chat-action-btn.block-contact {
    background: #dc3545;
    color: white;
}

.chat-action-btn.block-contact:hover {
    background: #c82333;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px; /* было 20px */
    background: #f5f5f5;
}

.message {
    display: flex;
    margin-bottom: 12px; /* было 15px */
    align-items: flex-start;
    gap: 8px; /* было 10px */
}

.message.own-message {
    justify-content: flex-end;
}

.message-avatar {
    flex-shrink: 0;
    width: 32px; /* было 40px */
    height: 32px; /* было 40px */
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #6f42c1;
    background: #f0f0f0;
}

.message.own-message .message-avatar {
    border-color: #28a745;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    max-width: 70%;
    padding: 8px 12px; /* было 12px 16px */
    border-radius: 16px; /* было 18px */
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 13px; /* было 14px */
}

.message.own-message .message-content {
    background: #6f42c1;
    color: white;
    border-bottom-right-radius: 4px;
    order: -1;
}

.message.other-message .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-size: 10px; /* было 11px */
    font-weight: 600;
    margin-bottom: 2px; /* было 4px */
    color: #666;
}

.message.own-message .message-sender {
    display: none;
}

.message-text {
    line-height: 1.4; /* было 1.5 */
    font-size: 13px; /* было 14px */
}

.message-time {
    font-size: 9px; /* было 10px */
    opacity: 0.7;
    margin-top: 3px; /* было 5px */
    text-align: right;
}

.message.own-message .message-time {
    color: rgba(255,255,255,0.8);
}

.message.other-message .message-time {
    color: #999;
}

.message-actions {
    display: flex;
    gap: 4px; /* было 5px */
    margin-top: 4px; /* было 5px */
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    padding: 3px 6px; /* было 3px 8px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px; /* было 11px */
    font-weight: 500;
    transition: all 0.2s;
}

.message-action-btn.edit {
    background: #ffc107;
    color: #333;
}

.message-action-btn.edit:hover {
    background: #e0a800;
}

.message-action-btn.delete {
    background: #dc3545;
    color: white;
}

.message-action-btn.delete:hover {
    background: #c82333;
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    padding: 12px; /* было 15px */
    gap: 8px; /* было 10px */
    background: white;
    border-top: 1px solid #e0e0e0;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 8px; /* было 10px */
    padding: 6px; /* было 8px */
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ccc;
    transition: all 0.2s;
}

.file-upload-area.dragover {
    border-color: #6f42c1;
    background: #e8f0fe;
}

.file-upload-btn {
    padding: 6px 10px; /* было 8px 12px */
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px; /* было 16px */
    transition: background 0.2s;
}

.file-upload-btn:hover {
    background: #5a32a3;
}

.drag-drop-hint {
    color: #999;
    font-size: 12px;
    flex: 1;
}

.chat-input-area textarea {
    flex: 1;
    padding: 8px 10px; /* было 12px */
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 13px; /* было 14px */
    line-height: 1.5;
    transition: border-color 0.2s;
    min-height: 32px; /* добавлено */
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: #6f42c1;
}

.chat-input-area button {
    padding: 8px 20px; /* было 12px 25px */
    background: #6f42c1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    align-self: flex-end;
    transition: background 0.2s;
}

.chat-input-area button:hover {
    background: #5a32a3;
}

.chat-input-area button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Панель поиска пользователей */
.search-users-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90%;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 21000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px; /* было 15px 20px */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.search-users-header h4 {
    margin: 0;
    font-size: 15px; /* было 16px */
    font-weight: 500;
}

.close-search-users {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: white;
    opacity: 0.8;
}

.search-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px; /* было 15px */
}

.search-user-item {
    display: flex;
    align-items: center;
    padding: 12px; /* было 15px */
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.search-user-item:hover {
    background: #f8f9fa;
}

.search-user-info {
    flex: 1;
}

.search-user-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px; /* было 3px */
    font-size: 13px; /* было 14px */
}

.search-user-email {
    font-size: 12px;
    color: #666;
}

.search-user-actions {
    display: flex;
    gap: 5px;
}

.search-user-btn {
    padding: 5px 10px; /* было 6px 12px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
    transition: all 0.2s;
}

.search-user-btn.friend-request {
    background: #28a745;
    color: white;
}

.search-user-btn.friend-request:hover {
    background: #218838;
}

.search-user-btn.block {
    background: #dc3545;
    color: white;
}

.search-user-btn.block:hover {
    background: #c82333;
}

.search-user-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: #e2e3e5;
    color: #383d41;
    margin-left: 10px;
}

.search-user-status.friend {
    background: #d4edda;
    color: #155724;
}

.search-user-status.pending {
    background: #fff3cd;
    color: #856404;
}

.search-user-status.blocked {
    background: #f8d7da;
    color: #721c24;
}

/* Кнопка сообщений */
.messages-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    margin: 8px 0; /* было 10px */
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* Кнопка разблокировки */
.unblock-btn {
    padding: 5px 10px; /* было 6px 12px */
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
    transition: background 0.2s;
    margin-left: 10px;
}

.unblock-btn:hover {
    background: #218838;
}

/* Чёрный список */
.contact-item.blocked-item {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    display: flex;
    align-items: center;
    padding: 10px 12px; /* было 12px 15px */
    gap: 8px; /* было 10px */
}

.contact-item.blocked-item .contact-avatar {
    width: 35px; /* было 40px */
    height: 35px; /* было 40px */
    min-width: 35px; /* было 40px */
    border-radius: 50%;
    background: #dc3545;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px; /* было 18px */
    margin-right: 0;
}

.contact-item.blocked-item .contact-info {
    flex: 1;
    min-width: 0;
}

.contact-item.blocked-item .contact-name {
    color: #721c24;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px; /* добавлено */
}

.contact-item.blocked-item .contact-last-message {
    font-size: 11px;
    color: #dc3545;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-item.blocked-item .unblock-btn {
    padding: 5px 10px; /* было 6px 12px */
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    min-width: 100px; /* было 110px */
    height: 30px; /* было 32px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-item.blocked-item .unblock-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Кнопка очистки чата */
.clear-chat-btn {
    padding: 5px 10px; /* было 6px 12px */
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
    margin-left: 10px;
    transition: background 0.2s;
}

.clear-chat-btn:hover {
    background: #5a6268;
}

/* Режим редактирования сообщения */
.message-content.editing {
    background: #fff3cd !important;
    border: 2px solid #ffc107;
}

.edit-message-textarea {
    width: 100%;
    padding: 6px; /* было 8px */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px; /* было 14px */
    resize: vertical;
    margin-bottom: 5px;
}

.edit-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}

.edit-actions button {
    padding: 4px 8px; /* было 4px 10px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px; /* было 12px */
}

.edit-actions .save-edit {
    background: #28a745;
    color: white;
}

.edit-actions .cancel-edit {
    background: #6c757d;
    color: white;
}

/* Превью загрузки */
.upload-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px; /* было 10px 15px */
    background: #e8f0fe;
    border-radius: 8px;
    border-left: 4px solid #6f42c1;
    margin-top: 5px;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px; /* было 3px */
}

.preview-name {
    font-weight: 600;
    color: #333;
    font-size: 12px; /* было 13px */
}

.preview-size {
    font-size: 10px; /* было 11px */
    color: #666;
}

.preview-cancel {
    padding: 4px 6px; /* было 4px 8px */
    background: none;
    border: none;
    font-size: 14px; /* было 16px */
    cursor: pointer;
    color: #dc3545;
    transition: color 0.2s;
}

.preview-cancel:hover {
    color: #c82333;
}

/* Изображения в сообщениях */
.message-image {
    max-width: 100%;
    max-height: 250px; /* было 300px */
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 5px;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-image.own-message {
    border: 2px solid white;
}

/* Видео в сообщениях */
.message-video-container {
    max-width: 100%;
    margin: 5px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.message-video {
    width: 100%;
    max-height: 250px; /* было 300px */
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

.message.own-message .message-video {
    border: 2px solid white;
}

.video-info {
    padding: 4px 8px; /* было 5px 10px */
    font-size: 10px; /* было 11px */
    color: #666;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message.own-message .video-info {
    background: #6f42c1;
    color: rgba(255,255,255,0.8);
    border-top-color: #5a32a3;
}

/* Лайтбокс для просмотра изображений */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

/* Счетчик маркеров в админке */
.markers-count {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 12px;
    font-size: 11px; /* было 12px */
    font-weight: 600;
    min-width: 25px; /* было 30px */
    text-align: center;
}

.markers-count-low {
    background: #e3f2fd;
    color: #0d47a1;
}

.markers-count-medium {
    background: #fff3e0;
    color: #e65100;
}

.markers-count-high {
    background: #ffebee;
    color: #b71c1c;
}

/* Таблица тарифов */
.tariffs-table-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px; /* было 20px */
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.tariffs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px; /* было 14px */
}

.tariffs-table th {
    background: #f8f9fa;
    padding: 10px; /* было 12px */
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tariffs-table td {
    padding: 8px; /* было 12px */
    border-bottom: 1px solid #dee2e6;
    color: #555;
}

.tariffs-table tr:hover {
    background: #f8f9fa;
}

/* Статусы тарифов */
.tariff-badge {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 12px;
    font-size: 10px; /* было 11px */
    font-weight: 500;
    margin-right: 5px;
}

.tariff-badge.default {
    background: #fff3cd;
    color: #856404;
}

.tariff-badge.system {
    background: #cce5ff;
    color: #004085;
}

.tariff-users-count {
    font-weight: 600;
    color: #6f42c1;
}

/* Кнопки действий для тарифов */
.tariff-actions {
    display: flex;
    gap: 4px; /* было 5px */
    flex-wrap: wrap;
}

.tariff-action-btn {
    padding: 3px 6px; /* было 4px 8px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px; /* было 11px */
    font-weight: 500;
    transition: all 0.2s;
}

.tariff-action-btn.edit {
    background: #6f42c1;
    color: white;
}

.tariff-action-btn.delete {
    background: #dc3545;
    color: white;
}

.tariff-action-btn.default {
    background: #ffc107;
    color: #333;
}

.tariff-action-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.tariff-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Стили для тарифа в таблице пользователей */
.tariff-badge {
    display: inline-block;
    padding: 3px 6px; /* было 4px 8px */
    border-radius: 12px;
    font-size: 10px; /* было 11px */
    font-weight: 500;
    background: #e3f2fd;
    color: #0d47a1;
}

/* Стили для выбора тарифа */
.tariff-select {
    width: 100%;
    padding: 8px 10px; /* было 10px 12px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
    background-color: white;
    cursor: pointer;
}

.tariff-select:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
}

/* Кнопка удаления моих маркеров */
.delete-my-markers-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    margin: 8px 0; /* было 10px */
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.delete-my-markers-btn:hover {
    background: #c82333;
}

/* Кнопка удаления маркеров пользователя в админке */
.action-btn.delete-markers {
    background: #fd7e14;
    color: white;
}

.action-btn.delete-markers:hover {
    background: #e06b0a;
}

/* Индикатор типа файла в превью */
.file-type-icon {
    display: inline-block;
    vertical-align: middle;
}

/* Индикатор загрузки сообщений */
.loading-messages {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.loading-more {
    text-align: center;
    padding: 12px; /* было 15px */
    color: #666;
    font-size: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 8px 0; /* было 10px */
    animation: pulse 1.5s infinite;
}

/* Даты в попапе маркера */
.popup-content {
    display: flex;
    flex-direction: column;
    gap: 8px; /* было 10px */
}

.popup-description {
    color: #666;
    font-size: 14px; /* было 16px */
    line-height: 1.5;
    word-wrap: break-word;
}

.popup-dates {
    margin-top: 5px;
    padding-top: 6px; /* было 8px */
    border-top: 1px solid #dee2e6;
    font-size: 11px;
    color: #999;
}

.popup-date {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px; /* было 3px */
}

.popup-date.edited {
    color: #6f42c1;
}

/* ============== ЛИЧНЫЙ КАБИНЕТ ============== */
.profile-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    margin: 8px 0; /* было 10px */
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.profile-btn:hover {
    background: #218838;
}

.profile-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1100px;
    max-width: 95%;
    height: 80vh;
    max-height: 800px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 21000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px; /* было 20px 25px */
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
}

.profile-header h3 {
    margin: 0;
    font-size: 18px; /* было 20px */
    font-weight: 500;
}

.close-profile-btn {
    background: none;
    border: none;
    font-size: 24px; /* было 28px */
    cursor: pointer;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0 8px; /* было 0 10px */
}

.close-profile-btn:hover {
    opacity: 1;
}

.profile-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 15px; /* было 20px */
    gap: 15px; /* было 20px */
}

/* Левая колонка */
.profile-left {
    width: 280px; /* было 300px */
    overflow-y: auto;
    padding-right: 10px;
}

.profile-avatar-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px; /* было 20px */
    margin-bottom: 15px; /* было 20px */
    text-align: center;
}

.profile-avatar-container {
    width: 120px; /* было 150px */
    height: 120px; /* было 150px */
    margin: 0 auto 12px; /* было 0 auto 15px */
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #28a745;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-actions {
    display: flex;
    gap: 8px; /* было 10px */
    justify-content: center;
    margin-bottom: 8px; /* было 10px */
}

.avatar-btn {
    padding: 6px 12px; /* было 8px 15px */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px; /* было 13px */
    font-weight: 500;
    transition: all 0.2s;
}

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

.avatar-btn.upload:hover {
    background: #218838;
}

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

.avatar-btn.delete:hover {
    background: #c82333;
}

.avatar-hint {
    font-size: 11px;
    color: #999;
    margin-top: 8px; /* было 10px */
}

.profile-info-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px; /* было 20px */
    margin-bottom: 15px; /* было 20px */
}

.profile-info-section h4 {
    margin: 0 0 12px 0; /* было 0 0 15px 0 */
    color: #333;
    font-size: 15px; /* было 16px */
    border-bottom: 2px solid #28a745;
    padding-bottom: 6px; /* было 8px */
}

.profile-info-item {
    display: flex;
    margin-bottom: 8px; /* было 10px */
    padding: 4px 0; /* было 5px */
    border-bottom: 1px solid #dee2e6;
}

.info-label {
    width: 70px; /* было 80px */
    color: #666;
    font-size: 12px; /* было 13px */
}

.info-value {
    flex: 1;
    color: #333;
    font-weight: 600;
    font-size: 13px; /* было 14px */
    word-break: break-all;
}

.profile-password-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px; /* было 20px */
}

.profile-password-section h4 {
    margin: 0 0 12px 0; /* было 0 0 15px 0 */
    color: #333;
    font-size: 15px; /* было 16px */
    border-bottom: 2px solid #ffc107;
    padding-bottom: 6px; /* было 8px */
}

.profile-password-section input {
    width: 100%;
    padding: 8px; /* было 10px */
    margin-bottom: 8px; /* было 10px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
    box-sizing: border-box;
}

.profile-password-section input:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255,193,7,0.1);
}

.password-change-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
}

.password-change-btn:hover {
    background: #e0a800;
}

/* Правая колонка */
.profile-right {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.profile-right h4 {
    margin: 0 0 12px 0; /* было 0 0 15px 0 */
    color: #333;
    font-size: 16px; /* было 18px */
}

.profile-markers-table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 12px; /* было 15px */
}

.profile-markers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px; /* было 13px */
}

.profile-markers-table th {
    background: #f8f9fa;
    padding: 10px; /* было 12px */
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.profile-markers-table td {
    padding: 8px; /* было 12px */
    border-bottom: 1px solid #dee2e6;
    color: #555;
}

.profile-markers-table tr:hover {
    background: #f8f9fa;
}

.profile-markers-table .action-btn {
    padding: 3px 6px; /* было 4px 8px */
    margin: 0 2px;
    font-size: 10px; /* было 11px */
    min-width: 25px; /* было 30px */
}

.profile-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* было 20px */
    padding: 8px 0; /* было 10px */
}

#profileMarkerPageInfo {
    font-size: 12px; /* было 13px */
    color: #666;
}

/* ============== ГАМБУРГЕР-МЕНЮ ============== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10002;
    position: absolute;
    top: 15px;
    right: 15px;
}

.menu-toggle span {
    width: 30px;
    height: 4px;
    background: #4285f4;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: block;
    margin: 0;
}

.menu-toggle.active span:first-child {
    transform: rotate(45deg) translate(6px, 6px);
    background: #dc3545;
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    background: #dc3545;
}

.mobile-header {
    display: none;
}

/* Бейдж для гамбургер-меню */
.menu-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-sizing: border-box;
    z-index: 10003;
    line-height: 1;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

/* Бейдж для кнопки сообщений */
.messages-btn {
    position: relative;
}

.messages-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: pulse 1.5s infinite;
}

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

/* Аватары в контактах */
.contact-avatar:has(.contact-avatar-img[src$="default-avatar.svg"]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 16px; /* было 18px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-avatar-letter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

/* Обновим стили для заблокированных */
.contact-item.blocked-item .contact-avatar {
    background: #dc3545;
}

.contact-item.blocked-item .contact-avatar-img {
    filter: grayscale(100%);
    opacity: 0.7;
}

/* Удаленные сообщения */
.message.deleted-message .message-content {
    opacity: 0.8;
    background: #f5f5f5 !important;
    border: 1px dashed #999;
}

.message.deleted-message .message-content em {
    color: #666;
    display: block;
    text-align: center;
}

.message.own-message.deleted-message .message-content {
    background: #e0e0e0 !important;
}

/* ============== ГЕОЛОКАЦИЯ ============== */

/* Контейнер для кнопки геолокации */
.geolocation-control {
    margin-bottom: 10px !important;
    margin-right: 10px !important;
    z-index: 2000 !important;
}

/* Кнопка геолокации */
.geolocation-btn {
    width: 40px !important;
    height: 40px !important;
    background: white !important;
    border: 2px solid #4285f4 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    -webkit-tap-highlight-color: transparent !important;
}

.geolocation-btn:hover {
    background: #f0f0f0 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(66, 133, 244, 0.3) !important;
}

.geolocation-btn:active {
    transform: scale(0.95) !important;
    background: #e8f0fe !important;
}

/* Маркер местоположения пользователя */
/* Маркер местоположения пользователя */
.user-location-marker {
    position: relative;
    cursor: pointer;
    z-index: 2000;
    width: 0;
    height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #4285f4;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    animation: pulse-dot 2s infinite;
    z-index: 2002;
    /* Центрирование уже есть через transform */
}

.accuracy-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(66, 133, 244, 0.3);
    background: rgba(66, 133, 244, 0.1);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse-ring 2s infinite;
    z-index: 2001;
    /* Центрирование уже есть через transform */
    /* Размер будет задаваться через JS */
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
}

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

/* Подсказка при наведении на маркер */
.location-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 12px;
    white-space: nowrap;
    display: none;
    margin-bottom: 15px;
    z-index: 2003;
    border: 1px solid #e0e0e0;
    pointer-events: none;
}

.location-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.user-location-marker:hover .location-tooltip {
    display: block;
}

.location-accuracy {
    color: #28a745;
    font-weight: bold;
    font-size: 11px;
    margin-top: 3px;
}

.location-coords {
    color: #666;
    font-size: 10px;
    margin-top: 3px;
    font-family: monospace;
}

/* Статус геолокации */
.location-status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 30000;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
    border: 2px solid transparent;
}

.location-status.info {
    border-color: #4285f4;
    color: #4285f4;
    background: #e8f0fe;
}

.location-status.success {
    border-color: #28a745;
    color: #28a745;
    background: #d4edda;
}

.location-status.error {
    border-color: #dc3545;
    color: #dc3545;
    background: #f8d7da;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ============== МОБИЛЬНАЯ АДАПТАЦИЯ ============== */
@media screen and (max-width: 768px) {
    /* Показываем гамбургер только на мобильных */
    .menu-toggle {
        display: flex;
    }
    
    .mobile-header {
        display: block;
        margin: -15px -15px 15px -15px;
        padding: 15px;
        background: linear-gradient(135deg, #4285f4 0%, #6f42c1 100%);
        color: white;
        border-radius: 12px 12px 0 0;
    }
    
    .mobile-header h3 {
        font-size: 18px;
        margin: 0;
        color: white;
    }
    
    /* Панель авторизации */
    .auth-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        min-width: auto;
        padding: 15px;
        max-width: none;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        transition: all 0.3s ease;
        overflow: hidden;
    }
    
    .auth-panel.collapsed {
        width: 60px;
        height: 60px;
        padding: 0;
        background: #4285f4;
        border-radius: 50%;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    
    .auth-panel.collapsed .menu-toggle span {
        background: white;
    }
    
    .auth-panel.collapsed .menu-content,
    .auth-panel.collapsed .mobile-header {
        display: none;
    }
    
    .auth-panel:not(.collapsed) {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .auth-panel .menu-content {
        transition: opacity 0.3s ease;
        margin-top: 40px;
    }
    
    .auth-panel.collapsed .menu-content {
        opacity: 0;
        pointer-events: none;
    }
    
    /* Бейдж для мобильных - увеличенный размер */
    .menu-badge {
        bottom: -10px;
        right: -10px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    /* Панель добавления маркера */
    .marker-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 15px; /* было 20px */
        animation: slideUp 0.3s ease;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Админ-панель - на весь экран */
    .admin-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        transform: none !important;
        margin: 0 !important;
        padding: 10px !important;
        overflow: hidden !important;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px; /* было 10px */
        padding-right: 30px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 100;
        padding-bottom: 8px; /* было 10px */
        margin-bottom: 8px; /* было 10px */
    }
    
    .admin-header h3 {
        font-size: 18px; /* было 20px */
        margin-right: 40px;
    }
    
    .admin-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 4px; /* было 5px */
        width: 100%;
        margin: 0;
    }
    
    .tab-btn {
        flex: 1 1 auto;
        font-size: 11px;
        padding: 6px 4px; /* было 8px 4px */
        white-space: nowrap;
    }
    
    .close-admin-btn {
        position: absolute;
        top: 15px;
        right: 15px;
    }
    
    .admin-search {
        flex-direction: column;
        gap: 6px; /* было 8px */
        margin-bottom: 12px; /* было 15px */
    }
    
    .admin-search input {
        width: 100%;
        font-size: 14px; /* было 16px */
        padding: 10px; /* было 12px */
    }
    
    .admin-search button {
        width: 100%;
        padding: 10px; /* было 12px */
        font-size: 14px; /* было 16px */
    }
    
    .admin-stats {
        margin-bottom: 12px; /* было 15px */
        padding: 8px; /* было 10px */
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    /* Таблицы в админке с горизонтальным скроллом */
    .users-table-container,
    .codes-table-container,
    .tariffs-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        margin: 8px 0 !important; /* было 10px */
        border: 1px solid #dee2e6 !important;
        max-height: calc(100vh - 250px) !important;
    }
    
    .users-table,
    .codes-table,
    .tariffs-table {
        min-width: 900px !important;
    }
    
    .users-table th,
    .codes-table th,
    .tariffs-table th {
        font-size: 11px;
        padding: 6px 4px; /* было 8px 5px */
        white-space: nowrap;
    }
    
    .users-table td,
    .codes-table td,
    .tariffs-table td {
        font-size: 11px;
        padding: 6px 4px; /* было 8px 5px */
        white-space: nowrap;
    }
    
    .users-table td .action-btn {
        padding: 4px 6px; /* было 5px 8px */
        font-size: 9px; /* было 10px */
        min-width: 35px; /* было 40px */
    }
    
    .users-table td:last-child {
        min-width: 120px; /* было 130px */
    }
    
    /* Пагинация */
    .admin-pagination {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 8px; /* было 10px */
        margin-top: 8px; /* было 10px */
        border-top: 1px solid #dee2e6;
        z-index: 99;
        gap: 8px; /* было 10px */
    }
    
    .page-btn {
        padding: 8px 12px; /* было 10px 15px */
        font-size: 12px; /* было 13px */
    }
    
    /* Панель сообщений - на весь экран */
    .messages-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }
    
    .messages-header {
        padding: 12px; /* было 15px */
        flex-shrink: 0;
    }
    
    .messages-header h3 {
        font-size: 16px; /* было 18px */
    }
    
    .close-messages-btn {
        font-size: 24px; /* было 28px */
        padding: 5px 12px; /* было 5px 15px */
    }
    
    .messages-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: calc(100% - 50px) !important; /* было 60px */
    }
    
    /* Контакты */
    .contacts-panel {
        width: 100% !important;
        height: 40% !important;
        flex-shrink: 0;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .contacts-search {
        padding: 8px; /* было 10px */
        flex-shrink: 0;
    }
    
    .contacts-search input {
        font-size: 14px; /* было 16px */
        padding: 10px; /* было 12px */
    }
    
    .contacts-search button {
        padding: 10px 12px; /* было 12px 15px */
    }
    
    .contacts-tabs {
        padding: 8px 8px 0; /* было 10px 10px 0 */
        flex-shrink: 0;
    }
    
    .contacts-tab {
        padding: 8px 4px; /* было 10px 5px */
        font-size: 12px; /* было 13px */
    }
    
    .contacts-list {
        flex: 1;
        overflow-y: auto !important;
        padding: 8px; /* было 10px */
        -webkit-overflow-scrolling: touch !important;
    }
    
    .contact-item {
        padding: 10px; /* было 12px */
        margin-bottom: 4px; /* было 5px */
    }
    
    .contact-avatar {
        width: 32px; /* было 35px */
        height: 32px; /* было 35px */
        min-width: 32px; /* было 35px */
        font-size: 14px; /* было 16px */
    }
    
    .contact-name {
        font-size: 13px; /* было 14px */
    }
    
    .contact-last-message {
        font-size: 12px;
        max-width: 150px;
    }
    
    /* Чат */
    .chat-panel {
        height: 60% !important;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .chat-header {
        padding: 8px 12px; /* было 10px 15px */
        flex-shrink: 0;
    }
    
    .chat-contact-name {
        font-size: 14px; /* было 15px */
    }
    
    .chat-actions {
        gap: 4px; /* было 5px */
    }
    
    .chat-action-btn {
        padding: 5px 8px; /* было 6px 10px */
        font-size: 12px; /* было 13px */
    }
    
    .chat-messages {
        flex: 1;
        overflow-y: auto !important;
        padding: 8px; /* было 10px */
        -webkit-overflow-scrolling: touch !important;
    }
    
    .message {
        margin-bottom: 8px; /* было 10px */
    }
    
    .message-avatar {
        width: 28px; /* было 30px */
        height: 28px; /* было 30px */
    }
    
    .message-content {
        max-width: 75%;
        padding: 8px 10px; /* было 10px 12px */
        font-size: 12px; /* было 13px */
        word-wrap: break-word !important;
    }
    
    .message-sender {
        font-size: 10px; /* было 11px */
    }
    
    .message-text {
        font-size: 12px; /* было 13px */
    }
    
    .message-time {
        font-size: 9px; /* было 10px */
    }
    
    .message-actions {
        opacity: 1;
        gap: 4px; /* было 5px */
        margin-top: 4px; /* было 5px */
    }
    
    .message-action-btn {
        padding: 4px 8px; /* было 5px 10px */
        font-size: 10px; /* было 11px */
    }
    
    /* Область ввода */
    .chat-input-area {
        padding: 8px; /* было 10px */
        flex-shrink: 0;
        flex-direction: column !important;
    }
    
    .file-upload-area {
        padding: 4px; /* было 5px */
    }
    
    .file-upload-btn {
        padding: 6px 10px; /* было 8px 12px */
        font-size: 14px; /* было 16px */
    }
    
    .drag-drop-hint {
        display: none;
    }
    
    .chat-input-area textarea {
        width: 100% !important;
        font-size: 13px; /* было 14px */
        padding: 6px; /* было 8px */
        margin-bottom: 4px; /* было 5px */
        min-height: 34px; /* было 36px */
    }
    
    .chat-input-area button {
        width: 100% !important;
        padding: 10px; /* было 12px */
        font-size: 13px; /* было 14px */
    }
    
    /* Панель поиска пользователей */
    .search-users-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        transform: none !important;
        z-index: 21000;
        overflow: hidden;
    }
    
    .search-users-header {
        padding: 12px; /* было 15px */
        flex-shrink: 0;
    }
    
    .search-users-header h4 {
        font-size: 15px; /* было 16px */
    }
    
    .close-search-users {
        font-size: 22px; /* было 24px */
    }
    
    .search-users-list {
        height: calc(100% - 60px) !important; /* было 70px */
        overflow-y: auto !important;
        padding: 12px; /* было 15px */
        -webkit-overflow-scrolling: touch !important;
    }
    
    .search-user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px; /* было 10px */
        padding: 10px; /* было 12px */
        margin-bottom: 6px; /* было 8px */
    }
    
    .search-user-name {
        font-size: 14px; /* было 15px */
    }
    
    .search-user-email {
        font-size: 12px; /* было 13px */
    }
    
    .search-user-status {
        align-self: flex-start;
        font-size: 11px;
        padding: 3px 8px;
        margin-left: 0;
    }
    
    .search-user-actions {
        width: 100%;
        gap: 4px; /* было 5px */
    }
    
    .search-user-btn {
        flex: 1;
        padding: 8px; /* было 10px */
        font-size: 12px; /* было 13px */
    }
    
    /* Черный список */
    .contact-item.blocked-item {
        padding: 10px; /* было 12px */
    }
    
    .contact-item.blocked-item .contact-avatar {
        width: 32px; /* было 35px */
        height: 32px; /* было 35px */
        min-width: 32px; /* было 35px */
        font-size: 14px; /* было 16px */
    }
    
    .contact-item.blocked-item .contact-info {
        width: calc(100% - 40px); /* было 45px */
    }
    
    .contact-item.blocked-item .unblock-btn {
        padding: 6px 8px; /* было 8px 10px */
        font-size: 11px; /* было 12px */
        min-width: 80px; /* было 90px */
        height: auto;
    }
    
    /* Модальные окна */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 15px;
        max-height: 90vh;
    }
    
    .modal-content h4 {
        font-size: 16px;
        margin-bottom: 12px; /* было 15px */
    }
    
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 14px; /* было 16px */
        padding: 10px; /* было 12px */
        margin: 6px 0; /* было 8px */
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 6px; /* было 8px */
        margin-top: 12px; /* было 15px */
    }
    
    .modal-actions button {
        padding: 10px; /* было 12px */
        font-size: 13px; /* было 14px */
    }
    
    /* Маркеры на карте */
    .marker-container {
        min-width: 44px;
        min-height: 44px;
    }
    
    .marker-dot {
        width: 16px !important;
        height: 16px !important;
    }
    
    .marker-text {
        min-width: 100px;
        max-width: 150px;
        padding: 5px 8px;
    }
    
    .marker-username span span:first-child {
        font-size: 12px;
    }
    
    .marker-username span span:last-child {
        font-size: 11px;
    }
    
    .marker-title {
        font-size: 12px;
    }
    
    .marker-popup {
        width: 250px;
    }
    
    .popup-title {
        font-size: 16px;
    }
    
    .popup-content {
        font-size: 14px;
        max-height: 120px;
    }
    
    .popup-actions button {
        padding: 8px; /* было 10px */
        font-size: 13px; /* было 14px */
    }
    
    /* ============== ГЕОЛОКАЦИЯ НА МОБИЛЬНЫХ ============== */
    
    /* Поднимаем кнопку геолокации выше, чтобы не перекрывалась системной панелью Android */
    .maplibregl-ctrl-bottom-right {
        bottom: 70px !important;
        right: 15px !important;
        z-index: 2000 !important;
    }
    
    .geolocation-control {
        margin-bottom: 0 !important;
        margin-right: 0 !important;
    }
    
    .geolocation-btn {
        width: 56px !important;
        height: 56px !important;
        font-size: 28px !important;
        border-width: 3px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
        border-radius: 50% !important;
    }
    
    /* Добавляем отступ для безопасной зоны на современных Android */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .maplibregl-ctrl-bottom-right {
            bottom: calc(70px + env(safe-area-inset-bottom)) !important;
        }
    }
    
    /* Статус геолокации на мобильных */
    .location-status {
        top: 60px !important;
        font-size: 14px !important;
        padding: 12px 20px !important;
        border-radius: 25px !important;
        max-width: 90% !important;
        text-align: center !important;
        word-break: break-word !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    }
    
    /* Маркер местоположения на мобильных */
    .location-dot {
        width: 20px !important;
        height: 20px !important;
        border-width: 4px !important;
    }
    
    .location-tooltip {
        font-size: 11px !important;
        padding: 6px 10px !important;
        white-space: normal !important;
        min-width: 180px !important;
    }
    
    /* Исправления для iPhone с safe area */
    @supports (padding: max(0px)) {
        .admin-header {
            padding-top: max(15px, env(safe-area-inset-top));
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }
        
        .messages-header {
            padding-top: max(15px, env(safe-area-inset-top));
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
        }
        
        .search-users-header {
            padding-top: max(15px, env(safe-area-inset-top));
        }
        
        .close-admin-btn {
            top: max(15px, env(safe-area-inset-top));
            right: max(15px, env(safe-area-inset-right));
        }
        
        .chat-input-area {
            padding-bottom: max(10px, env(safe-area-inset-bottom));
        }
        
        .maplibregl-ctrl-bottom-right {
            bottom: max(70px, env(safe-area-inset-bottom)) !important;
        }
    }
}

/* Для очень маленьких экранов */
@media screen and (max-width: 380px) {
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 calc(50% - 5px);
    }
    
    .contact-item {
        padding: 8px; /* было 10px */
    }
    
    .contact-avatar {
        width: 28px; /* было 30px */
        height: 28px; /* было 30px */
        min-width: 28px; /* было 30px */
        font-size: 13px; /* было 14px */
    }
    
    .contact-name {
        font-size: 12px; /* было 13px */
    }
    
    .message-content {
        max-width: 90%;
        padding: 6px 8px; /* было 8px 10px */
    }
    
    .message-avatar {
        width: 24px; /* было 25px */
        height: 24px; /* было 25px */
    }
    
    .search-user-item {
        padding: 8px; /* было 10px */
    }
    
    .search-user-actions {
        flex-direction: column;
    }
    
    .search-user-btn {
        width: 100%;
    }
    
    .modal-content {
        padding: 12px;
    }
    
    .menu-badge {
        bottom: -5px;
        right: -5px;
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    /* Геолокация на очень маленьких экранах */
    .maplibregl-ctrl-bottom-right {
        bottom: 65px !important;
        right: 10px !important;
    }
    
    .geolocation-btn {
        width: 52px !important;
        height: 52px !important;
        font-size: 26px !important;
    }
}

/* Альбомная ориентация */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .messages-panel {
        flex-direction: row;
    }
    
    .contacts-panel {
        width: 35% !important;
        height: 100% !important;
    }
    
    .chat-panel {
        width: 65% !important;
        height: 100% !important;
    }
    
    .contacts-list {
        height: calc(100% - 100px) !important; /* было 110px */
    }
    
    .chat-messages {
        height: calc(100% - 90px) !important; /* было 100px */
    }
    
    .auth-panel {
        top: 5px;
        right: 5px;
        max-width: 300px;
    }
    
    /* Геолокация в альбомной ориентации */
    .maplibregl-ctrl-bottom-right {
        bottom: 50px !important;
        right: 15px !important;
    }
    
    .geolocation-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
    }
}

/* Убираем hover эффекты на мобильных */
@media (hover: none) and (pointer: coarse) {
    .contact-item:hover,
    .search-user-item:hover,
    .action-btn:hover,
    .chat-action-btn:hover,
    .tab-btn:hover,
    .page-btn:hover,
    .geolocation-btn:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .contact-item:active,
    .search-user-item:active,
    .action-btn:active,
    .chat-action-btn:active,
    .tab-btn:active,
    .page-btn:active,
    .geolocation-btn:active {
        opacity: 0.7;
        transform: scale(0.95) !important;
    }
    
    .user-location-marker:hover .location-tooltip {
        display: none;
    }
    
    .user-location-marker:active .location-tooltip {
        display: block;
    }
}

/* Убираем анимации если пользователь предпочитает уменьшенное движение */
@media (prefers-reduced-motion: reduce) {
    .location-dot,
    .accuracy-ring,
    .messages-badge,
    .marker-dot,
    .geolocation-btn {
        animation: none !important;
    }
    
    .geolocation-btn:hover {
        transform: none !important;
    }
}

/* ============== ПАНЕЛЬ ПОИСКА МАРКЕРОВ ============== */
.search-markers-toggle {
    position: absolute;
    top: 20px;
    left: 390px;
    z-index: 10001;
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid #4285f4;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.search-markers-toggle:hover {
    background: #f0f0f0;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.search-markers-panel {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 10002;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 400px;
    max-width: calc(100% - 40px);
    max-height: 500px;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

.search-markers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px; /* было 15px 20px */
    background: linear-gradient(135deg, #4285f4 0%, #6f42c1 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.search-markers-header h3 {
    margin: 0;
    font-size: 16px; /* было 18px */
    font-weight: 500;
}

.close-search-markers {
    background: none;
    border: none;
    font-size: 22px; /* было 24px */
    cursor: pointer;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0 5px;
}

.close-search-markers:hover {
    opacity: 1;
}

.search-markers-input-group {
    display: flex;
    padding: 12px; /* было 15px */
    gap: 8px; /* было 10px */
    border-bottom: 1px solid #e0e0e0;
}

.search-markers-input-group input {
    flex: 1;
    padding: 8px 10px; /* было 12px */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px; /* было 14px */
}

.search-markers-input-group input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66,133,244,0.1);
}

.search-markers-input-group button {
    padding: 8px 16px; /* было 12px 20px */
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
}

.search-markers-input-group button:hover {
    background: #3367d6;
}

.search-markers-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px; /* было 15px */
}

.search-markers-stats {
    padding: 8px; /* было 10px */
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 12px; /* было 15px */
    font-size: 12px; /* было 13px */
    color: #666;
}

.search-markers-stats span {
    font-weight: bold;
    color: #4285f4;
}

.search-markers-list {
    display: flex;
    flex-direction: column;
    gap: 8px; /* было 10px */
}

.search-marker-item {
    padding: 12px; /* было 15px */
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4285f4;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-marker-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background: #e8f0fe;
}

.search-marker-item:active {
    transform: translateY(0);
}

.search-marker-author {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px; /* было 5px */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-marker-author strong {
    color: #4285f4;
    font-size: 12px; /* было 13px */
}

.search-marker-author span {
    font-size: 11px;
    color: #999;
}

.search-marker-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px; /* было 5px */
    font-size: 14px; /* было 15px */
}

.search-marker-description {
    font-size: 12px; /* было 13px */
    color: #666;
    margin-bottom: 6px; /* было 8px */
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.search-marker-coords {
    font-size: 11px;
    color: #999;
    font-family: monospace;
    background: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
}

.search-markers-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px; /* было 15px */
    padding: 12px 0 4px; /* было 15px 0 5px */
    border-top: 1px solid #e0e0e0;
    margin-top: 12px; /* было 15px */
}

.search-markers-pagination .page-btn {
    padding: 6px 12px; /* было 8px 15px */
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px; /* было 13px */
}

.search-markers-pagination .page-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.search-markers-pagination .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#searchPageInfo {
    font-size: 12px; /* было 13px */
    color: #666;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.loading-search {
    text-align: center;
    padding: 30px;
    color: #999;
}

@media screen and (max-width: 768px) {
    .search-markers-toggle {
        top: 80px;
        left: 20px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .search-markers-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        z-index: 20001;
    }
}

/* Кнопка поиска маркеров в главном меню */
.search-markers-menu-btn {
    width: 100%;
    padding: 10px; /* было 12px */
    margin: 8px 0; /* было 10px */
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* было 14px */
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-markers-menu-btn:hover {
    background: #3367d6;
}


/* ============== КУРСОР ДЛЯ КАРТЫ ============== */

/* Обычный режим - стрелочка */
.maplibregl-canvas-container,
.maplibregl-canvas,
#map canvas {
    cursor: default !important;
}

/* При зажатой кнопке мыши (перемещение) - кулачок */
.maplibregl-canvas-container:active,
.maplibregl-canvas:active,
#map canvas:active {
    cursor: grabbing !important;
}

/* ============== ОТОБРАЖЕНИЕ КООРДИНАТ ============== */
.coordinates-display {
    background: #f0f8ff;
    border: 1px solid #4285f4;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.2);
}

.coords-label {
    color: #4285f4;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.coords-value {
    font-family: 'Monaco', 'Menlo', monospace;
    color: #333;
    font-weight: 600;
    background: white;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    letter-spacing: 0.5px;
}

/* Для мобильных */
@media screen and (max-width: 768px) {
    .coordinates-display {
        padding: 6px 8px;
        font-size: 11px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .coords-value {
        width: 100%;
        text-align: center;
    }
}