

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.5;
    overflow-y: scroll;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 40px;
}

.main-title {
    text-align: center;
    margin-bottom: 60px;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.5s ease, transform 0.5s ease, margin-bottom 0.5s ease;
}

.main-title h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--text-dark) 0%, var(--accent) 50%, var(--cucumber) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

}

@keyframes titleGlow {
    0% {
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
        transform: scale(1);
    }
    100% {
        text-shadow: 0 0 20px rgba(3, 85, 63, 0.3), 2px 2px 4px rgba(0, 0, 0, 0.1);
        transform: scale(1.02);
    }
}

.search-header {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.search-container {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 350px;
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 1rem;
    color: #11111199;
    font-weight: 400;
    align-items: center;
}

.search-input::placeholder {
    color: #11111199;
    opacity: 1;
}

.search-icon {
    width: 20px;
    height: 20px;
    fill: var(--cucumber);
}

.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}


.product-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    position: relative;
}

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

.product-image-container {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 80%;
    object-fit: cover;

    background-color: #e9ecef;
    transform: scale(1.25);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.product-image:hover {
    opacity: 0.8;
}

.product-image.placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
    transform: scale(1);
}

.product-image.placeholder::after {
    content: '📷\A Добавить фото';
    white-space: pre;
    line-height: 1.5;
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px !important;
    color: #2c3e50;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px !important;

}

.product-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    height: calc(1.4em * 4.5);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    white-space: normal;
    position: relative;
}



.product-description[contenteditable="true"] {
    display: block;
    -webkit-line-clamp: none;
    overflow: visible;
    white-space: pre-wrap;
    height: auto;
    min-height: calc(1.4em * 5.5);
}

.product-description[contenteditable="true"]::after {
    display: none;
}

.location {
    font-size: 0.8rem;
    color: #999;
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid #eee;
    border-radius: 0 !important;
}

.camera-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.settings-btn {
    position: fixed;
    top: 20px;
    left: 80px;
    z-index: 3000;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.settings-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.4);
}

.settings-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-dark);
    display: block;
    margin: auto;
}

.webarchive-btn {
    position: fixed;
    top: 20px;
    left: 140px;
    z-index: 3000;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    padding-top: 10.8px;
}

.webarchive-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.4);
}

.webarchive-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-dark);
    display: block;
    margin: auto;
}

/* Стили для радиокнопок платформ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-item input[type="radio"] {
    width: 16px;
    height: 16px;
    border: 2px solid #333333 !important;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.radio-item input[type="radio"]:checked {
    background: #333333 !important;
}

.radio-item input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

.radio-item input[type="radio"]:focus {
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.3);
}

.radio-item label {
    cursor: pointer;
    font-size: 14px;
    margin: 0;
}

/* Стили для webarchive элементов с темно-серой рамкой */
.webarchive-file-upload .file-upload-label {
    border: 2px solid #333333 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.webarchive-process-btn {
    border: 2px solid #333333 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.webarchive-process-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.camera-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.4);
}

.camera-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--text-dark);
}

.camera-toggle .edit-icon {
    display: none;
}

.user-mode .camera-toggle .camera-icon {
    display: none;
}

.user-mode .camera-toggle .edit-icon {
    display: block;
}

body:not(.user-mode) .camera-toggle .camera-icon {
    display: block;
}

body:not(.user-mode) .camera-toggle .edit-icon {
    display: none;
}

/* Скрываем заголовок "Карыто" в user-mode с анимацией */


/* Плавно уменьшаем отступы в user-mode */
body.user-mode .container {
    padding: 100px 20px 40px;
    transition: padding 0.5s ease;
}

.back-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.back-btn:hover {
    transform: translateX(-50%) scale(1.1);
    background: rgba(255, 255, 255, 0.4);
}

.back-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-dark);
}




.admin-element {
    display: block !important;
}

/* Анимация скрытия кнопок управления в user mode */
.user-mode .settings-btn,
.user-mode .webarchive-btn {
    transform: translateY(-80px);
}

/* Скрытие settings-btn и webarchive-btn в expanded-view */
.expanded-view.active + .settings-btn,
body:has(.expanded-view.active) .settings-btn,
body:has(.expanded-view.active) .webarchive-btn {
    transform: translateY(-80px);
    opacity: 0;
    pointer-events: none;
}


.user-mode .admin-element {
    display: none !important;
}

/* Анимация уменьшения кнопок действий с карточками в user mode */
.user-mode .expand-card-btn,
.user-mode .delete-card-btn,
.user-mode .add-card-circle {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.admin-element.add-product-btn-bottom {
    display: flex !important;
}

.add-product-btn-bottom {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.add-btn-circle {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: black;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--glass-border);
}

.add-btn-circle:hover {

    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.add-btn-circle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.side-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 400px;
    height: calc(100% - 20px);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1001;
    padding: 80px 20px 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(-110%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-Y: auto !important;
}

.side-panel.open {
    transform: translateX(0);
}

.side-panel h2 {
    color: var(--text-dark);
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 500;
}
.theme-reset-btn > svg > path {
    fill: white !important;
}




.form-group {
    margin-bottom: 28px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;

}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="file"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(3, 85, 63, 0.1);
}

.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload:hover .file-upload-label {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent);
}

.file-upload svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    fill: var(--cucumber);
}

.add-product-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.add-product-btn:hover {
    background: var(--cucumber);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 85, 63, 0.3);
}

.add-product-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.form-group input[type="color"] {
    width: 100px;
    height: 20px;
    padding: 1px 3px 0px 3px ;
    border: 1px solid rgba(1, 1, 1, 0.4);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    justify-self: flex-end;
}

.form-group input[type="color"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(3, 85, 63, 0.1);
}

.form-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    border: 1px solid rgba(1, 1, 1, 0.4);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    margin-top: 5px;
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}
.form-group input[type="color"]::before {
    content: "";
    flex: 1;
}

.font-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.font-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(3, 85, 63, 0.1);
}

.file-upload {
    position: relative;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.file-upload-label:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent);
}

.file-upload-label svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--cucumber);
    transform: scale(1.1);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: none;
    transition: all 0.3s ease;
}

.form-group input[type="range"]::-moz-range-thumb:hover {
    background: var(--cucumber);
    transform: scale(1.1);
}

.form-group span {
    display: inline-block;
    margin-left: 10px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.theme-reset-btn {
    width: 100%;
    padding: 14px 20px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 45px;
}

.theme-reset-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.theme-reset-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.presets-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.presets-section h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 500;
}

.presets-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preset-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(3, 85, 63, 0.1);
}

.preset-btn {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.05);
}

.preset-btn.save-btn:hover {
    background: #28a745;
    border-color: #28a745;
}

.preset-btn.delete-btn:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.preset-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-dark);
    transition: fill 0.3s ease;
}

.preset-btn:hover svg {
    fill: white;
}

body:not(.user-mode) .add-card-circle {
    display: flex !important;
}
.editable {
    position: relative;
    cursor: text;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.editable:focus {
    outline: none;
}

/* Улучшения для мобильных устройств */
@media (max-width: 768px) {
    /* Расширяем родительский блок при редактировании */
    .product-card.editing {
        min-height: auto;
        padding-bottom: 20px;
    }

    .editable[contenteditable="true"] {
        /* Добавляем визуальную обратную связь для мобильных */
        box-shadow: 0 0 0 2px rgba(3, 85, 63, 0.3);
        border-radius: 6px;
        background-color: rgba(255, 255, 255, 0.95);
        /* Увеличиваем размер шрифта для лучшей читаемости на мобильных */
        font-size: 1.1em;
        line-height: 1.5;
        /* Добавляем padding БЕЗ отрицательного margin */
        padding: 12px;
        margin: 4px 0;
        /* Специально для iOS - обеспечиваем правильное поведение клавиатуры */
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
        -webkit-tap-highlight-color: rgba(3, 85, 63, 0.3);
        cursor: text;
        /* Убираем z-index чтобы не наползать */
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    /* Специальные стили для заголовка */
    .product-title[contenteditable="true"] {
        font-size: 1.1rem !important;
        font-weight: 500;
        margin-bottom: 8px;
        min-height: 50px;
    }

    /* Специальные стили для цены */
    .product-price[contenteditable="true"] {
        font-size: 1.3rem !important;
        font-weight: 600;
        margin-bottom: 12px;
        min-height: 45px;
    }
    
    /* Специальные стили для описания товара */
    .product-description[contenteditable="true"] {
        font-size: 1rem !important;
        min-height: 80px;
        line-height: 1.4;
    }

    /* Специальные стили для локации */
    .location[contenteditable="true"] {
        font-size: 0.9rem !important;
        min-height: 40px;
    }

    /* Дополнительные стили для iOS Safari */
    .editable[contenteditable="true"]:focus {
        outline: none;
        -webkit-appearance: none;
        border: none;
    }

    /* Увеличиваем высоту product-info при редактировании */
    .product-info:has(.editable[contenteditable="true"]) {
        min-height: 180px;
        padding-bottom: 25px;
    }
}

.editable:hover:not([contenteditable="true"]) {
    background-color: rgba(255, 255, 255, 0.3);
}

/* User mode - отключить редактирование текста */
.user-mode .editable {
    cursor: pointer !important;
    pointer-events: none;
}

.settings-group-header {
    margin-top: 45px;
    margin-bottom: 30px;
}

/* User mode - отключить изменение фото */
.user-mode .editable-image {
    cursor: pointer !important;
    pointer-events: none;
}

/* User mode - курсор pointer для всех карточек */
.user-mode .product-card {
    cursor: pointer;
}

.add-card-btn {
    display: flex;
    justify-content: center;

    align-items: center;
    margin-top: 30px;

}

.add-card-circle {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-dark);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.add-card-circle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.add-card-circle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.expand-card-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.expand-card-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.5);
}

.expand-card-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-dark);
}

body:not(.user-mode) .expand-card-btn {
    display: flex !important;
}

.delete-card-btn {
    position: absolute;
    top: 10px;
    right: 48px;
    width: 28px;
    height: 28px;
    background: rgba(220, 53, 69, 0.9);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    z-index: 10;
}

.delete-card-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.5);
    background: rgba(220, 53, 69, 1);
}

.delete-card-btn svg {
    width: 16px;
    height: 16px;
    fill: white !important;
}

.delete-card-btn svg path {
    fill: white !important;
}

body:not(.user-mode) .delete-card-btn {
    display: flex;
}

/* Expanded card view */
.expanded-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;

    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.expanded-view.active {
    transform: translateX(0);
}

.expanded-card {
    width: 70vw;
    max-width: 1200px;
    height: auto;
    max-height: 90vh;
    min-height: 70vh;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 1200px;
}

.expanded-images {
    width: 100%;
    height: 40vh;
    max-height: 40vh;
    min-height: 300px;
    display: flex;
    gap: 8px;
    margin: 1px;
    padding: 20px;
    border-radius: 6px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow-y: auto;
    overflow-x: hidden;
}

.expanded-image {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.expanded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Адаптируем для одного изображения - 50% ширины */
.expanded-images.single-image .expanded-image:not(.placeholder) {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Адаптация высоты контейнера в зависимости от соотношения сторон */
.expanded-images.portrait-dominant {
    min-height: 450px;
}

.expanded-images.landscape-dominant {
    min-height: 350px;
}

.expanded-images.square-dominant {
    min-height: 400px;
}

/* Особая логика для смешанных соотношений сторон */
.expanded-images.mixed-ratios {
    min-height: 400px;
    align-items: stretch;
}

.expanded-images.mixed-ratios .expanded-image {
    align-self: stretch;
}

/* Специальная логика для изображений с разным соотношением сторон */
.expanded-image.aspect-square img {
    object-fit: cover;
}

.expanded-image.aspect-portrait img {
    object-fit: cover;
}

.expanded-image.aspect-landscape img {
    object-fit: cover;
}

.expanded-image.placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expanded-image.placeholder:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: scale(1.02);
}

body:not(.user-mode) .expanded-image {
    cursor: pointer;
    position: relative;
}

body:not(.user-mode) .expanded-image:hover {
    opacity: 0.8;
}

.expanded-image.has-image::after {
    content: '+';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
}

body:not(.user-mode) .expanded-image.has-image:hover::after {
    display: flex;
}

.expanded-info {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.expanded-title {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    cursor: text;
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.expanded-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    cursor: text;
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.expanded-description {
    font-size: 1.1rem;
    color: #666;
    line-height: 1.6;
    flex: 1;
    cursor: text;
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    min-height: 120px;
}

.expanded-location {
    font-size: 1rem;
    color: #999;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: auto;
    cursor: text;
    padding: 20px 12px 8px 12px;
    margin: 0 -12px -8px -12px;
    border-radius: 0px;
    transition: background-color 0.2s ease;
}

/* Стили для редактирования в развернутом виде (только в admin mode) */
body:not(.user-mode) .expanded-title:hover:not([contenteditable="true"]),
body:not(.user-mode) .expanded-price:hover:not([contenteditable="true"]),
body:not(.user-mode) .expanded-description:hover:not([contenteditable="true"]),
body:not(.user-mode) .expanded-location:hover:not([contenteditable="true"]) {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Hover эффекты затемнения для всех текстовых элементов */
.product-price:hover,
.product-title:hover,
.product-description:hover,
.location:hover,
.expanded-title:hover,
.expanded-price:hover,
.expanded-description:hover,
.expanded-location:hover {
    background-color: var(--secondary-glass-color);
    transition: background-color 0.2s ease;
}

/* Hover эффекты для изображений */
.expanded-images:hover {
    background-color: var(--secondary-glass-color) !important;
    transition: background-color 0.2s ease;
}

.expanded-title:focus,
.expanded-price:focus,
.expanded-description:focus,
.expanded-location:focus {
    outline: none;
}

/* В user mode убираем курсор text и hover-эффекты */
.user-mode .expanded-title,
.user-mode .expanded-price,
.user-mode .expanded-description,
.user-mode .expanded-location {
    cursor: default;
}

/* Скрываем пустые места для фото в user-mode */
.user-mode .expanded-image.placeholder {
    display: none;
}

/* Адаптируем layout когда скрыты пустые изображения */
.user-mode .expanded-images {
    gap: 12px;
}

/* Ограничиваем ширину фотографий когда скрыты пустые - сохраняем пропорции */
.user-mode .expanded-image:not(.placeholder) {
    flex: 1;
    max-width: none;
}

/* Если только одна фотография - сохраняем правило 50% */
.user-mode .expanded-images.single-image .expanded-image:not(.placeholder) {
    flex: 0 0 50%;
    max-width: 50%;
}

/* Если две фотографии - равномерно распределяем */
.user-mode .expanded-images.double-images .expanded-image:not(.placeholder) {
    flex: 1;
    max-width: none;
}


/* Animation states */
.main-content.slide-left {
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    .container {
        padding: 120px 15px 20px;
        transition: padding 0.5s ease;
    }

    /* Анимированное скрытие заголовка на мобильных в user-mode */
    body.user-mode .container {
        padding: 80px 15px 20px;
    }

    .main-title h1 {
        font-size: 3.5rem;
        margin-bottom: 20px;
    }

    .search-container {
        min-width: auto;
        width: 100%;
        max-width: 400px;
    }

    .products-grid {
        gap: 16px;
        max-width: 100%;
    }

    .product-card {
        flex-direction: column;
        align-items: stretch;
        min-height: 360px;
    }

    .product-image-container {
        width: 100%;
        height: 200px;
        flex-shrink: 0;
    }

    .product-image {
        transform: scale(1);
    }

    .product-info {
        padding: 20px 16px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 140px;
    }

    .product-title {
        font-size: 1rem;
        margin-bottom: 6px !important;
    }

    .product-price {
        font-size: 1.2rem;
        margin-bottom: 10px !important;
    }

    .product-description {
        font-size: 0.85rem;
        height: auto;

        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        position: relative;
    }



    .location {
        display: none;
    }

    /* Кнопки управления на мобильных */
    .expand-card-btn,
    .delete-card-btn {
        width: 50px;
        height: 50px;
    }

    .expand-card-btn svg,
    .delete-card-btn svg {
        width: 18px;
        height: 18px;
    }

    .delete-card-btn {
        right: 70px;

    }

    /* Развернутый режим на мобильных */
    .expanded-view {
        padding: 20px 15px;
    }

    .expanded-card {
        width: calc(100% - 20px);
        height: auto !important;
        max-width: none;
        transform: translate(-50%, -50%);

    }

    .expanded-images {
        height: 340px;
        position: relative;
        padding: 15px 15px 35px 15px;
        overflow: hidden;
    }

    .mobile-image-slider {
        width: 100%;
        height: 100%;
        position: relative;
        border-radius: 12px;
        overflow: hidden;
        background: #e9ecef;
        touch-action: pan-x;
    }

    .mobile-image-slider img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: none;
        transition: all 0.3s ease;
    }

    .mobile-image-slider img.active {
        display: block;
    }

    .mobile-image-placeholder {
        width: 100%;
        height: 100%;
        display: none;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        color: #6c757d;
        font-size: 1rem;
        border-radius: 12px;
        transition: all 0.3s ease;
    }

    .mobile-image-placeholder.active {
        display: flex;
    }

    /* Индикаторы страниц с glass-эффектом */
    .image-indicators {
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 12px;
        z-index: 10;
        background: #11111134;
        backdrop-filter: blur(var(--glass-blur)) brightness(1.25) contrast(0.9);
        -webkit-backdrop-filter: blur(var(--glass-blur)) brightness(1.25) contrast(0.9);
        border: 1px solid var(--glass-border);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(195, 195, 195, 0.8);
        padding: 10px 18px;
        border-radius: 25px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .image-indicator {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .image-indicator.active {
        background: rgba(255, 255, 255, 0.9);
        transform: scale(1.2);
        border-color: rgba(255, 255, 255, 0.7);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .image-indicator:hover {
        background: rgba(255, 255, 255, 0.7);
        transform: scale(1.1);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    }

    .expanded-image {
        display: none;
    }

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

    /* Ограничиваем количество изображений на мобильных */
    .user-mode .expanded-image:not(.placeholder) {
        max-width: none;
        width: 100%;
    }

    .expanded-info {
        padding: 20px;
        gap: 15px;
    }

    .expanded-title {
        font-size: 1.4rem;
        padding: 6px 8px;
        margin: -6px -8px;
    }

    .expanded-price {
        font-size: 1.8rem;
        padding: 6px 8px;
        margin: -6px -8px;
    }

    .expanded-description {
        font-size: 1rem;
        min-height: 80px;
        padding: 6px 8px;
        margin: -6px -8px;
    }

    .expanded-location {
        font-size: 0.9rem;
        padding: 15px 8px 6px 8px;
        margin: 0 -8px -6px -8px;
    }

    /* Кнопки управления на мобильных */
    .camera-toggle,
    .link-btn {
        width: 50px;
        height: 50px;

    }

    .camera-toggle {
        left: 20px;
    }

    .link-btn {
        left: 80px;
    }

    .back-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }

    .back-btn:hover {
        transform: translateX(-50%) scale(1.1);
    }

    .camera-toggle svg,
    .back-btn svg,
    .link-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Link popup на мобильных */
    .link-popup {
        top: 70px;
        left: 15px;
        right: 15px;
        width: auto;
        max-width: none;
    }

    /* Side panel на мобильных */
    .side-panel {
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        padding: 100px 20px 20px;
        border-radius: 0px !important;
        border-width: 0 !important;
        overflow-Y: auto !important;
    }



    /* Кнопка добавления карточки */
    .add-card-circle {
        width: 44px;
        height: 44px;
    }

    .add-card-circle svg {
        width: 24px;
        height: 24px;
    }
}

/* Очень маленькие экраны (до 480px) */
@media (max-width: 480px) {
    .container {
        padding: 110px 10px 15px;
        transition: padding 0.5s ease;
    }

    /* Анимированное скрытие заголовка на очень маленьких экранах в user-mode */
    body.user-mode .container {
        padding: 70px 10px 15px;
    }

    .main-title h1 {
        font-size: 2.8rem;
        margin-bottom: 15px;
    }

    .search-container {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .product-card {
        border-radius: 6px;
    }

    .product-image-container {
        height: 180px;
    }

    .product-info {
        padding: 18px 12px;
        min-height: 120px;
    }

    .product-title {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-description {
        font-size: 0.8rem;
        height: auto;

        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        position: relative;
    }



    .location {
        display: none;
    }

    /* Развернутый режим на очень маленьких экранах */
    .expanded-card {
        height: 70vh;
        width: calc(100% - 16px);
        margin: 8px;
        border-radius: 12px;
    }

    .expanded-images {
        height: 300px;
        padding: 10px 10px 25px 10px;
    }

    .expanded-info {
        padding: 15px;
        gap: 12px;
    }

    .expanded-title {
        font-size: 1.2rem;
    }

    .expanded-price {
        font-size: 1.6rem;
    }

    .expanded-description {
        font-size: 0.9rem;
        min-height: 60px;
    }

    .expanded-location {
        font-size: 0.8rem;
    }
}