/* Общие стили для узкого мобильного интерфейса */

/* Узкий контейнер для всех страниц */
.main-container {
    max-width: 28rem; /* 448px - как мобильная версия */
    margin: 0 auto;
    padding: 0 1rem;
}

/* Нижняя панель навигации - узкая */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 28rem; /* Такая же ширина как контент */
    width: 100%;
    margin: 0 auto; /* Центрирование */
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    border-radius: 16px 16px 0 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    transition: color 0.2s ease;
    padding: 8px;
    min-width: 44px;
}

.nav-item.active {
    color: #000;
}

.nav-item:hover {
    color: #333;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

/* Кнопка создания - особый стиль */
.create-btn {
    background: #000 !important;
    color: white !important;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    top: -8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.create-btn i {
    font-size: 24px;
    margin-bottom: 0;
}

.create-btn span {
    display: none;
}

/* Отступ для нижней панели */
body {
    padding-bottom: 80px;
}

/* Адаптивные стили */
@media (min-width: 768px) {
    /* На больших экранах тоже узкий интерфейс */
    .main-container {
        max-width: 28rem;
    }
    
    .bottom-nav {
        max-width: 28rem;
    }
}

/* Masonry для паттернов */
.patterns-masonry {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.masonry-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pattern-item {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, opacity 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    position: relative;
}

.pattern-item.show {
    opacity: 1;
    transform: translateY(0);
}

.pattern-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.pattern-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pattern-info {
    padding: 12px;
}

.pattern-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    line-height: 1.3;
}

.pattern-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.pattern-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Блоки категорий и коллекций */
.category-block, .collection-block {
    position: relative;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.category-block:hover, .collection-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.category-block::before, .collection-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1;
}

.category-title, .collection-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    z-index: 2;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Поисковая панель */
.search-panel {
    background: white;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Подсказки поиска */
#searchSuggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: #f9fafb;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-title {
    font-weight: 500;
    color: #111827;
}

.suggestion-category {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* Индикаторы загрузки */
.loading-indicator {
    text-align: center;
    padding: 32px 16px;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-patterns {
    text-align: center;
    padding: 64px 16px;
    color: #666;
}

.no-patterns i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.hidden {
    display: none;
}

/* Прелоадер */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-e {
    font-size: 48px;
    font-weight: bold;
    color: #000;
    animation: spin 2s linear infinite;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #000;
    color: white;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Формы */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #000;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

/* Утилиты */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.bg-white { background-color: white; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }

.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.rounded { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }

.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

.border { border: 1px solid #d1d5db; }
.border-gray-300 { border-color: #d1d5db; }

.z-50 { z-index: 50; }
.z-100 { z-index: 100; }