/* ============================================
   CERCA AVANÇADA INDRET - Estil tipus Springer
   Guardar com: css/advanced-search.css
   ============================================ */

.indret-advanced-search-wrapper {
    /* background: #f8f9fa; */
    padding: 20px 0 0px;
    min-height: 100vh;
}

.indret-advanced-search-wrapper .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Títol principal */
.search-title {
    font-size: 32px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #003366;
}

/* Formulari de cerca */
.advanced-search-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.search-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #003366;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

input[type="date"].form-control {
    padding: 9px 12px;
}

/* Botons d'acció */
.form-actions {
    display: flex;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #003366;
    color: #fff;
}

.btn-primary:hover {
    background: #00509e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Loader del botó */
.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Resultats */
.search-results {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-left: 15px !important;
}

.results-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Item de resultat */
.result-item {
    padding: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.result-item:hover {
    border-color: #003366;
    box-shadow: 0 2px 12px rgba(0, 51, 102, 0.1);
    background: #fff;
}

.result-header {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.result-edition {
    display: inline-block;
    padding: 4px 12px;
    background: #003366;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
}

.result-area {
    display: inline-block;
    padding: 4px 12px;
    background: #e9ecef;
    color: #495057;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.result-title a {
    color: #003366;
    text-decoration: none;
    transition: color 0.2s;
}

.result-title a:hover {
    color: #00509e;
    text-decoration: underline;
}

.result-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 12px 0;
    font-style: italic;
}

.result-authors {
    font-size: 14px;
    color: #555;
    font-weight: 600;
    margin-bottom: 6px;
}

.result-organization {
    font-size: 13px;
    color: #777;
    margin-bottom: 12px;
}

.result-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.result-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #888;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.result-date,
.result-downloads {
    display: flex;
    align-items: center;
}

.result-downloads::before {
    content: "↓";
    margin-right: 4px;
    font-weight: bold;
}

/* Paginació */
.search-pagination {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
}

.search-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #003366;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.search-pagination .page-numbers:hover {
    background: #003366;
    color: #fff;
    border-color: #003366;
}

.search-pagination .page-numbers.current {
    background: #003366;
    color: #fff;
    border-color: #003366;
}

.search-pagination .page-numbers.dots {
    border: none;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .search-form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .result-item {
        padding: 20px;
    }

    .result-title {
        font-size: 18px;
    }

    .result-meta {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .indret-advanced-search-wrapper {
        padding: 20px 0 40px;
    }

    .advanced-search-form,
    .search-results {
        padding: 20px;
    }

    .search-title {
        font-size: 24px;
    }
}

/* Missatges d'estat */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results-message h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #555;
}

.no-results-message p {
    font-size: 15px;
    color: #888;
}

/* Autocompletat d'autor */
#autor_search {
    position: relative;
}

#autor_search:focus {
    border-color: #003366;
}

/*** ***/

.separa-petit {
    display: none;
}

.col-md-2:has(.dates) {
    display: none;
}

.col-md-2:has(.dates)+.col-md-8 {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

.altura_entrada_home {
    height: 320px !important;
}

.costext h1.entry-title a {
    font-family: 'indretlectitalic' !important;
    color: black !important;
    transition: color 0.1s linear;
}

.costext h1.entry-title a:hover {
    color: rgb(253, 80, 44) !important
}

.search-form-grid input[type="text"],
.search-form-grid select {
    padding: 3px;
    color: #000 !important;
    border: 0px solid #ccc;
    border-radius: 0px;
    background-color: white;
    border: 1px solid #ccc;
    font-family: 'indrettext Light' !important;
    font-size: 16px !important;
    padding: 5px;
    padding-left: 10px;
    width: 100%;
}

.search-form-grid input[type="text"] {
    margin-top: 0px !important;
}


button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
    display: block !important;
}

button {
    font-family: 'indrettext Light' !important;
}

/* CLS fix: reservar l'alçada del select#tag (multi) per evitar layout shift
   quan TomSelect el substitueix pel .ts-wrapper (38px).
   El navegador renderitza <select multiple> a ~105px per defecte. */
select#tag {
    height: 38px;
    overflow: hidden;
}

/* Tom Select — integració amb estil InDret */
.ts-wrapper {
    font-family: 'indrettext Light', sans-serif;
    font-size: 14px;
}

.ts-wrapper.multi .ts-control {
    min-height: 38px;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 4px 8px;
    background: #fff;
    cursor: text;
}

.ts-wrapper.multi .ts-control .item {
    background: #c8102e;
    color: #fff;
    border-radius: 2px;
    padding: 2px 20px 2px 8px;
    margin: 2px 3px 2px 0;
    font-size: 13px;
}

.ts-wrapper.multi .ts-control .item .remove {
    color: rgba(255,255,255,0.8);
    border-left: 1px solid rgba(255,255,255,0.3);
    margin-left: 6px;
    padding-left: 6px;
}

.ts-wrapper.multi .ts-control .item .remove:hover {
    color: #fff;
    background: transparent;
}

.ts-wrapper .ts-dropdown {
    border-radius: 0;
    border-color: #ccc;
    font-family: 'indrettext Light', sans-serif;
    font-size: 14px;
    max-height: 220px;
}

.ts-wrapper .ts-dropdown .option:hover,
.ts-wrapper .ts-dropdown .option.active {
    background: #f0f0f0;
    color: #333;
}

.ts-wrapper .ts-dropdown .option.selected {
    background: #fce8eb;
    color: #c8102e;
}

.ts-wrapper .clear-button {
    color: #999;
    font-size: 16px;
}

.ts-wrapper .clear-button:hover {
    color: #c8102e;
}

@media only screen and (max-width: 992px) {
    .d-none {
        display: none !important;
    }
}

