/* static/css/pages/index.css */
/* Страница каталога платформ. */

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #EEF5FB;
    padding: 40px;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.title-section {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 40px;
}

.main-title {
    font-size: 32px;
    font-weight: 1000;
    color: #2c3e50;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 18px;
    font-weight: 300;
    color: #666;
    line-height: 1.4;
}

.search-container {
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
    min-width: 0;
}

.search-input:focus {
    border-color: #5B9BD5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(91, 155, 213, 0.1);
}

.filter-select {
    padding: 16px 36px 16px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #555;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-select:focus {
    border-color: #5B9BD5;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(91, 155, 213, 0.1);
}

.filter-select.active {
    border-color: #5B9BD5;
    background-color: #eef4fb;
    color: #3a7fc1;
    font-weight: 500;
}

.subcategories-container {
    margin: 0 0 40px;
    overflow-x: auto;
    padding: 4px 0 10px;
}

.subcategories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.subcategory-item {
    display: inline-block;
    padding: 10px 20px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.subcategory-item:hover,
.subcategory-item.active {
    background: #5B9BD5;
    color: #ffffff;
    border-color: #5B9BD5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 155, 213, 0.3);
}

.subcategory-item.active {
    font-weight: 600;
}

.subcategory-select {
    display: none;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
    grid-auto-rows: minmax(auto, 1fr);
    gap: 20px;
    margin-bottom: 40px;
    flex: 1;
    justify-content: center;
    align-items: start;
}

.service-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.service-card {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 240px;
    max-width: 240px;
    height: 220px;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.05) 0%, rgba(74, 139, 200, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.service-card:hover {
    border-color: #5B9BD5;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(91, 155, 213, 0.2);
}

.service-card:hover::before {
    opacity: 1;
}

.service-card * {
    pointer-events: none;
}

.service-card {
    pointer-events: auto;
}

.service-logo {
    width: 100%;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    pointer-events: none;
    flex-shrink: 0;
}

.logo-image,
.service-card object {
    max-width: 100%;
    max-height: 64px;
    width: auto;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.service-name-fallback {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    text-align: center;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    z-index: 1;
    pointer-events: none;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.service-domain {
    font-size: 11px;
    color: #999;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    width: 100%;
    max-width: 240px;
}

.service-description {
    font-size: 12px;
    color: #666;
    text-align: center;
    line-height: 1.5;
    width: 100%;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-subcategories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.service-subcategory-badge {
    font-size: 10px;
    color: #888;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 2px 8px;
    white-space: nowrap;
    line-height: 1.4;
}

.service-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.service-tariff {
    font-size: 13px;
    font-weight: 700;
    color: #5B9BD5;
    white-space: nowrap;
}

.service-tariff-period {
    font-weight: 400;
    color: #888;
}

.cancellation-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    border: 1.5px solid;
    white-space: nowrap;
    margin-left: auto;
}

.cancellation-badge.easy {
    background: #f0faf0;
    border-color: #4caf7d;
    color: #2e7d52;
}

.cancellation-badge.medium {
    background: #fffbf0;
    border-color: #e6a817;
    color: #8a6200;
}

.cancellation-badge.hard {
    background: #fff5f5;
    border-color: #e05a5a;
    color: #c0392b;
}

.cancellation-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.no-services {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

.pagination-container {
    margin: 40px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-link {
    padding: 10px 16px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination-link:hover {
    background: #5B9BD5;
    color: #ffffff;
    border-color: #5B9BD5;
}

.pagination-info {
    padding: 10px 16px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .title-section {
        text-align: left;
    }

    .main-title {
        font-size: 22px;
        text-align: left;
        font-weight: 1000;
    }

    .subtitle {
        text-align: left;
        font-size: 16px;
        font-weight: 200;
    }

    .search-container {
        flex-wrap: wrap;
    }

    .subcategories-list {
        display: none;
    }

    .subcategory-select {
        display: block;
        width: 100%;
        padding: 12px 36px 12px 16px;
        font-size: 14px;
        font-weight: 500;
        font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        border: 2px solid #e0e0e0;
        border-radius: 10px;
        outline: none;
        background: #ffffff;
        color: #555;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        transition: all 0.3s ease;
    }

    .subcategory-select:focus {
        border-color: #5B9BD5;
        background-color: #ffffff;
        box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
    }

    .subcategory-select.active {
        border-color: #5B9BD5;
        background-color: #eef4fb;
        color: #3a7fc1;
    }

    .search-input {
        flex: 1 1 100%;
        padding: 14px 16px;
    }

    .search-input::placeholder {
        color: #aaa;
    }

    .filter-select {
        flex: 1 1 0;
        min-width: 0;
        padding: 12px 28px 12px 12px;
        font-size: 13px;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 190px));
        gap: 12px;
    }

    .service-card {
        width: 190px;
        max-width: 190px;
        height: 210px;
        padding: 12px;
    }

    .service-logo {
        height: 60px;
    }

    .service-name-fallback {
        height: 60px;
    }

    .logo-image,
    .service-card object {
        max-height: 52px;
    }

    .service-domain {
        max-width: 190px;
    }
}
