/**
 * Styles pour le client DeFi Rates
 */

/* Colonnes triables */
.sortable {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #667eea;
}

.sort-icon {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    color: #667eea;
}

/* Badges de protocoles - VERSION SOBRE */
.protocol-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    border-left-width: 3px !important;
    /* Petit trait de couleur distintif */
}

.protocol-aave {
    border-left-color: #B6509E !important;
}

.protocol-morpho {
    border-left-color: #00D4AA !important;
}

.protocol-compound {
    border-left-color: #00D395 !important;
}

.protocol-euler {
    border-left-color: #FF6B6B !important;
}

.protocol-curve {
    border-left-color: #FE4A49 !important;
}

.protocol-kamino {
    border-left-color: #667EEA !important;
}

.protocol-jupiter {
    border-left-color: #FFA500 !important;
}

.protocol-fluid {
    border-left-color: #00D4FF !important;
}

.protocol-venus {
    border-left-color: #FFD700 !important;
}

/* Badges de type (Borrow, Lend, etc.) - STYLE SIMPLE SANS ENCERCLER */
.type-badge {
    display: inline-block;
    padding: 2px 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.type-borrow {
    color: #667eea !important;
}

.type-lend {
    color: #764ba2 !important;
}

.type-stake {
    color: #00d4aa !important;
}

.type-farm {
    color: #ffa500 !important;
}

.type-vault {
    color: #ff6b6b !important;
}

.type-earn {
    color: #4facfe !important;
}

/* Nom des pools */
.pool-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.pool-name:hover {
    color: rgba(255, 255, 255, 1);
    cursor: help;
}



/* Badges de blockchains */
.blockchain-badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 2px solid;
}

.blockchain-ethereum {
    background: rgba(98, 126, 234, 0.1);
    border-color: #627eea;
    color: #627eea;
}

.blockchain-arbitrum {
    background: rgba(40, 160, 240, 0.1);
    border-color: #28a0f0;
    color: #28a0f0;
}

.blockchain-optimism {
    background: rgba(255, 4, 32, 0.1);
    border-color: #ff0420;
    color: #ff0420;
}

.blockchain-polygon {
    background: rgba(130, 71, 229, 0.1);
    border-color: #8247e5;
    color: #8247e5;
}

.blockchain-avalanche {
    background: rgba(232, 65, 66, 0.1);
    border-color: #e84142;
    color: #e84142;
}

.blockchain-base {
    background: rgba(0, 82, 255, 0.1);
    border-color: #0052ff;
    color: #0052ff;
}

.blockchain-bsc {
    background: rgba(243, 186, 47, 0.1);
    border-color: #f3ba2f;
    color: #f3ba2f;
}

.blockchain-solana {
    background: rgba(20, 241, 149, 0.1);
    border-color: #14f195;
    color: #14f195;
}

.blockchain-gnosis {
    background: rgba(0, 139, 139, 0.1);
    border-color: #008b8b;
    color: #008b8b;
}

.blockchain-linea {
    background: rgba(121, 82, 179, 0.1);
    border-color: #7952b3;
    color: #7952b3;
}

.blockchain-metis {
    background: rgba(0, 217, 217, 0.1);
    border-color: #00d9d9;
    color: #00d9d9;
}

.blockchain-scroll {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
    color: #ffa500;
}

.blockchain-sonic {
    background: rgba(138, 43, 226, 0.1);
    border-color: #8a2be2;
    color: #8a2be2;
}

.blockchain-zksync {
    background: rgba(75, 0, 130, 0.1);
    border-color: #4b0082;
    color: #4b0082;
}

/* Valeurs APY */
.apy-value {
    font-weight: 700;
    font-size: 0.9rem;
    /* Réduit de 1.1rem */
    padding: 0.25rem 0.5rem;
    /* Réduit pour être moins massif */
    border-radius: 6px;
    display: inline-block;
}

.apy-high {
    background: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
    color: #000;
}

.apy-medium {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
}

.apy-low {
    background: rgba(255, 255, 255, 0.1);
    color: #888;
}

/* Filtres de protocoles */
.protocol-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.protocol-filter {
    padding: 0.6rem 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.protocol-filter:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.protocol-filter.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Filtres de type */
.type-filter {
    padding: 0.6rem 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.type-filter:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.type-filter.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border-color: #764ba2;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}


/* Spinner de chargement */
#loading-spinner {
    display: none;
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Message d'erreur */
#error-message {
    display: none;
    padding: 1rem;
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

/* Dernière mise à jour */
#last-update {
    text-align: right;
    color: #888;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Bouton de rafraîchissement */
#refresh-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#refresh-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tableau responsive */
@media (max-width: 768px) {
    .protocol-filters {
        flex-direction: column;
    }

    .protocol-filter {
        width: 100%;
        text-align: center;
    }

    table {
        font-size: 0.875rem;
    }

    .apy-value {
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

tbody tr {
    animation: fadeIn 0.3s ease;
}

/* Hover sur les lignes */
tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Styles pour les dropdowns dans les en-têtes de tableau */
.table-filter-select {
    width: 100% !important;
    min-height: 42px !important;
    /* Même hauteur que les labels */
    min-width: 80px !important;
    /* Réduit encore */
    max-width: none !important;
    padding: 0.4rem 0.4rem !important;
    /* Réduit encore légèrement */
    padding-right: 1.4rem !important;
    /* Réduit pour gagner de l'espace texte */
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%) !important;
    border: 2px solid rgba(102, 126, 234, 0.25) !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    text-transform: none !important;
    /* Désactive majuscules forcées */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.3rem center !important;
    /* Décalé vers la droite */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    vertical-align: middle !important;
    text-align: center !important;
    /* Centrage du texte du menu */
    text-indent: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Style compact pour les boutons du tableau pour éviter les coupures */
.rates-table .btn-primary {
    padding: 0.4rem 0.6rem !important;
    /* Réduit pour gagner de la place */
    font-size: 0.85rem !important;
    min-width: 85px !important;
    /* Largeur minimale garantie */
    justify-content: center !important;
}

.table-filter-select:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.table-filter-select:focus {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.25), 0 6px 16px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.table-filter-select option {
    background: #1a1a2e;
    color: #fff;
    padding: 0.75rem;
    font-weight: 500;
}

/* Ajustement des en-têtes avec dropdowns */
.rates-table thead th {
    padding: 1rem 0.3rem;
    /* Réduit pour éviter les chevauchements */
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.2);
    height: 70px;
}

/* Espacement pour les colonnes avec dropdowns - NOUVEL ORDRE FINAL */
.rates-table thead th:nth-child(1),
/* Protocole */
.rates-table thead th:nth-child(2),
/* Blockchain */
.rates-table thead th:nth-child(3),
/* Asset */
.rates-table thead th:nth-child(7) {
    /* Type */
    padding: 1rem 0.5rem;
    /* Padding modéré pour les dropdowns */
}

/* Style uniforme pour tous les spans d'en-tête */
.rates-table thead th>span {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: inline-block;
}

/* Amélioration des icônes de tri */
.sort-icon {
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    font-size: 1.1rem;
}

.sortable:hover .sort-icon {
    opacity: 1;
    transform: scale(1.3);
    color: #667eea;
}

/* Animation pour les colonnes triables */
.sortable {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
}

.sortable:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* Style pour les divs dans les en-têtes */
.rates-table thead th>div {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

/* Responsive pour les dropdowns */
@media (max-width: 1200px) {
    .table-filter-select {
        min-width: 150px;
        font-size: 0.85rem;
        padding: 0.75rem 0.9rem;
        padding-right: 2.5rem;
    }

    .rates-table thead th {
        height: 65px;
    }
}

@media (max-width: 768px) {
    .table-filter-select {
        min-width: 120px;
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
        padding-right: 2.2rem;
    }

    .rates-table thead th {
        padding: 0.75rem 0.5rem;
        height: 60px;
    }

    .rates-table thead th>span {
        font-size: 0.85rem;
    }
}

/* Bannière d'information TVL */
.tvl-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    margin-bottom: 2rem;
    animation: fadeIn 0.8s ease-out;
}

.tvl-info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tvl-info-content h4 {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.tvl-info-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin: 0;
}

.tvl-info-content strong {
    color: #667eea;
}

@media (max-width: 768px) {
    .tvl-info-banner {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
}

/* Custom Multi-select Dropdown */
.multiselect-container {
    position: relative;
    width: 100%;
    z-index: 100;
}

.multiselect-trigger {
    width: 100%;
    padding: 0.4rem 0.4rem;
    padding-right: 1.4rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 2px solid rgba(102, 126, 234, 0.25);
    border-radius: 10px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    position: relative;
    text-transform: none !important;
}

.multiselect-trigger::after {
    content: '';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #667eea;
}

.multiselect-options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: #1a1a2e;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    margin-top: 5px;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
    z-index: 1000;
}

.multiselect-container.active .multiselect-options {
    display: block;
}

.multiselect-option {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
    color: #fff;
    font-size: 0.85rem;
    text-align: left;
}

.multiselect-option:hover {
    background: rgba(102, 126, 234, 0.2);
}

.multiselect-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.multiselect-option input[type="checkbox"]:checked {
    background: #667eea;
    border-color: #667eea;
}

.multiselect-option input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
}

.multiselect-option span {
    flex-grow: 1;
}