:root {
    --primary-color: #0d6efd;
    --premium-color: #ffc107;
    --success-color: #198754;
    --danger-color: #dc3545;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    padding-bottom: 2rem;
}

/* Премиум карточки */
.premium-card {
    border: 2px solid var(--premium-color) !important;
    background-color: #fff9e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(255, 193, 7, 0.15);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.premium-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 2rem rgba(255, 193, 7, 0.25);
}

.premium-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--premium-color);
    color: #000;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.875rem;
    z-index: 10;
}

/* Карточки */
.card {
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
}

/* Фото галерея */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.photo-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.photo-gallery img:hover {
    opacity: 0.8;
}

/* Видео */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Рейтинг */
.rating {
    color: #ffc107;
    font-size: 1.25rem;
}

.rating-small {
    font-size: 1rem;
}

/* Отзывы */
.review-item {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.review-item:last-child {
    border-bottom: none;
}

.review-author {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.review-date {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Акции */
.promotion-badge {
    background-color: var(--danger-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* Поиск */
.search-form {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 2rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .card-img-top {
        height: 160px;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .photo-gallery img {
        height: 120px;
    }
}

@media (max-width: 576px) {
    h1 {
        font-size: 1.75rem;
    }
    
    .card-img-top {
        height: 140px;
    }
}

/* Админка */
.admin-table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

.admin-sidebar {
    background-color: #212529;
    min-height: calc(100vh - 56px);
    color: white;
}

.admin-sidebar a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.75rem 1rem;
    display: block;
    transition: background-color 0.2s;
}

.admin-sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-sidebar .active {
    background-color: var(--primary-color);
    color: white;
}

/* Загрузка файлов */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: #e7f1ff;
}

.upload-area i {
    font-size: 2rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

/* Пагинация */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Базовые стили для cookie-баннера (как запасной вариант) */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 16px 20px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    z-index: 999999;
    border-top: 2px solid #ffc107;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

#cookie-consent-banner button {
    transition: all 0.2s;
}

#cookie-consent-banner button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

#cookie-consent-banner a:hover {
    text-decoration: underline !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    #cookie-consent-banner > div {
        flex-direction: column;
        text-align: center;
    }
    
    #cookie-consent-banner > div > div:first-child {
        flex-direction: column;
        text-align: center;
    }
    
    #cookie-consent-banner button {
        width: 100%;
        margin: 5px 0;
    }
}

/* Алфавитный указатель */
.letter-nav {
    background: #f8f9fa;
    padding: 15px 0;
    border-bottom: 1px solid #dee2e6;
}

.letter-btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    border-radius: 50%;
    font-weight: bold;
    transition: all 0.2s;
}

.letter-btn:hover:not(.disabled) {
    transform: scale(1.1);
}

.letter-btn.active {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Dropdown с городами */
.cities-dropdown-menu {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
}

.cities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.city-item {
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.city-item:hover {
    background: #f8f9fa;
}

.city-item.active {
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 500;
}

.city-count {
    float: right;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
}

/* Категории в фильтре */
.category-filter {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.category-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.category-item {
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.category-item:hover {
    background: #e9ecef;
}

/* Бейджи категорий на карточках */
.category-badge {
    display: inline-block;
    padding: 4px 8px;
    margin: 0 4px 4px 0;
    background: #e7f1ff;
    color: #0d6efd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.category-badge:hover {
    background: #0d6efd;
    color: white;
}

/* AI Assistant Styles */
.ai-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.ai-chat-button i {
    font-size: 24px;
}

.ai-chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.ai-chat-widget.active {
    display: flex;
}

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

.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h5 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-header h5 i {
    font-size: 20px;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fb;
}

.ai-message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

.ai-message.user {
    justify-content: flex-end;
}

.ai-message .avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.ai-message.user .avatar {
    background: #4a5568;
    margin-left: 10px;
    margin-right: 0;
}

.ai-message .content {
    max-width: 70%;
    padding: 12px 15px;
    border-radius: 18px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    word-wrap: break-word;
}

.ai-message.user .content {
    background: #667eea;
    color: white;
}

.ai-message .content p {
    margin: 0 0 8px 0;
}

.ai-message .content p:last-child {
    margin-bottom: 0;
}

.ai-message .content ul, 
.ai-message .content ol {
    margin: 5px 0;
    padding-left: 20px;
}

.ai-message .timestamp {
    font-size: 10px;
    color: #a0aec0;
    margin-top: 5px;
    display: block;
}

.ai-chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.ai-input-group {
    display: flex;
    gap: 10px;
}

.ai-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-input-group input:focus {
    border-color: #667eea;
}

.ai-input-group button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-input-group button:hover:not(:disabled) {
    transform: scale(1.05);
}

.ai-input-group button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px;
    background: white;
    border-radius: 18px;
    width: fit-content;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ai-suggestion-chip {
    padding: 8px 12px;
    background: #edf2f7;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-chip:hover {
    background: #667eea;
    color: white;
}

/* Адаптивность */
@media (max-width: 576px) {
    .ai-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .ai-chat-button {
        bottom: 10px;
        right: 10px;
    }
}

/* Темная тема для чата (опционально) */
.theme-dark .ai-chat-widget {
    background: #1a202c;
    color: white;
}

.theme-dark .ai-chat-messages {
    background: #2d3748;
}

.theme-dark .ai-message .content {
    background: #4a5568;
    color: white;
}

.theme-dark .ai-input-group input {
    background: #4a5568;
    border-color: #718096;
    color: white;
}

.theme-dark .ai-suggestion-chip {
    background: #4a5568;
    color: #e2e8f0;
}

.theme-dark .ai-suggestion-chip:hover {
    background: #667eea;
}