/* =================================================================
   LUMEN INTELLIGENCE - Portfolio View Styles
   Enterprise Multi-Location Dashboard
   ================================================================= */

/* Portfolio Body - Match dashboard background */
.portfolio-body {
    background: var(--bg-primary);
    min-height: 100vh;
}

/* ================================
   ENTRANCE ANIMATION OVERLAY
   Neural Network Intelligence Reveal
   ================================ */
.entrance-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #050510;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.entrance-overlay.fade-out {
    animation: entrance-fade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes entrance-fade {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* Neural Network Canvas */
#particleCanvas {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Subtle grid background - signals precision/intelligence */
.entrance-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.entrance-grid.active {
    opacity: 1;
}

/* Central convergence point - the moment of insight */
.entrance-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    z-index: 5;
    opacity: 0;
    box-shadow:
        0 0 20px rgba(96, 165, 250, 0.8),
        0 0 40px rgba(96, 165, 250, 0.4),
        0 0 80px rgba(59, 130, 246, 0.3);
}

.entrance-core.active {
    animation: core-pulse 2s ease-out forwards;
}

@keyframes core-pulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        box-shadow:
            0 0 30px rgba(96, 165, 250, 1),
            0 0 60px rgba(96, 165, 250, 0.6),
            0 0 120px rgba(59, 130, 246, 0.4),
            0 0 200px rgba(59, 130, 246, 0.2);
    }
}

/* Light rays emanating from core */
.entrance-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vmax;
    height: 100vmax;
    z-index: 2;
    opacity: 0;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(96, 165, 250, 0.08) 8deg,
        transparent 18deg,
        transparent 28deg,
        rgba(34, 211, 238, 0.05) 38deg,
        transparent 48deg,
        transparent 58deg,
        rgba(96, 165, 250, 0.08) 68deg,
        transparent 78deg,
        transparent 88deg,
        rgba(34, 211, 238, 0.05) 98deg,
        transparent 108deg,
        transparent 118deg,
        rgba(96, 165, 250, 0.08) 128deg,
        transparent 138deg,
        transparent 148deg,
        rgba(34, 211, 238, 0.05) 158deg,
        transparent 168deg,
        transparent 178deg,
        rgba(96, 165, 250, 0.08) 188deg,
        transparent 198deg,
        transparent 208deg,
        rgba(34, 211, 238, 0.05) 218deg,
        transparent 228deg,
        transparent 238deg,
        rgba(96, 165, 250, 0.08) 248deg,
        transparent 258deg,
        transparent 268deg,
        rgba(34, 211, 238, 0.05) 278deg,
        transparent 288deg,
        transparent 298deg,
        rgba(96, 165, 250, 0.08) 308deg,
        transparent 318deg,
        transparent 328deg,
        rgba(34, 211, 238, 0.05) 338deg,
        transparent 348deg,
        transparent 360deg
    );
}

.entrance-rays.active {
    animation: rays-appear 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rays-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(30deg);
    }
}

/* Brand Reveal */
.entrance-brand {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
}

.entrance-brand.active {
    animation: brand-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes brand-reveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.entrance-logo {
    font-size: clamp(3rem, 10vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 0.25em;
    margin: 0;
    color: #ffffff;
    position: relative;
}

.entrance-logo .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 30px rgba(96, 165, 250, 0.4),
        0 0 60px rgba(59, 130, 246, 0.2);
}

.entrance-brand.active .letter {
    animation: letter-reveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.entrance-brand.active .letter:nth-child(1) { animation-delay: 0s; }
.entrance-brand.active .letter:nth-child(2) { animation-delay: 0.05s; }
.entrance-brand.active .letter:nth-child(3) { animation-delay: 0.1s; }
.entrance-brand.active .letter:nth-child(4) { animation-delay: 0.15s; }
.entrance-brand.active .letter:nth-child(5) { animation-delay: 0.2s; }

@keyframes letter-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entrance-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    font-weight: 500;
    letter-spacing: 0.4em;
    color: rgba(96, 165, 250, 1);
    margin: var(--space-3) 0 0 0;
    opacity: 0;
    text-transform: uppercase;
}

.entrance-brand.active .entrance-subtitle {
    animation: subtitle-reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

@keyframes subtitle-reveal {
    from {
        opacity: 0;
        letter-spacing: 0.8em;
    }
    to {
        opacity: 1;
        letter-spacing: 0.4em;
    }
}

.entrance-tagline {
    font-size: clamp(0.75rem, 1.5vw, 0.9rem);
    font-weight: 400;
    color: rgba(148, 163, 184, 0.9);
    margin: var(--space-3) 0 0 0;
    opacity: 0;
}

.entrance-brand.active .entrance-tagline {
    animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skip Button */
.entrance-skip {
    position: absolute;
    bottom: var(--space-6);
    right: var(--space-6);
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

.entrance-skip:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .entrance-overlay,
    .entrance-brand,
    .entrance-logo .letter,
    .entrance-subtitle,
    .entrance-tagline,
    .entrance-core,
    .entrance-rays,
    .entrance-grid {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}


/* ================================
   MAIN PORTFOLIO VIEW
   ================================ */
.portfolio-main {
    min-height: 100vh;
    background: var(--bg-primary);
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.portfolio-main.visible {
    opacity: 1;
}

/* Portfolio Header */
.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Logo styling - Uses nav__logo classes from styles.css */
.portfolio-header .nav__logo {
    text-decoration: none;
}

.portfolio-header .nav__logo-icon {
    color: var(--accent);
}

.portfolio-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.portfolio-header__actions .btn--ghost {
    padding: var(--space-2);
    color: var(--text-secondary);
}

.portfolio-header__actions .btn--ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.portfolio-header__actions .btn--ghost svg {
    width: 20px;
    height: 20px;
}

/* Portfolio Content */
.portfolio-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

/* Hero Section */
.portfolio-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-4);
}

.portfolio-hero__content {
    flex: 1;
}

.portfolio-hero__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.portfolio-hero__subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.portfolio-hero__period {
    display: flex;
    align-items: center;
}

/* Uses global select styles from styles.css */
.portfolio-period-select {
    min-width: 140px;
}

/* KPI Section Styling */
.portfolio-kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-3);
    padding: 0 var(--space-6);
    margin-bottom: var(--space-4);
}

.portfolio-kpi {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    transition: all 0.2s ease;
}

.portfolio-kpi:hover {
    border-color: var(--border-default);
}

.portfolio-kpi--primary {
    grid-column: span 1;
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.portfolio-kpi__label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.portfolio-kpi__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.portfolio-kpi__value--health {
    color: var(--success);
}

.portfolio-kpi__trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: var(--space-1);
}

.portfolio-kpi__trend svg {
    width: 12px;
    height: 12px;
}

.portfolio-kpi__trend--up {
    color: var(--success);
}

.portfolio-kpi__trend--down {
    color: var(--error);
}

.portfolio-kpi__meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* Locations Section */
.portfolio-locations {
    padding: 0 var(--space-6);
}

.portfolio-locations__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.portfolio-locations__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.portfolio-locations__sort {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Uses global select styles from styles.css */
.portfolio-locations__sort select {
    font-size: 0.8rem;
}

/* Summary Section */
.portfolio-summary {
    margin-bottom: var(--space-8);
}

.portfolio-summary__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-6);
}

.portfolio-summary__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.portfolio-summary__subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Period Selector */
.period-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.period-selector__label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.period-selector__select {
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-selector__select:hover {
    border-color: var(--border-default);
}

.period-selector__select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.data-flash {
    animation: data-update-flash 0.5s ease-out;
}

@keyframes data-update-flash {
    0% { background: rgba(59, 130, 246, 0.15); }
    100% { background: transparent; }
}

/* Location Cards Grid */
.location-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
}

/* Location Card */
.location-card {
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: card-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

.location-card:nth-child(1) { animation-delay: 0.1s; }
.location-card:nth-child(2) { animation-delay: 0.15s; }
.location-card:nth-child(3) { animation-delay: 0.2s; }
.location-card:nth-child(4) { animation-delay: 0.25s; }
.location-card:nth-child(5) { animation-delay: 0.3s; }

.location-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.2);
}

/* Status-based card accents */
.location-card--top-performer {
    border-color: rgba(251, 191, 36, 0.3);
}

.location-card--top-performer:hover {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 12px 40px rgba(251, 191, 36, 0.1);
}

.location-card--healthy {
    border-color: rgba(34, 197, 94, 0.2);
}

.location-card--healthy:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

.location-card--warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.location-card--warning:hover {
    border-color: rgba(245, 158, 11, 0.5);
}

.location-card--growing {
    border-color: rgba(99, 102, 241, 0.3);
}

.location-card--growing:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

/* Card Header - Contains name, address, and status badge */
.location-card__header {
    padding: var(--space-3) var(--space-4);
}

.location-card__header .location-card__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.location-card__header .location-card__address {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin: 0 0 var(--space-2) 0;
}

.location-card__status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.location-card__status svg {
    width: 12px;
    height: 12px;
}

.location-card__status--top-performer {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
}

.location-card__status--healthy {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.location-card__status--warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.location-card__status--growing {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

/* Card Body */
.location-card__body {
    padding: var(--space-3) var(--space-4);
}

.location-card__revenue {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.location-card__revenue-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.location-card__revenue-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.location-card__revenue-trend--up {
    color: var(--success);
}

.location-card__revenue-trend--down {
    color: var(--error);
}

/* Sparkline */
.location-card__sparkline {
    height: 25px;
    margin-bottom: var(--space-2);
}

.location-card__sparkline svg {
    width: 100%;
    height: 100%;
}

/* Metrics */
.location-card__metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
}

.location-card__metric {
    text-align: center;
}

.location-card__metric-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.location-card__metric-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Card Footer */
.location-card__footer {
    padding: var(--space-2) var(--space-4);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-subtle);
}

.location-card__cta {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    transition: color 0.2s ease;
}

.location-card:hover .location-card__cta {
    color: var(--accent-secondary);
}

/* Cross-Portfolio Insights */
.portfolio-insights {
    margin-top: var(--space-5);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
}

.portfolio-insights__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
}

.portfolio-insights__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
}

.portfolio-insight {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    transition: all 0.2s ease;
}

.portfolio-insight:hover {
    border-color: var(--border-default);
}

.portfolio-insight__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.portfolio-insight__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.portfolio-insight__icon svg {
    width: 16px;
    height: 16px;
}

.portfolio-insight--opportunity .portfolio-insight__icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.portfolio-insight--alert .portfolio-insight__icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.portfolio-insight--success .portfolio-insight__icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
}

.portfolio-insight__type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.portfolio-insight--opportunity .portfolio-insight__type {
    color: var(--success);
}

.portfolio-insight--alert .portfolio-insight__type {
    color: var(--warning);
}

.portfolio-insight--success .portfolio-insight__type {
    color: var(--accent);
}

.portfolio-insight__content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.portfolio-insight__content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1400px) {
    .portfolio-kpis {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .portfolio-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-hero {
        flex-direction: column;
        gap: var(--space-4);
    }
}

@media (max-width: 768px) {
    .portfolio-header {
        padding: var(--space-3) var(--space-4);
    }

    .portfolio-hero {
        padding: var(--space-4);
    }

    .portfolio-hero__title {
        font-size: 1.35rem;
    }

    .portfolio-kpis {
        grid-template-columns: 1fr;
        padding: 0 var(--space-4);
    }

    .portfolio-locations {
        padding: 0 var(--space-4);
    }

    .location-cards-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-insights__grid {
        grid-template-columns: 1fr;
    }

    .entrance-skip {
        bottom: var(--space-4);
        right: var(--space-4);
    }
}
