/**
 * EMAG Filters - Styles des formulaires de filtres uniquement
 * Les styles de grilles et cartes sont dans emag-public.css
 * @package Emag_Magazine
 */

/* ==========================================================================
   Accessibilité
   ========================================================================== */

/* Texte accessible uniquement aux lecteurs d'écran (RGAA) */
.screen-reader-text,
.emag-sr-only {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus,
.emag-sr-only:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ==========================================================================
   Formulaires de filtres
   ========================================================================== */

.emag-filter-form {
    text-align: center;
    margin: 2em auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    justify-content: center;
    background: transparent;
    padding: 0;
    border: none;
}

.emag-filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex: 1;
    font-size: 1rem;
}

.emag-filter-field {
    flex: 1;
    min-width: 150px;
    margin: 1%;
    white-space: nowrap;
}

.emag-filter-field.emag-search-field {
    min-width: 200px;
}

.emag-filter-field.emag-filter-date-range,
.emag-filter-field.emag-date-range-field {
    min-width: 300px;
}

.emag-date-range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.emag-date-range-inputs input[type="date"] {
    flex: 1;
    min-width: 0;
}

.emag-date-separator {
    font-size: 0.875rem;
    color: var(--noir, #000);
    white-space: nowrap;
}

.emag-filter-form label {
    /* Les labels sont cachés visuellement mais accessibles aux lecteurs d'écran */
}

.emag-filter-form select,
.emag-filter-form input[type="search"],
.emag-filter-form input[type="text"],
.emag-filter-form input[type="date"] {
    width: 100%;
    padding: 0.5rem 1rem;
    appearance: none;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: thin solid var(--noir, #000);
    background: none;
    font-size: 0.9375rem;
    height: auto;
}

.emag-filter-form select {
    padding: 0.5rem 1.8rem 0.5rem 1rem;
}

.emag-filter-form select:focus,
.emag-filter-form input:focus {
    outline: none;
    border-bottom-color: var(--color1, #0073aa);
}

.emag-filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-shrink: 0;
    flex-wrap: nowrap;
    margin: 0;
}

.emag-filter-form button {
    padding: 0.59em 1em 0.57em;
    border: none !important;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9375rem;
    transition: all 0.2s;
    min-width: 80px;
    margin: 0 1%;
    height: auto;
}

.emag-filter-submit {
    background: var(--color1, #0073aa);
    color: #fff;
}

.emag-filter-submit:hover {
    background: var(--color2, #005177);
}

.emag-filter-reset {
    background-color: var(--blanc, #fff);
    color: #000;
    border: thin solid var(--noir, #000) !important;
}

.emag-filter-reset:hover {
    background-color: #0073aa;
}

/* ==========================================================================
   Dark Mode pour formulaires
   ========================================================================== */

/* Compatible avec le nouveau système dark mode du thème (dark-mode.css) */
.is-dark-theme .emag-filter-form select,
.is-dark-theme .emag-filter-form input,
.is-dark-theme .emag-filter-form button {
    background-color: var(--bg-secondary, #2a2a2a);
    color: var(--text-primary, #fff);
    border-color: var(--border-color, #444);
}

.is-dark-theme .emag-filter-form input::placeholder {
    color: var(--text-secondary, #ccc);
}

.is-dark-theme .emag-filter-submit,
.is-dark-theme .emag-filter-reset {
    background-color: var(--bg-secondary, #2a2a2a);
    border-color: var(--border-color, #444);
    color: var(--text-primary, #fff);
}

.is-dark-theme .emag-filter-submit:hover,
.is-dark-theme .emag-filter-reset:hover {
    background-color: var(--border-color, #555);
}

/* ==========================================================================
   Responsive pour formulaires
   ========================================================================== */

@media (max-width: 1040px) {
    .emag-filter-form {
        display: flex;
    }

    .emag-filter-actions {
        display: flex;
        margin: 1em 1%;
    }
}

@media (max-width: 768px) {
    .emag-filter-form,
    .emag-filter-fields {
        flex-wrap: wrap;
        justify-content: center;
        flex-direction: column;
    }

    .emag-filter-fields {
        display: flex;
        padding: 1em;
        max-width: 400px;
        width: 100%;
        margin: auto;
    }

    .emag-filter-field {
        width: 100%;
        margin: 1em 0;
    }

    .emag-filter-actions {
        max-width: 400px;
        width: 100%;
        margin: auto;
        padding: 0.5em;
        flex-direction: row;
        display: flex;
        justify-content: center;
    }

    .emag-filter-form button {
        margin: 0.5em;
    }
}
