/**
 * Tour Categories Section - "Find your perfect travel and tours"
 * Cards de categoria com carrossel, badge de tours e dots de navegação
 *
 * @package Borboleta_Travel
 */

/* ==========================================================================
   Seção: Tour Categories
   ========================================================================== */
.tour-categories-section {
    background-color: var(--bt-bg-body);
    padding: var(--bt-space-20) 0 var(--bt-space-20);
    overflow: hidden; /* oculta o track que sobressai lateralmente */
}

/* ==========================================================================
   Cabeçalho da Seção
   ========================================================================== */
.tour-categories-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--bt-space-6);
    margin-bottom: var(--bt-space-10);
}

.tour-categories-title {
    font-family: var(--bt-font-family-heading);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--bt-text-heading);
    line-height: 1.2;
    margin: 0;
    max-width: 500px;
}

.tour-categories-view-all {
    display: inline-flex;
    align-items: center;
    gap: var(--bt-space-1);
    font-family: var(--bt-font-family-ui);
    font-size: var(--bt-fs-sm);
    font-weight: 600;
    color: var(--bt-primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.5rem; /* alinha visualmente com o topo do título */
    transition: gap 0.2s ease, color 0.2s ease;
}

.tour-categories-view-all:hover,
.tour-categories-view-all:focus {
    color: var(--bt-primary-hover);
    gap: var(--bt-space-2);
    text-decoration: none;
}

/* ==========================================================================
   Carrossel

   O wrapper tem overflow:hidden + padding horizontal generoso para que:
   1. O track (que é mais largo que o container) fique oculto nas bordas
   2. Os cards tenham "air" visual entre eles e as bordas do container
   ========================================================================== */
.tour-categories-carousel-wrapper {
    /* Permite que o carrossel saia do container para as bordas da tela
       enquanto o overflow no .tour-categories-section esconde o excesso */
    width: calc(100% + var(--bt-space-6) * 2);
    margin-left: calc(var(--bt-space-6) * -1);
    padding-left: var(--bt-space-6);
    padding-right: var(--bt-space-6);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    /* Padding inferior para que a sombra dos cards não seja cortada */
    padding-bottom: var(--bt-space-8);
    margin-bottom: calc(var(--bt-space-8) * -1);
}

.tour-categories-carousel-wrapper.is-dragging {
    cursor: grabbing;
}

.tour-categories-track {
    display: flex;
    gap: var(--bt-space-7);
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* ==========================================================================
   Card de Categoria — foto em tela cheia com degradê e texto sobreposto
   ========================================================================== */
.tour-category-card {
    /* 4 colunas com gap de space-7 (28px): (100% - 3*28px) / 4 */
    flex: 0 0 calc(25% - 21px);
    min-width: 240px;
    position: relative;
    aspect-ratio: 4 / 5;
    border-radius: var(--bt-radius-xl);
    overflow: hidden;
    isolation: isolate;
    background-color: var(--bt-color-teal);
    box-shadow: var(--bt-shadow-md);
    transition:
        transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.35s ease;
}

.tour-category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--bt-shadow-lg);
}

.category-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: -2;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tour-category-card:hover .category-card-img {
    transform: scale(1.07);
}

/* Degradê verde da marca na base para leitura do texto */
.category-card-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        180deg,
        rgba(14, 39, 33, 0) 40%,
        rgba(14, 39, 33, 0.55) 68%,
        rgba(14, 39, 33, 0.92) 100%
    );
    transition: opacity 0.35s ease;
}

/* Selo superior: quantidade de roteiros */
.category-tour-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--bt-radius-full);
    background: rgba(255, 255, 255, 0.94);
    color: var(--bt-color-teal);
    font-family: var(--bt-font-family-ui);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.badge-count {
    color: var(--bt-color-terracotta);
    font-size: 0.82rem;
    font-weight: 800;
}

.badge-label {
    font-weight: 600;
}

/* Rodapé do card */
.category-card-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--bt-space-3);
    padding: var(--bt-space-5);
    color: var(--bt-color-white);
}

.category-card-info {
    min-width: 0;
}

.category-card-title {
    font-family: var(--bt-font-family-heading);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bt-color-white);
    margin: 0 0 6px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.category-card-link {
    color: inherit;
    text-decoration: none;
}

/* Área clicável: o card inteiro */
.category-card-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.category-card-link:hover,
.category-card-link:focus {
    color: var(--bt-color-white);
    text-decoration: none;
}

.tour-category-card:focus-within {
    outline: 3px solid var(--bt-pastel-amber);
    outline-offset: 3px;
}

.category-card-places {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-family: var(--bt-font-family-ui);
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-card-places svg {
    flex-shrink: 0;
    color: var(--bt-pastel-amber);
}


/* ==========================================================================
   Barra de Navegação: Flechas + Dots
   ========================================================================== */
.tour-categories-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bt-space-5);
    margin-top: var(--bt-space-10);
}

/* Flechas */
.tour-cat-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--bt-radius-full);
    border: 2px solid var(--bt-color-gray-200);
    background-color: var(--bt-bg-surface);
    color: var(--bt-text-heading);
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.2s ease;
    flex-shrink: 0;
    outline: none;
}

.tour-cat-arrow:hover:not(:disabled) {
    background-color: var(--bt-color-amber);
    border-color: var(--bt-color-amber);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(226, 157, 56, 0.4);
}

.tour-cat-arrow:active:not(:disabled) {
    transform: scale(0.96);
}

.tour-cat-arrow:focus-visible {
    outline: 2px solid var(--bt-primary);
    outline-offset: 3px;
}

/* Estado desabilitado */
.tour-cat-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Dots */
.tour-categories-dots {
    display: flex;
    align-items: center;
    gap: var(--bt-space-2);
}

.categories-dot {
    width: 28px;
    height: 9px;
    border-radius: var(--bt-radius-full);
    border: none;
    background-color: var(--bt-color-gray-200);
    cursor: pointer;
    padding: 0;
    transition:
        background-color 0.25s ease,
        width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.categories-dot:focus-visible {
    outline: 2px solid var(--bt-primary);
    outline-offset: 3px;
}

.categories-dot.is-active {
    background-color: var(--bt-color-amber);
    width: 48px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: 2 colunas */
@media (max-width: 1024px) {
    .tour-category-card {
        flex: 0 0 calc(50% - 14px);
    }
}

/* Mobile: 1 coluna quase cheia */
@media (max-width: 640px) {
    .tour-categories-section {
        padding: var(--bt-space-14) 0 var(--bt-space-14);
    }

    .tour-categories-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--bt-space-3);
        margin-bottom: var(--bt-space-8);
    }

    .tour-categories-title {
        font-size: 1.6rem;
    }

    .tour-category-card {
        flex: 0 0 82vw;
    }

    .tour-categories-carousel-wrapper {
        width: calc(100% + var(--bt-space-4) * 2);
        margin-left: calc(var(--bt-space-4) * -1);
        padding-left: var(--bt-space-4);
        padding-right: var(--bt-space-4);
    }

    .btn-discover-destinations {
        padding: var(--bt-space-3) var(--bt-space-6);
        font-size: var(--bt-fs-sm);
        width: 100%;
        justify-content: center;
        max-width: 340px;
    }
}

/* ==========================================================================
   CTA Button - "Descobrir Todos os Destinos"
   ========================================================================== */
.tour-categories-cta {
    display: flex;
    justify-content: center;
    margin-top: var(--bt-space-10);
}

.btn-discover-destinations {
    display: inline-flex;
    align-items: center;
    gap: var(--bt-space-3);
    padding: var(--bt-space-4) var(--bt-space-10);
    font-family: var(--bt-font-family-ui);
    font-size: var(--bt-fs-base);
    font-weight: 700;
    color: var(--bt-color-teal);
    background: transparent;
    border: 2px solid var(--bt-color-sage);
    border-radius: var(--bt-radius-full);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition:
        color var(--bt-transition-fast),
        background var(--bt-transition-base),
        border-color var(--bt-transition-base),
        transform var(--bt-transition-fast),
        box-shadow var(--bt-transition-base);
}

.btn-discover-destinations::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--bt-color-sage) 0%, var(--bt-color-teal) 100%);
    opacity: 0;
    transition: opacity var(--bt-transition-base);
    border-radius: inherit;
}

.btn-discover-destinations:hover {
    color: var(--bt-color-white);
    border-color: var(--bt-color-teal);
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(78, 113, 102, 0.3),
        0 2px 6px rgba(24, 62, 64, 0.1);
}

.btn-discover-destinations:hover::before {
    opacity: 1;
}

.btn-discover-destinations span,
.btn-discover-destinations svg {
    position: relative;
    z-index: 1;
}

.btn-discover-destinations svg {
    transition: transform var(--bt-transition-fast);
}

.btn-discover-destinations:hover svg {
    transform: translateX(4px);
}

.btn-discover-destinations:active {
    transform: translateY(0);
}

/* Categorias reais: navegação oculta quando tudo cabe na tela */
.tour-categories-nav[hidden] {
    display: none;
}

.categories-dot[hidden] {
    display: none;
}

/* Desktop: 1 a 3 categorias ocupam a largura toda */
@media (min-width: 1025px) {
    .tour-categories-section--cols-3 .tour-category-card {
        flex: 0 0 calc((100% - 2 * var(--bt-space-7)) / 3);
    }

    .tour-categories-section--cols-2 .tour-category-card {
        flex: 0 0 calc((100% - var(--bt-space-7)) / 2);
    }

    .tour-categories-section--cols-1 .tour-category-card {
        flex: 0 0 100%;
    }
}
