/* Annual Returns & Intra-year Declines — estilos del plugin
   Paleta y patrones de docs/design/design-system.md y plugin-ui-standards.md */

.ard-wrap {
    --bf-primary: #026580;
    --bf-buy: #27AE60;
    --bf-sell: #E74C3C;
    --cpg-accent: #026580;
    font-family: 'Roboto', system-ui, sans-serif;
    color: #333;
    max-width: 100%;
    box-sizing: border-box;
}
.ard-wrap *,
.ard-wrap *::before,
.ard-wrap *::after { box-sizing: border-box; }

.ard-panel {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 10px;
    padding: 18px 18px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Cabecera (§3): título → controles → ℹ ───────────────────────────────── */
.ard-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--cpg-accent, #026580);
}
.ard-title {
    flex: 1;
    min-width: 160px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
}

/* ── Selector con búsqueda ───────────────────────────────────────────────── */
.ard-selector { position: relative; min-width: 200px; }
.ard-search {
    width: 220px;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid #d6dadf;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    background: #fff;
}
.ard-search:focus {
    outline: none;
    border-color: var(--bf-primary);
    box-shadow: 0 0 0 2px rgba(2, 101, 128, 0.15);
}
.ard-dropdown {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    width: 320px;
    max-width: 90vw;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d6dadf;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.ard-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.88rem;
    border-bottom: 1px solid #f3f4f6;
}
.ard-opt:last-child { border-bottom: none; }
.ard-opt:hover { background: #f2f7f9; }
.ard-opt.is-selected { background: #e8f3f6; }
.ard-opt .ard-opt-sym { color: #6c757d; font-size: 0.78rem; margin-left: auto; }
.ard-opt-empty { padding: 12px; color: #6c757d; font-size: 0.85rem; }

/* ── Toggle de modo ──────────────────────────────────────────────────────── */
.ard-mode-toggle {
    display: inline-flex;
    border: 1px solid #d6dadf;
    border-radius: 6px;
    overflow: hidden;
}
.ard-mode-btn {
    border: none;
    background: #fff;
    color: #555;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ard-mode-btn + .ard-mode-btn { border-left: 1px solid #d6dadf; }
.ard-mode-btn.active { background: var(--bf-primary); color: #fff; }

/* ── Filtro de años From/To ───────────────────────────────────────────────── */
.ard-year-range {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.ard-year-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: #555;
    font-weight: 600;
}
.ard-year-range select {
    padding: 6px 8px;
    border: 1px solid #d6dadf;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    cursor: pointer;
}
.ard-year-range select:focus {
    outline: none;
    border-color: var(--bf-primary);
    box-shadow: 0 0 0 2px rgba(2, 101, 128, 0.15);
}

/* ── Chips de seleccionados ──────────────────────────────────────────────── */
.ard-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    min-height: 0;
}
.ard-chips:empty { display: none; }
.ard-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border-radius: 14px;
    font-size: 0.8rem;
    color: #fff;
    line-height: 1.2;
}
.ard-chip-remove {
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ard-chip-remove:hover { background: rgba(255, 255, 255, 0.45); }

/* ── Pesos (modo Combinar) ───────────────────────────────────────────────── */
.ard-weights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #f7f9fa;
    border-radius: 8px;
}
.ard-weight-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}
.ard-weight-row .ard-weight-name {
    min-width: 70px;
    max-width: 150px;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ard-weight-row input[type="range"] { width: 110px; accent-color: var(--bf-primary); }
.ard-weight-row .ard-weight-pct {
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #026580;
    font-weight: 600;
}

/* ── Área del gráfico ────────────────────────────────────────────────────── */
.ard-chart-area {
    position: relative;
    width: 100%;
    height: 460px;
}
@media (max-width: 960px) { .ard-chart-area { height: 380px; } }
@media (max-width: 600px) { .ard-chart-area { height: 320px; } }
.ard-chart-area canvas { width: 100% !important; height: 100% !important; }

.ard-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
}
.ard-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #d6dadf;
    border-top-color: var(--bf-primary);
    border-radius: 50%;
    animation: ard-spin 0.8s linear infinite;
}
@keyframes ard-spin { to { transform: rotate(360deg); } }

.ard-nodata {
    padding: 40px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 0.95rem;
}
.ard-hint {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: #9aa1a8;
}

/* ── Botón ℹ + panel inline (réplica de company_profile para look idéntico) ─ */
.cpg-info-btn {
    width: 22px; height: 22px; border-radius: 50%; border: none;
    background: transparent; color: var(--cpg-accent, #026580);
    cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; position: relative; transition: background 0.15s, color 0.15s;
}
.cpg-info-btn-icon { width: 100%; height: 100%; display: block; pointer-events: none; }
.cpg-info-btn:hover { background: #026580; color: #fff; }
.cpg-info-btn[aria-expanded="true"] { background: var(--cpg-accent, #026580); color: #fff; }

.cpg-info-inline-panel {
    position: relative;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease, padding 0.2s ease, margin 0.2s ease, box-shadow 0.2s ease;
    background: #f2f4f6;
    color: #444;
    border: none;
    border-radius: 6px;
    margin-bottom: 0;
    font-family: 'Roboto', system-ui, sans-serif;
    font-size: 0.875rem;
    line-height: 1.7;
    box-shadow: none;
}
.cpg-info-inline-panel.is-open {
    max-height: min(480px, 38vh);
    padding: 34px 20px 18px;
    margin-bottom: 14px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.cpg-info-close {
    display: none;
    position: absolute;
    top: 6px; right: 6px; z-index: 2;
    width: 28px; height: 28px; padding: 0;
    border: none; border-radius: 4px;
    background: transparent; color: #6c757d;
    font-size: 1.35rem; line-height: 1; cursor: pointer;
    align-items: center; justify-content: center;
}
.cpg-info-inline-panel.is-open .cpg-info-close { display: flex; }
.cpg-info-close:hover { background: rgba(0, 0, 0, 0.07); color: #333; }
.cpg-info-section + .cpg-info-section { margin-top: 18px; }
.cpg-info-section-title {
    font-weight: 600;
    color: var(--cpg-accent, #026580);
    margin: 0 0 6px;
    line-height: 1.4;
}
.cpg-info-section-body p { margin: 0 0 10px; color: #444; }
.cpg-info-section-body p:last-child { margin-bottom: 0; }
.cpg-info-section-body ul { margin: 0; padding: 0 0 0 1.25em; list-style: disc; }
.cpg-info-section-body li { margin-bottom: 8px; color: #444; }
.cpg-info-section-body li:last-child { margin-bottom: 0; }
.cpg-info-section-body li strong { color: #333; font-weight: 600; }
.cpg-info-inline-body.cpg-info-plain { white-space: pre-line; }

@media (max-width: 767px) {
    .cpg-info-inline-panel.is-open { max-height: min(440px, 42vh); padding: 14px 16px 16px; }
    .ard-search { width: 100%; }
    .ard-title { min-width: 100%; }
}
