/* ---- BODY SECTION --- */

body {
    margin: 0;
    width: 100%;

    background-color: var(--ym-primary-100);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* ---- MAIN --- */

main {
    width: 95%;
    max-width: 1280px;
    padding: 32px 0 64px 0;
    margin: 0 128px;
    margin-bottom: 32px;
    box-sizing: border-box;

    display: flex;
    align-items: flex-start;
    justify-content: center;

    background-color: var(--ym-primary-50);
    border-radius: 16px;
}

.global-container {
    width: 90%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (max-width: 700px) {
    html, body {
        width: 100dvw;
        overflow-x: hidden;
    }

    body {
        background-color: var(--ym-primary-50);
    }

    main {
        width: 100%;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }

    .global-container {
        width: 100%;
        padding: 0 16px;
    }
}

/* ---- MAIN-HEADER SECTION --- */

.main-header {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;

    margin-bottom: 16px;
}

h2 {
    width: 100%;
    margin: 0;
    font-weight: 700;
    font-size: 1.5rem;
}

.divider {
    width: 100%;
    border: 0.5px solid var(--ym-primary-200);
}

.subtitles {
    width: 100%;
    margin: 0;

    display: flex;
    justify-content: space-between;
    align-items: center;

    font-size: 1rem;
}

.subtitles__order {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subtitles__order__order-by {
    border: none;

    background-color: var(--ym-primary-50);
    
    font-family: Quicksand, sans-serif;
    color: var(--ym-primary-700);
    font-weight: 500;
    font-size: 0.875rem;
    
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.subtitles__order__order-by:focus {
    outline: none;
    border: none;
    box-shadow: 0 0 0 2px var(--ym-primary-100);
}

.subtitles__order__order-by:hover {
    border: none;
    color: var(--ym-primary-600);
    background-color: var(--ym-primary-50);
}

.subtitles__order__order-by option {
    font-family: Quicksand, sans-serif;
}

.btn-filtros {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    background-color: var(--ym-primary-100);
    font-size: 0.9rem;

    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-filtros:hover {
    border: 1px solid var(--ym-primary-300);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

@media (max-width: 700px) {
    .subtitles__order__text {
        display: none;
    }
}

@media (min-width: 700px) {
    .btn-filtros {
        display: none;
    }
}

/* ---- PRODUCTS AND FILTERS SECTION --- */
.products-and-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

/* filtros */
.filters {
    background: var(--ym-primary-100);
    border: 1px solid var(--ym-gray-400);
    border-radius: 8px;
    padding: 16px;
    padding-bottom: 0;
    position: sticky;
}

.filters__header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.filters__header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1.5rem;
}

.filters__header button {
    background: none;
    border: none;
    color: var(--ym-primary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
}

.btn-clear:hover { 
    color: var(--ym-primary-600);
}

.filter {
    border-top: 1px solid var(--ym-primary-200);
    margin-bottom: 24px;
}

.filter h3 {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

main ul {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
}

main li {
    margin: 12px 0;
}

input[type="checkbox"] {
    accent-color: var(--ym-primary)
}

.price-filter ul li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.price-filter h4 {
    margin-bottom: 0;
}

.price-filter label {
    font-weight: 400;
    color: var(--ym-gray-700);
    font-size: 0.875rem;
}

.filters input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--ym-gray-300);
    border-radius: 6px;
    background-color: var(--ym-primary-50);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--ym-gray-900);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filters input::placeholder {
    color: var(--ym-gray-400);
}

.filters input:hover {
    box-shadow: 0 0 4px 2px var(--ym-primary-alpha);
}

.filters input:focus {
    border-color: var(--ym-primary-600);
    box-shadow: 0 0 4px 2px var(--ym-primary-alpha);
}

.input-error {
    box-shadow: 0 0 4px 2px var(--ym-accent-alpha);
}

.btn-apply-filters {
    width: 100%;
    padding: 12px;
    background-color: var(--ym-primary);
    color: var(--ym-primary-50);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-apply-filters:hover {
    background-color: var(--ym-primary-600);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

@media (max-width: 700px) {
    .filters {
        display: none;
    }

    .filters.mobile-active {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 60%;
        z-index: 2000;
        background: #fff;
        padding: 16px;
        border-radius: 16px 16px 0 0;
        overflow-y: auto;
        animation: slideUp 0.3s ease;
    }

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

    .filters-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        z-index: 2000;
    }
}

@media (min-width: 700px) {
    .btn-apply-filters {
        display: none;
    }
}

/* lista de productos */
.list-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

@media (max-width: 700px) {
    .products-and-filters {
        display: block;   /* en mobile que sea 1 sola columna */
        width: 100%;
    }

    .list-products {
        grid-template-columns: 1fr; /* cards full-width */
        width: 100%;
    }
}