/* ========================================
   Balance Display - Affichage du solde OpenRouter
   ======================================== */

.balance-display {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.balance-info,
.balance-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary, #1f2937);
    transition: all 0.2s;
    cursor: pointer;
}

.balance-info:hover {
    background: var(--bg-tertiary, #e5e7eb);
}

.balance-error {
    color: var(--color-warning, #f59e0b);
    cursor: help;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.balance-label {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
}

.balance-value {
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.balance-remaining .balance-value {
    color: #00add0;
    /* Vert pour le solde */
}

.balance-usage .balance-value.expense {
    color: var(--gray-100)
        /* Rouge pour les dépenses */
}

.balance-separator {
    opacity: 0.3;
    font-weight: 300;
}

.btn-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
    margin-left: 4px;
}

.btn-refresh:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.btn-refresh.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icon-xs {
    width: 14px;
    height: 14px;
}

@keyframes pulse-update {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.balance-value.updating {
    animation: pulse-update 0.3s ease-in-out;
}

.balance-info,
.balance-item,
.btn-refresh {
    display: flex;
    align-items: center;
    line-height: 1;
    /* Empêche la ligne de tirer vers le haut */
}

.balance-value,
.balance-label {
    display: flex;
    align-items: center;
    line-height: 1;
}

.icon,
.icon-sm,
.icon-xs {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.balance-value {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transform: translateY(1px);
}

/* Responsive - version compacte sur petits écrans */
@media (max-width: 1024px) {
    .balance-label {
        display: none;
    }

    .balance-info {
        font-size: 12px;
        padding: 4px 8px;
        gap: 6px;
    }
}

@media (max-width: 640px) {
    .balance-display {
        margin-right: 0;
    }

    .balance-info {
        padding: 4px 6px;
        gap: 4px;
    }

    .balance-separator {
        display: none;
    }
}

/* --- COMPACT MODE --- */
.balance-display.compact {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.balance-display.compact .balance-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.balance-display.compact .balance-info:hover {
    background: var(--bg-tertiary, #e5e7eb);
}

.balance-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
}

.balance-compact .balance-remaining {
    color: #059669;
}

.balance-compact .balance-usage {
    color: #dc2626;
}

.balance-compact .separator {
    opacity: 0.3;
    font-weight: 300;
}

.btn-refresh-mini {
    display: flex;
    padding: 2px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-refresh-mini:hover {
    opacity: 1;
}

.btn-refresh-mini.spinning {
    animation: spin 1s linear infinite;
}

.icon-xxs {
    width: 12px;
    height: 12px;
}