/**
 * ============================================
 * TOP 3 EXPERT PICKS COMPONENT STYLES
 * File: css/components/top3-expert.css
 * Dashboard V3 - AI Curated Stock Picks
 * Layout: 3-Column Horizontal Grid
 * ============================================
 */

/* Main Block */
.top3-expert-block {
    border-left: 4px solid #ffd700;
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, rgba(255, 215, 0, 0.05) 100%);
}

/* Expert Summary Section - Compact */
.top3-expert-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
    border-radius: var(--border-radius-md);
    margin-bottom: 1rem;
}

.expert-stance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.stance-icon {
    font-size: 1.75rem;
}

.stance-badge {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: var(--font-size-base);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expert-comment {
    font-size: var(--font-size-sm);
    color: #e2e8f0;
    line-height: var(--line-height-normal);
    flex: 1;
}

/* ============================================
 * CARDS GRID (3 or 5 columns)
 * ============================================ */
.top3-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: stretch;
}

/* TOP 5 Grid: 3 core cards on top row, 2 satellite on bottom centered */
.top5-cards-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.top5-cards-container .top3-card:nth-child(1),
.top5-cards-container .top3-card:nth-child(2),
.top5-cards-container .top3-card:nth-child(3) {
    grid-column: span 2;
}

.top5-cards-container .top3-card:nth-child(4) {
    grid-column: 2 / span 2;
}

.top5-cards-container .top3-card:nth-child(5) {
    grid-column: 4 / span 2;
}

/* Individual Stock Card - Enhanced */
.top3-card {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.top3-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.top3-card:nth-child(1)::before {
    background: linear-gradient(90deg, #ffd700, #ffed4a);
}

.top3-card:nth-child(2)::before {
    background: linear-gradient(90deg, #c0c0c0, #e5e5e5);
}

.top3-card:nth-child(3)::before {
    background: linear-gradient(90deg, #cd7f32, #daa06d);
}

.top3-card:nth-child(4)::before {
    background: linear-gradient(90deg, #6366f1, #818cf8);
}

.top3-card:nth-child(5)::before {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

/* Tier Visual Styling */
.top3-card.tier-core {
    border-top: none;
}

.top3-card.tier-satellite {
    border-top: none;
    opacity: 0.92;
}

.top3-card.tier-satellite:hover {
    opacity: 1;
}

/* Tier Badge */
.tier-badge {
    font-size: 8px;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.tier-badge.tier-core {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.tier-badge.tier-satellite {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.top3-card:hover {
    border-color: var(--color-accent-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Card Header - Prominent */
.top3-card-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

.top3-rank {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.top3-symbol-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-shrink: 0;
    min-width: 0;
}

.top3-symbol-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.top3-symbol {
    font-size: 1rem;
    font-weight: 800;
    color: var(--color-text-primary);
    letter-spacing: 0.5px;
}

.recurring-badge {
    font-size: 9px;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    font-weight: 600;
}

.recurring-badge.hot {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    animation: pulse-hot 2s ease-in-out infinite;
}

@keyframes pulse-hot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.top3-weight-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.top3-weight-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--color-text-secondary);
    padding: 0.1rem 0.3rem;
    background: var(--color-bg-tertiary);
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

.top3-weight-nav {
    font-size: 9px;
    font-weight: 800;
    color: var(--color-accent-primary);
}

.top3-sources {
    font-size: 9px;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Price Summary */
.top3-price-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
    padding: 0 0.25rem;
}

.price-close {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-accent-primary);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
    line-height: 1;
}

.price-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    align-items: flex-start;
}

.price-change {
    font-size: 9px;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    cursor: help;
}

.price-change.positive {
    background: var(--color-positive-bg);
    color: var(--color-positive);
}

.price-change.negative {
    background: var(--color-negative-bg);
    color: var(--color-negative);
}

.price-vol-abs {
    font-size: 9px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: help;
}

.price-vol-ratio {
    font-size: 9px;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    cursor: help;
}

.price-vol-ratio.vol-high {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.price-vol-ratio.vol-normal {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.price-vol-ratio.vol-low {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* Badge improvements */
.badge-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    cursor: help;
}

.badge-label {
    font-size: 7px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.badge-conviction,
.badge-freefloat {
    min-width: 30px;
    text-align: center;
}

.top3-badges {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-end;
    flex-shrink: 0;
}

.top3-badges .badge {
    padding: 0.15rem 0.375rem;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Card Body - Compact but Clear */
.top3-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    flex: 1;
}

.top3-reason {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Metrics Grid - 2x2 Compact */
.top3-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.25rem;
}

.metric-label {
    font-size: 9px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metric-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.metric-value.positive {
    color: var(--color-positive);
}

.metric-value.negative {
    color: var(--color-negative);
}

.metric-value.entry-range {
    color: var(--color-accent-primary);
    font-size: 12px;
    white-space: nowrap;
}

/* Support/Resistance Levels - Inline Compact */
.top3-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: 10px;
}

.level-item {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.level-item.support {
    background: var(--color-positive-bg);
    color: var(--color-positive);
}

.level-item.resistance {
    background: var(--color-negative-bg);
    color: var(--color-negative);
}

/* Alternative Row */
.detail-alternative {
    background: rgba(59, 130, 246, 0.06);
    border: 1px dashed rgba(59, 130, 246, 0.25);
    border-radius: 4px;
    padding: 0.5rem !important;
}

.detail-alternative .detail-label {
    color: var(--color-accent-primary);
}

.detail-alternative .detail-value strong {
    color: var(--color-accent-primary);
    font-size: 13px;
}

/* Portfolio Allocation Bar */
.portfolio-allocation-bar {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--color-bg-secondary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
}

.allocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.allocation-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.allocation-total {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.allocation-total strong {
    color: var(--color-accent-primary);
    font-size: 12px;
}

.allocation-track {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
}

.allocation-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    transition: width 0.3s ease;
}

.allocation-segment span {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.seg-stocks {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
}

.seg-etf {
    background: linear-gradient(135deg, #10b981, #14b8a6);
    color: #fff;
}

.seg-cash {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
    border-left: 1px solid var(--color-border);
}

.seg-cash span {
    text-shadow: none;
}

/* Warning Box - Compact */
.top3-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    background: var(--color-neutral-bg);
    border-radius: 4px;
    font-size: 10px;
    color: var(--color-neutral);
    line-height: 1.3;
}

.top3-warning .warning-icon {
    flex-shrink: 0;
    font-size: 11px;
}

/* Detail Toggle Button */
.top3-detail-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.375rem 0;
    background: none;
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    color: var(--color-accent-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.top3-detail-toggle:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-accent-primary);
}

.top3-detail-toggle.active {
    border-style: solid;
    background: var(--color-bg-tertiary);
}

.top3-detail-toggle .toggle-arrow {
    font-size: 9px;
    transition: transform 0.2s ease;
}

.top3-detail-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

/* Expanded Detail Section */
.top3-detail-expanded {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--color-bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--color-border-light, rgba(148, 163, 184, 0.1));
}

.detail-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.detail-row .detail-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-row .detail-value {
    font-size: 12px;
    color: var(--color-text-primary);
    line-height: 1.5;
}

.detail-row .detail-value.positive {
    color: var(--color-positive);
    font-weight: 700;
}

.detail-row.detail-warning .detail-value {
    color: var(--color-neutral);
    font-size: 11px;
}

/* Invalidation Section - Horizontal */
.top3-invalidation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-negative-bg);
    border-radius: var(--border-radius-sm);
    font-size: 11px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.invalidation-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.invalidation-label {
    font-weight: 700;
    color: var(--color-negative);
    flex-shrink: 0;
}

.invalidation-text {
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* AI Source Footer - Inline */
.top3-ai-source {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
    border-radius: var(--border-radius-sm);
    font-size: 11px;
}

.ai-source-icon {
    font-size: 1.125rem;
}

.ai-source-text {
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ai-source-text strong {
    color: #60a5fa;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fallback-badge {
    background: var(--color-neutral);
    color: #1e293b;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
}

.ai-timestamp {
    color: #94a3b8;
    font-size: 10px;
}

/* ============================================
 * RESPONSIVE STYLES
 * ============================================ */

/* Tablet - 2 columns */
@media (max-width: 1200px) {
    .top3-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .top3-cards-container .top3-card:nth-child(3) {
        grid-column: span 2;
        max-width: 50%;
        margin: 0 auto;
    }

    .top5-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .top5-cards-container .top3-card:nth-child(1),
    .top5-cards-container .top3-card:nth-child(2),
    .top5-cards-container .top3-card:nth-child(3),
    .top5-cards-container .top3-card:nth-child(4),
    .top5-cards-container .top3-card:nth-child(5) {
        grid-column: span 1;
    }

    .top5-cards-container .top3-card:nth-child(5) {
        grid-column: span 2;
        max-width: 50%;
        margin: 0 auto;
    }
}

/* Mobile - 1 column */
@media (max-width: 768px) {
    .top3-expert-summary {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .expert-stance {
        justify-content: center;
    }

    .top3-cards-container {
        grid-template-columns: 1fr;
    }

    .top3-cards-container .top3-card:nth-child(3) {
        grid-column: span 1;
        max-width: 100%;
    }

    .top5-cards-container {
        grid-template-columns: 1fr;
    }

    .top5-cards-container .top3-card:nth-child(1),
    .top5-cards-container .top3-card:nth-child(2),
    .top5-cards-container .top3-card:nth-child(3),
    .top5-cards-container .top3-card:nth-child(4),
    .top5-cards-container .top3-card:nth-child(5) {
        grid-column: span 1;
        max-width: 100%;
    }

    .top3-card-header {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .top3-price-summary {
        order: 3;
        width: 100%;
        justify-content: center;
        padding: 0.5rem 0;
        margin-top: 0.25rem;
        border-top: 1px solid var(--color-border);
    }

    .price-details {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }

    .top3-badges {
        flex-direction: row;
        width: 100%;
        margin-top: 0.5rem;
        justify-content: flex-start;
        order: 4;
        gap: 1rem;
    }

    .badge-group {
        flex-direction: row;
        gap: 0.25rem;
    }

    .badge-label {
        font-size: 9px;
    }

    .top3-metrics {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .top3-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .top3-symbol {
        font-size: 0.95rem;
    }

    .top3-rank {
        font-size: 1.25rem;
    }
}
