/* Стили для страницы витрины услуг */

/* CSS переменные */
:root {
    --primary-color: #7b2ff2;
    --primary-light: #9d5ff7;
    --primary-dark: #5a1fd9;
    --secondary-color: #f8f9ff;
    --accent-color: #ff6b35;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-light: #a0aec0;
    --background-light: #ffffff;
    --background-gray: #f7fafc;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --border-radius-lg: 16px;
}

/* Предотвращение горизонтального скролла */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

.services-showcase {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
    width: 100%;
}

/* Улучшаем адаптивность контейнера */
.container {
    max-width: 100%;
    overflow-x: hidden;
}

.page {
    max-width: 100%;
    overflow-x: hidden;
}

.showcase-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.showcase-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.showcase-header p {
    margin: 0;
    font-size: 18px;
    opacity: 0.9;
    font-weight: 400;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Современные фильтры */
.filters-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.filters-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
    width: 100%;
}

.filters-form .filter-group:nth-child(3) {
    grid-column: span 2;
}

.filters-form .filter-group:nth-child(4),
.filters-form .filter-group:nth-child(5) {
    grid-column: span 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0; /* Предотвращает переполнение */
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.search-input,
.category-select,
.price-input {
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    width: 100%;
    min-width: 0; /* Предотвращает переполнение */
    box-sizing: border-box;
}

.search-input:focus,
.category-select:focus,
.price-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* Выпадающие результаты поиска */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    width: 100%;
}

.search-result-item:hover {
    background-color: #f8fafc;
}

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

.search-result-item .result-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.search-result-item .result-description {
    font-size: 14px;
    color: #64748b;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.search-result-item .result-hobby {
    font-size: 12px;
    color: #94a3b8;
}

.filter-group {
    position: relative;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.price-range input {
    flex: 1;
    min-width: 0; /* Предотвращает переполнение */
    box-sizing: border-box;
}

.price-range span {
    color: #6c757d;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0; /* Предотвращает сжатие разделителя */
}

.filter-btn,
.reset-btn {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    min-height: 44px;
    box-sizing: border-box;
    width: 100%;
}

.filter-btn {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 47, 242, 0.3);
}

.reset-btn {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.reset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 47, 242, 0.3);
    text-decoration: none;
}

.reset-btn:hover i {
    color: white;
}

/* Результаты */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 18px 25px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 100%);
    border-radius: 12px;
    font-size: 15px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.05);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.results-count {
    font-weight: 600;
    color: #4a5568;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.page-info {
    color: #6c757d;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Сетка услуг */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    overflow-x: hidden;
}

.service-card {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.service-main-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-sizing: border-box;
}

.service-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.service-card:hover .service-image {
    transform: scale(1.05);
}

.service-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 3rem;
    box-sizing: border-box;
}

.service-info {
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.service-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-delivery {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.service-delivery i {
    color: var(--primary-color);
}

.service-location {
    color: #999;
}

.service-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
}

.service-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(123, 47, 242, 0.3);
    text-decoration: none;
}

.btn-primary:hover i {
    color: white !important;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(123, 47, 242, 0.3);
}

.btn-outline-primary:hover i {
    color: white !important;
}

.btn-outline-danger {
    background: transparent;
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
}

.btn-outline-danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.service-admin-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.service-card:hover .service-admin-actions {
    opacity: 1;
}

.service-admin-actions .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.service-admin-actions .btn-outline-secondary {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.service-admin-actions .btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.service-admin-actions .btn-outline-danger {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.service-admin-actions .btn-outline-danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.no-services {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-services p {
    margin: 10px 0;
}

.no-services p:first-child {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
    width: 100%;
}

.page-btn {
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    background: white;
    transition: all 0.2s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    box-sizing: border-box;
}

.page-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    text-decoration: none;
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn.active:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e8ecf3;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary, #2c3e50);
    font-size: 1.4rem;
    font-weight: 700;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary, #2c3e50);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 25px 30px;
    border-top: 1px solid #e8ecf3;
    background: #f8f9fa;
}

/* Форма в модальном окне */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary, #2c3e50);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8ecf3;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color, #6c63ff);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.form-group small {
    color: var(--text-secondary, #666);
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    text-decoration: none;
}

.btn-cancel {
    background: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.btn-cancel:hover {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.3);
}

.btn-submit {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-submit:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 47, 242, 0.3);
}

/* Адаптивность */
@media (max-width: 1024px) {
    .filters-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filters-form .filter-group:nth-child(3) {
        grid-column: span 1;
    }
    
    .filter-btn,
    .reset-btn {
        grid-column: span 1;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 768px) {
    .services-showcase {
        padding: 15px;
    }
    
    .showcase-header {
        padding: 25px 20px;
        margin-bottom: 30px;
    }
    
    .showcase-header h1 {
        font-size: 28px;
    }
    
    .showcase-header p {
        font-size: 16px;
    }
    
    .filters-section {
        padding: 25px 20px;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-btn,
    .reset-btn {
        grid-column: span 1;
        width: 100%;
        min-height: 48px;
    }
    
    /* Исправляем ценовой диапазон для мобильных */
    .price-range {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .price-range input {
        width: 100%;
        min-height: 48px;
    }
    
    .price-range span {
        text-align: center;
        margin: 5px 0;
    }
    
    /* Улучшаем отображение полей поиска */
    .search-input,
    .price-input {
        min-height: 48px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .service-main-image {
        height: 180px;
    }
    
    .service-info {
        padding: 0;
    }
    
    .service-title {
        font-size: 1rem;
    }
    
    .service-description {
        font-size: 0.85rem;
    }
    
    .service-actions {
        flex-direction: column;
        justify-content: center;
        align-items: stretch;
    }
    
    .service-actions .btn {
        width: 100%;
        min-height: 44px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .page-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Улучшаем отображение результатов */
    .results-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .services-showcase {
        padding: 10px;
    }
    
    .showcase-header {
        padding: 20px 15px;
    }
    
    .showcase-header h1 {
        font-size: 24px;
    }
    
    .filters-section {
        padding: 20px 15px;
    }
    
    /* Дополнительные исправления для очень маленьких экранов */
    .filters-form {
        gap: 12px;
    }
    
    .filter-group label {
        font-size: 13px;
    }
    
    .search-input,
    .price-input {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .filter-btn,
    .reset-btn {
        padding: 14px 20px;
        font-size: 14px;
    }
    
    .service-card {
        margin: 0 5px;
    }
    
    .service-content {
        padding: 15px;
    }
    
    .service-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* Дополнительные медиа-запросы для очень маленьких экранов */
@media (max-width: 360px) {
    .services-showcase {
        padding: 8px;
    }
    
    .showcase-header {
        padding: 15px 10px;
    }
    
    .showcase-header h1 {
        font-size: 22px;
    }
    
    .showcase-header p {
        font-size: 14px;
    }
    
    .filters-section {
        padding: 15px 10px;
    }
    
    .filters-form {
        gap: 10px;
    }
    
    .search-input,
    .price-input {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .filter-btn,
    .reset-btn {
        padding: 12px 16px;
        font-size: 13px;
        min-height: 44px;
    }
    
    .service-card {
        padding: 15px;
    }
    
    /* Дополнительные исправления для очень маленьких экранов */
    .price-range {
        gap: 6px;
    }
    
    .price-range input {
        padding: 10px 12px;
    }
    
    .service-main-image {
        height: 160px;
    }
    
    .service-title {
        font-size: 1rem;
    }
    
    .service-description {
        font-size: 0.8rem;
    }
    
    .service-price {
        font-size: 1.1rem;
    }
    
    .pagination {
        gap: 6px;
    }
    
    .page-btn {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }
}

/* Дополнительные медиа-запросы для экстремально маленьких экранов */
@media (max-width: 320px) {
    .services-showcase {
        padding: 5px;
    }
    
    .showcase-header {
        padding: 12px 8px;
    }
    
    .showcase-header h1 {
        font-size: 20px;
    }
    
    .showcase-header p {
        font-size: 13px;
    }
    
    .filters-section {
        padding: 12px 8px;
    }
    
    .filters-form {
        gap: 8px;
    }
    
    .search-input,
    .price-input {
        padding: 8px 12px;
        font-size: 16px;
    }
    
    .filter-btn,
    .reset-btn {
        padding: 10px 14px;
        font-size: 12px;
        min-height: 42px;
    }
    
    .service-card {
        padding: 12px;
    }
    
    .service-main-image {
        height: 140px;
    }
    
    .service-title {
        font-size: 0.9rem;
    }
    
    .service-description {
        font-size: 0.75rem;
    }
    
    .service-price {
        font-size: 1rem;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .page-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 38px;
    }
}

.filter-btn i {
    color: white;
}

.order-service-btn i {
    color: white;
}