/**
 * Assets Hub - Estilos para página individual de ativo
 * Variáveis definidas em shared-variables.css
 * 
 * @package InvestimentosFinanceiros
 * @since 2.0.0
 */

.if-single-asset {
    background: var(--if-white) !important;
    color: var(--if-dark);
    font-family: 'Instrument Sans', sans-serif;
    padding: 3rem 0 5rem;
    min-height: 100vh;
}

.if-single-asset__wrap {
    width: min(1400px, 92vw);
    margin: 0 auto;
}

/* Breadcrumb */
.if-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--if-gray);
}

.if-breadcrumb a {
    color: var(--if-accent);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.if-breadcrumb a:hover {
    color: var(--if-light);
}

.if-breadcrumb span {
    color: var(--if-gray);
}

/* Header da página - estilo EXATAMENTE igual aos cards da listagem */
.if-single-asset__header {
    background: var(--if-panel) !important;
    border: 1px solid var(--if-border);
    border-radius: 22px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 30px 60px rgba(3, 7, 18, 0.45);
    backdrop-filter: blur(8px);
    transition: transform 220ms ease, border-color 220ms ease;
    color: #ffffff !important;
}

.if-single-asset__header:hover {
    transform: translateY(-4px);
    border-color: var(--if-glow);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* Todos os headings no header em branco */
.if-single-asset__header h1,
.if-single-asset__header h2,
.if-single-asset__header h3,
.if-single-asset__header h4,
.if-single-asset__header h5,
.if-single-asset__header h6 {
    color: #ffffff !important;
}

.if-single-asset__header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.if-single-asset__identity {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
}

.if-single-asset__logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 16px;
    background: var(--if-bg);
    padding: 12px;
    border: 1px solid var(--if-border);
}

.if-single-asset__info h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #ffffff !important;
}

.if-single-asset__info .company-name {
    display: block;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8) !important;
    margin-bottom: 0.75rem;
}

.if-single-asset__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.if-single-asset__tags span {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(214, 232, 247, 0.25);
    font-size: 0.8rem;
    color: rgba(214, 232, 247, 0.75);
    background: color-mix(in srgb, #5da9e9 10%, transparent);
}

.if-single-asset__price-box {
    text-align: right;
    min-width: 200px;
}

.if-single-asset__price {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.5rem;
    line-height: 1;
    color: #ffffff !important;
}

.if-single-asset__price small {
    font-size: 0.5em;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 600;
}

.if-single-asset__change {
    display: inline-flex;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    align-items: baseline;
}

.if-single-asset__change small {
    font-size: 0.8em;
}

/* Tooltip do gráfico */
.if-chart-tooltip {
    position: absolute;
    background: var(--if-white);
    border: 2px solid var(--if-primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 16px var(--if-shadow-hover);
    font-size: 0.9rem;
    min-width: 180px;
}

.if-chart-tooltip.visible {
    opacity: 1;
}

.if-chart-tooltip-date {
    font-weight: 600;
    color: var(--if-gray);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.if-chart-tooltip-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--if-primary);
}

.if-chart-crosshair {
    position: absolute;
    pointer-events: none;
}

.if-chart-crosshair-v {
    width: 2px;
    height: 100%;
    background: var(--if-accent);
    opacity: 0.5;
}

.if-chart-crosshair-h {
    width: 100%;
    height: 1px;
    background: rgba(93, 169, 233, 0.5);
}

.if-chart-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--if-primary);
    border: 3px solid var(--if-white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 2px 8px var(--if-shadow-hover);
}

/* Indicadores Principais */
.if-key-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--if-border);
}

.if-key-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.if-key-indicator__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 600;
}

.if-key-indicator__value {
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ffffff !important;
}

/* Grid de Conteúdo */
.if-single-asset__content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Seções - estilo EXATAMENTE igual aos cards da listagem */
.if-section {
    background: var(--if-panel) !important;
    border: 1px solid var(--if-border);
    border-radius: 22px;
    padding: 2rem;
    box-shadow: 0 30px 60px rgba(3, 7, 18, 0.45);
    backdrop-filter: blur(8px);
    transition: transform 220ms ease, border-color 220ms ease;
    color: #ffffff !important;
}

.if-section:hover {
    transform: translateY(-4px);
    border-color: var(--if-glow);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* Todos os headings nas sections em branco */
.if-section h1,
.if-section h2,
.if-section h3,
.if-section h4,
.if-section h5,
.if-section h6 {
    color: #ffffff !important;
}

.if-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--if-border);
}

.if-section__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff !important;
}

.if-section__subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8) !important;
    margin-top: 0.3rem;
}

/* Gráfico Principal */
.if-chart-container {
    width: 100%;
    height: 400px;
    position: relative;
    margin-bottom: 1.5rem;
}

.if-chart-container svg {
    width: 100%;
    height: 100%;
}

.if-chart-area {
    fill: url(#gradient-area);
    opacity: 0.3;
}

.if-chart-line {
    fill: none;
    stroke: var(--if-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 8px rgba(93, 169, 233, 0.6));
}

.if-chart-grid {
    stroke: rgba(214, 232, 247, 0.25);
    stroke-width: 1;
    opacity: 0.3;
}

.if-chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7) !important;
    margin-top: 0.5rem;
}

/* Período do gráfico */
.if-chart-period {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.if-chart-period button {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--if-border);
    background: transparent;
    color: var(--if-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.if-chart-period button:hover {
    border-color: #5da9e9;
    background: color-mix(in srgb, #5da9e9 15%, transparent);
}

.if-chart-period button.active {
    background: #5da9e9;
    color: #161616;
    border-color: #5da9e9;
}

/* Tabela de Dados */
.if-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.if-data-table thead {
    background: color-mix(in srgb, #5da9e9 10%, transparent);
}

.if-data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid var(--if-border);
}

.if-data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--if-border);
    font-variant-numeric: tabular-nums;
    color: #ffffff !important;
}

.if-data-table tbody tr:hover {
    background: color-mix(in srgb, #5da9e9 8%, transparent);
}

.if-data-table tbody tr:last-child td {
    border-bottom: none;
}

.if-data-table .positive,
.if-data-table .negative {
    font-weight: 600;
}

/* Paginação da tabela */
.if-table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(93, 169, 233, 0.2);
}

.if-table-pagination-info {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.9rem;
}

.if-table-pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.if-table-pagination button {
    padding: 0.5rem 1rem;
    background: rgba(93, 169, 233, 0.1);
    border: 1px solid rgba(93, 169, 233, 0.3);
    border-radius: 6px;
    color: #ffffff !important;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.if-table-pagination button:hover:not(:disabled) {
    background: rgba(93, 169, 233, 0.2);
    border-color: #5da9e9;
}

.if-table-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.if-table-pagination button.active {
    background: #5da9e9;
    border-color: #5da9e9;
    color: #161616;
}

/* Grid de Indicadores */
.if-indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.if-indicator-box {
    background: color-mix(in srgb, #5da9e9 5%, transparent);
    border: 1px solid rgba(214, 232, 247, 0.25);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.if-indicator-box:hover {
    transform: translateY(-2px);
    border-color: #5da9e9;
}

.if-indicator-box__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.8) !important;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.if-indicator-box__value {
    font-size: 1.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ffffff !important;
}

.if-indicator-box__value.is-up {
    color: var(--if-positive) !important;
}

.if-indicator-box__value.is-down {
    color: var(--if-negative) !important;
}

.if-indicator-box__description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8) !important;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Botão Voltar */
.if-back-button-wrapper {
    margin-top: 3rem;
    text-align: center;
}

.if-back-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(120deg, var(--if-accent), var(--if-light));
    color: #161616;
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.if-back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 169, 233, 0.3);
}

/* Responsive */
@media (max-width: 992px) {
    .if-single-asset__header {
        padding: 2rem;
    }
    
    .if-chart-container {
        height: 300px;
    }
    
    .if-indicators-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .if-single-asset {
        padding: 2rem 0;
    }
    
    .if-single-asset__header-top {
        flex-direction: column;
    }
    
    .if-single-asset__price-box {
        text-align: left;
        width: 100%;
    }
    
    .if-section {
        padding: 1.5rem;
    }
    
    .if-chart-container {
        height: 250px;
    }
    
    .if-key-indicators {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 1rem;
    }
    
    .if-data-table {
        font-size: 0.8rem;
    }
    
    .if-data-table th,
    .if-data-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .if-single-asset__identity {
        flex-direction: column;
        text-align: center;
    }
    
    .if-single-asset__info h1 {
        font-size: 1.8rem;
    }
    
    .if-indicators-grid {
        grid-template-columns: 1fr;
    }
}
