* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /*background: linear-gradient(135deg, #5C5040 0%, #734666 100%);*/
    /*background-color: #eae4d3;*/
    background-color: #E3DAC3;
    /*background-color: #D9CEB0;*/
    /*background-color: #302A17;*/
    background-image: url("../icons/background.webp");
    background-blend-mode: soft-light;
    background-size: 700px auto;
    /*background-repeat: no-repeat;*/
    /*background-position: bottom right;*/
    min-height: 100vh;
    padding: 20px;
    padding-top: 0;
}

.hidden {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Карточки */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    padding: 40px;
    margin-bottom: 20px;
}

.card.header {
    padding: 20px 30px;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #948069;
}

button {
    background: linear-gradient(135deg, #948069 0%, #734666 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button.secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

button.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* Навигация */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 15px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    /*border-radius: 12px;*/
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    background: linear-gradient(135deg, #474641 0%, #696758 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: 500;
    color: #333;
}

.logout-btn {
    background: #dc3545;
    padding: 8px 16px;
    width: auto;
}

.user-dropdown-login {
    padding: 12px 16px;
    cursor: pointer;
    color: #734666;
    font-weight: 600;
    transition: background 0.2s;
    border-radius: 12px 12px 0 0;
}

.user-dropdown-login:hover {
    background: #f5f0f7;
}

.user-dropdown-register {
    padding: 12px 16px;
    cursor: pointer;
    color: #333;
    font-weight: 400;
    transition: background 0.2s;
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
}

.user-dropdown-register:hover {
    background: #f0f0f0;
}

/* Проекты */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.project-card:hover {
    /*transform: translateY(-4px);*/
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.project-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.project-description {
    color: #666;
    line-height: 1.5;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.project-description.hidden {
    display: none;
}

/* Контекстное меню для проектов */
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.project-title {
    flex: 1;
    cursor: pointer;
}

.project-menu-container {
    position: relative;
    flex-shrink: 0;
}

.menu-trigger-btn {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    width: auto;
    transition: color 0.2s;
}

.menu-trigger-btn:hover {
    background: none;
    transform: none;
    box-shadow: none;
    color: #333;
}

.project-context-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.project-context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    padding: 10px 16px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
}

.menu-item:hover {
    background: #f0f0f0;
}

.menu-item-danger {
    color: #dc3545;
    border-top: 1px solid #eee;
}

.menu-item-danger:hover {
    background: #fee;
}

.save-row-btn {
    background-image: url("../icons/save_icon.svg");
    background-repeat: no-repeat;
    margin-left: 20px;
    padding: 0 0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: fadeIn 0.3s;
}

.remove-row-btn {
    background-image: url("../icons/remove_icon.svg");
    background-repeat: no-repeat;
    margin-left: 20px;
    padding: 0 0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: fadeIn 0.3s;
}

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

.nickname-input {
    flex: 1;
    min-width: 100px;
    height: 36px;
}

.role-select {
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    height: 36px;
}

.expand-btn {
    background: none;
    color: #948069;
    padding: 5px 0;
    font-size: 14px;
    text-align: left;
    width: auto;
}

.expand-btn:hover {
    transform: none;
    box-shadow: none;
    color: #734666;
}

.add-button {
    background: #28a745;
    margin-bottom: 20px;
    width: auto;
    display: inline-block;
}

.add-button.hidden {
    display: none;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    color: #999;
    font-size: 28px;
    width: auto;
    padding: 0;
}

.close-modal:hover {
    transform: none;
    color: #333;
}

/* Заметки */
.maps-list {
    margin-top: 20px;
}

.map-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #948069;
    cursor: pointer;
}

.map-item.invisible {
    border-left: 4px solid #E8E8E8;
}

.map-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.map-description {
    color: #666;
    line-height: 1.5;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Контекстное меню для карт */
.map-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.map-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    cursor: pointer;
}

.map-title.invisible {
    opacity: 0.7;
}

.map-menu-container {
    position: relative;
    flex-shrink: 0;
}

.map-context-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.map-context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.map-description {
    color: #666;
    margin-top: 8px;
    word-break: break-word;
}

/* Toggle Switch (слайдер) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 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: 0.3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #948069 0%, #734666 100%);
}

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

/* Контейнер для опции видимости */
.visibility-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 20px;
}

.visibility-label {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.visibility-label span {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.visibility-label small {
    color: #666;
    font-size: 12px;
    font-weight: normal;
    margin-top: 4px;
}

/* Стили для выбора способа загрузки изображения */
.image-upload-options {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    color: #333;
    margin-bottom: 0;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #948069;
    cursor: pointer;
}

/* Превью изображения */
.image-preview {
    position: relative;
    margin-top: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    max-width: 300px;
}

.image-preview.hidden {
    display: none;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    max-height: 200px;
    object-fit: contain;
}

.remove-preview-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.remove-preview-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.file-hint {
    display: block;
    color: #888;
    font-size: 12px;
    margin-top: 4px;
}

/* Сообщения */
.error-message, .success-message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.system-message-container {
    position: fixed;
    bottom: 10px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    max-width: 90%;
    pointer-events: none;
}

.error-message, .success-message {
    pointer-events: auto;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Таблица участников */
.shared-users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.shared-users-table th,
.shared-users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.shared-users-table th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Floating Action Button (FAB) - плавающая круглая кнопка */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #948069 0%, #734666 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 400;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 100;
    padding: 0;
    line-height: 1;
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.fab:active {
    transform: translateY(1px);
}

.fab:hidden {
    display: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    .card {
        padding: 20px;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .menu-trigger-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .menu-item {
        padding: 12px 16px;
        min-height: 44px;
    }
}

/* Аватар пользователя и выпадающее меню */
.user-info {
    position: relative;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #948069 0%, #734666 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.user-dropdown-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.user-dropdown-username {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    word-break: break-word;
}

.user-dropdown-logout {
    padding: 12px 16px;
    cursor: pointer;
    color: #dc3545;
    transition: background 0.2s;
    border-radius: 0 0 12px 12px;
}

.user-dropdown-logout:hover {
    background: #fee;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .user-dropdown {
        min-width: 160px;
    }
    
    .user-dropdown-item,
    .user-dropdown-logout {
        padding: 12px 16px;
        min-height: 48px;
    }
}

/* ============ Вкладки-фильтры ============ */
.tabs-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    color: #666;
    border: none;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    position: relative;
    bottom: -2px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    width: auto;
    transform: none;
    box-shadow: none;
}

.tab-btn:hover {
    background: #f5f0f7;
    color: #734666;
    transform: none;
    box-shadow: none;
}

.tab-btn.active {
    color: #734666;
    border-bottom-color: #734666;
    background: #f9f5fa;
}

/* ============ FAB-меню ============ */
.fab-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.fab-wrapper .fab {
    position: static;
    pointer-events: auto;
    transition: transform 0.3s, box-shadow 0.2s;
}

.fab-wrapper .fab.active {
    transform: rotate(45deg);
}

.fab-wrapper .fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
}

.fab-wrapper .fab-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.fab-wrapper .fab-menu-item {
    pointer-events: auto;
    background: white;
    color: #333;
    border: none;
    padding: 12px 18px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    width: auto;
    white-space: nowrap;
}

.fab-wrapper .fab-menu-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background: #f9f5fa;
}

/* Заметки */
.note-item {
    border-left-color: #734666;
}

.note-item .map-title {
    color: #4a2c44;
}

/* Языки */

.lang-switcher {
    position: relative;
    display: inline-block;
    user-select: none;
}

.lang-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    min-width: 54px;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1;
}

.lang-switcher__btn:hover {
    border-color: #667eea;
}

.lang-switcher__btn:focus-visible {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .2);
}

.lang-switcher__code {
    font-size: 12px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.lang-switcher__chev {
    font-size: 9px;
    opacity: .5;
    margin-left: 1px;
}

.lang-switcher__menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 170px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
    padding: 4px;
    z-index: 100;
    display: none;
}

.lang-switcher.open .lang-switcher__menu {
    display: block;
}

.lang-switcher__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    text-align: left;
    transition: background .12s;
}

.lang-switcher__item:hover {
    background: #f2f4ff;
}

.lang-switcher__item.active {
    background: #eef1ff;
    font-weight: 600;
}

.lang-switcher__label {
    font-size: 13px;
}

/* ============ Логотип-ссылка ============ */
a.logo {
    text-decoration: none;
    color: inherit;
}

/* ============ Крошки ============ */
.breadcrumbs-wrapper {
    margin-bottom: 12px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    gap: 4px;
    padding: 6px 0;
    font-size: 14px;
    scrollbar-width: thin;
}

.breadcrumbs::-webkit-scrollbar {
    height: 6px;
}

.breadcrumbs::-webkit-scrollbar-thumb {
    background: #d0c8b8;
    border-radius: 3px;
}

.breadcrumb-link {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    color: #948069;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    width: auto;
    transform: none;
    box-shadow: none;
    line-height: 1.2;
}

.breadcrumb-link:hover {
    background: #f5f0f7;
    color: #734666;
    transform: none;
    box-shadow: none;
}

.breadcrumb-current {
    padding: 4px 8px;
    color: #333;
    font-weight: 600;
}

.breadcrumb-sep {
    color: #bbb;
    user-select: none;
    padding: 0 2px;
}

/* ============ Папки ============ */
.folder-item {
    border-left-color: #b8952e;
}

.folder-item .map-title {
    color: #6b5312;
}

/* ============ Folder picker ============ */
.folder-picker {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s;
}

.folder-picker:focus {
    outline: none;
    border-color: #948069;
}

.folder-picker option:disabled {
    color: #aaa;
}

/* ============ Модалка удаления папки ============ */
.delete-folder-modal p {
    color: #555;
    line-height: 1.5;
    margin-bottom: 18px;
}

.delete-folder-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delete-folder-actions button {
    width: 100%;
}

@media (max-width: 768px) {
    .breadcrumbs {
        font-size: 13px;
    }
}
