/* Demo Page Styles */
/* Showcase grid, stats tiles, side navigator, and card styling */

/* ============================================
   Section Styles
   ============================================ */
.demo-section {
    padding: 1rem 0;
    scroll-margin-top: 100px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
}

[data-coreui-theme="light"] .section-title {
    color: rgba(0, 0, 0, 0.85);
}

.section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
    color: #818cf8;
    flex-shrink: 0;
}

.section-icon-solar {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.1));
    color: #f59e0b;
}

.section-icon-infrastructure {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(124, 58, 237, 0.1));
    color: #6366f1;
}

.section-icon-more {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.1));
    color: #60a5fa;
}

.section-icon-info {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(192, 132, 252, 0.1));
    color: #a855f7;
}

.section-subtitle {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.5rem;
}

[data-coreui-theme="light"] .section-subtitle {
    color: rgba(0, 0, 0, 0.5);
}

/* ============================================
   Stats Tiles Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

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

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Individual Stat Tile */
.stat-tile {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    min-height: 160px;
    position: relative;
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-tile:hover {
    transform: translateY(-4px);
}

/* ===== Solar Card Styles (copied from solar_dashboard.css) ===== */

/* Solar cards styling for light mode compatibility */
.solar-card-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    border-radius: 16px;
}

.solar-card-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0bb5d6 100%);
    color: #000;
    border-radius: 16px;
}

.solar-card-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    border-radius: 16px;
}

.solar-card-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #fff;
    border-radius: 16px;
}

.solar-card-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: #fff;
    border-radius: 16px;
}

/* Dark mode adjustments */
[data-coreui-theme="dark"] .solar-card-warning {
    background: linear-gradient(135deg, #ffb300 0%, #ff8f00 100%);
    color: #fff;
}

[data-coreui-theme="dark"] .solar-card-info {
    background: linear-gradient(135deg, #0bb5d6 0%, #099cbd 100%);
    color: #fff;
}

.solar-card-warning .stat-label,
.solar-card-info .stat-label {
    opacity: 0.8;
}

.solar-card-warning .small,
.solar-card-info .small {
    opacity: 0.85;
}

.solar-card-danger .small,
.solar-card-success .small {
    opacity: 0.85;
}

[data-coreui-theme="light"] .solar-card-warning .small,
[data-coreui-theme="light"] .solar-card-info .small,
[data-coreui-theme="light"] .solar-card-danger .small,
[data-coreui-theme="light"] .solar-card-success .small {
    opacity: 0.75;
    color: rgba(0, 0, 0, 0.75);
}

[data-coreui-theme="dark"] .solar-card-warning .stat-label,
[data-coreui-theme="dark"] .solar-card-info .stat-label,
[data-coreui-theme="dark"] .solar-card-warning .small,
[data-coreui-theme="dark"] .solar-card-info .small {
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== Infrastructure Card Styles ===== */
.infra-card-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    border-radius: 16px;
}

.infra-card-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0bb5d6 100%);
    color: #000;
    border-radius: 16px;
}

.infra-card-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    border-radius: 16px;
}

.infra-card-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #fff;
    border-radius: 16px;
}

/* Dark mode adjustments */
[data-coreui-theme="dark"] .infra-card-warning {
    background: linear-gradient(135deg, #ffb300 0%, #ff8f00 100%);
    color: #fff;
}

[data-coreui-theme="dark"] .infra-card-info {
    background: linear-gradient(135deg, #0bb5d6 0%, #099cbd 100%);
    color: #fff;
}

.infra-card-warning .stat-label,
.infra-card-info .stat-label {
    opacity: 0.8;
}

.infra-card-warning .small,
.infra-card-info .small {
    opacity: 0.85;
}

.infra-card-danger .small,
.infra-card-success .small {
    opacity: 0.85;
}

[data-coreui-theme="light"] .infra-card-warning .small,
[data-coreui-theme="light"] .infra-card-info .small,
[data-coreui-theme="light"] .infra-card-danger .small,
[data-coreui-theme="light"] .infra-card-success .small {
    opacity: 0.75;
    color: rgba(0, 0, 0, 0.75);
}

[data-coreui-theme="dark"] .infra-card-warning .stat-label,
[data-coreui-theme="dark"] .infra-card-info .stat-label,
[data-coreui-theme="dark"] .infra-card-warning .small,
[data-coreui-theme="dark"] .infra-card-info .small {
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== Stat Icons ===== */
.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
}

.stat-icon .icon {
    opacity: 1.0;
}

[data-coreui-theme="light"] .stat-icon .icon {
    opacity: 1.0;
}

.stat-content {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.stat-currency {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

[data-coreui-theme="light"] .stat-currency {
    color: rgba(0, 0, 0, 0.6);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
}

[data-coreui-theme="light"] .stat-value {
    color: rgba(0, 0, 0, 0.9);
}

.stat-unit {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

[data-coreui-theme="light"] .stat-unit {
    color: rgba(0, 0, 0, 0.8);
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

[data-coreui-theme="light"] .stat-label {
    color: rgba(0, 0, 0, 0.8);
}

/* Secondary Stat (e.g., saved kWh below total) */
.stat-secondary {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(245, 158, 11, 0.2);
}

[data-coreui-theme="light"] .stat-secondary {
    border-top-color: rgba(245, 158, 11, 0.15);
}

.stat-secondary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

[data-coreui-theme="light"] .stat-secondary-value {
    color: rgba(0, 0, 0, 0.8);
}

.stat-secondary-unit {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

[data-coreui-theme="light"] .stat-secondary-unit {
    color: rgba(0, 0, 0, 0.8);
}

.stat-secondary-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 0.25rem;
}

[data-coreui-theme="light"] .stat-secondary-label {
    color: rgba(0, 0, 0, 0.8);
}


/* Stats Footer */
.stats-footer {
    text-align: center;
    padding: 0.5rem 0;
}

.stats-updated {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

[data-coreui-theme="light"] .stats-updated {
    color: rgba(0, 0, 0, 0.4);
}

/* ============================================
   Price Input Styling
   ============================================ */
.stat-price-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    flex-wrap: wrap;
    position: relative;
}

[data-coreui-theme="light"] .stat-price-input {
    border-top-color: rgba(239, 68, 68, 0.15);
}

.stat-price-input label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

[data-coreui-theme="light"] .stat-price-input label {
    color: rgba(0, 0, 0, 0.7);
}

.price-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-coreui-theme="light"] .price-input-wrapper {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

.price-input-wrapper:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.price-currency {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

[data-coreui-theme="light"] .price-currency {
    color: rgba(0, 0, 0, 0.7);
}

.price-input {
    width: 60px;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 0.125rem;
}

[data-coreui-theme="light"] .price-input {
    color: rgba(0, 0, 0, 0.9);
}

.price-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

[data-coreui-theme="light"] .price-input::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.price-input.invalid {
    color: #ef4444;
}

.price-unit {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

[data-coreui-theme="light"] .price-unit {
    color: rgba(0, 0, 0, 0.65);
}

/* Price Error Balloon */
.price-error {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
}

.price-error::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ef4444;
}

.price-error.visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Showcase Grid Layout
   ============================================ */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 480px) {
    .showcase-grid {
        grid-template-columns: 1fr;
    }
}

/* Showcase Card */
.showcase-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 400px;
    border-radius: 16px;
}

/* Full Width Showcase Card */
.showcase-card-full {
    width: 100%;
}

/* Ensure showcase cards have glass effect in light theme */
[data-coreui-theme="light"] .showcase-card.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6)) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

[data-coreui-theme="light"] .showcase-card.glass-card:hover {
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}

/* Showcase Header */
.showcase-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-coreui-theme="light"] .showcase-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.showcase-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.1));
    color: #f59e0b;
    flex-shrink: 0;
}

.showcase-title-group {
    flex: 1;
}

.showcase-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: rgba(255, 255, 255, 0.95);
}

[data-coreui-theme="light"] .showcase-title {
    color: rgba(0, 0, 0, 0.9);
}

.showcase-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

[data-coreui-theme="light"] .showcase-subtitle {
    color: rgba(0, 0, 0, 0.5);
}

/* Live Badge */
.showcase-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #22c55e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-live {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Showcase Body */
.showcase-body {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

/* Chart Container */
.chart-container {
    flex: 1;
    min-height: 250px;
    position: relative;
}

.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

[data-coreui-theme="light"] .chart-error {
    color: rgba(0, 0, 0, 0.4);
}

/* Chart Legend */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

[data-coreui-theme="light"] .chart-legend {
    border-top-color: rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

[data-coreui-theme="light"] .legend-label {
    color: rgba(0, 0, 0, 0.6);
}

/* Showcase Footer */
.showcase-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
}

[data-coreui-theme="light"] .showcase-footer {
    background: rgba(0, 0, 0, 0.03);
}

.data-source {
    color: rgba(255, 255, 255, 0.5);
}

[data-coreui-theme="light"] .data-source {
    color: rgba(0, 0, 0, 0.5);
}

.last-updated {
    color: rgba(255, 255, 255, 0.4);
}

[data-coreui-theme="light"] .last-updated {
    color: rgba(0, 0, 0, 0.4);
}

/* Placeholder Card */
.showcase-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    min-height: 200px;
}

[data-coreui-theme="light"] .showcase-placeholder {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px dashed rgba(0, 0, 0, 0.15);
}

.placeholder-content {
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 1rem;
}

[data-coreui-theme="light"] .placeholder-icon {
    color: rgba(0, 0, 0, 0.15);
}

.placeholder-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
}

[data-coreui-theme="light"] .placeholder-title {
    color: rgba(0, 0, 0, 0.5);
}

.placeholder-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.6;
}

[data-coreui-theme="light"] .placeholder-text {
    color: rgba(0, 0, 0, 0.4);
}

/* ============================================
   Info Section
   ============================================ */
.info-section {
    margin-top: 1rem;
}

.info-card {
    padding: 1.5rem 2rem;
    border-radius: 16px;
}

/* Ensure info card has glass effect in light theme */
[data-coreui-theme="light"] .info-card.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6)) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.info-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}

[data-coreui-theme="light"] .info-card h4 {
    color: rgba(0, 0, 0, 0.85);
}

.info-card p {
    margin-bottom: 1rem;
}

.info-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 500;
    transition: gap 0.3s ease;
}

.info-link:hover {
    color: #c4b5fd;
    gap: 0.75rem;
}

[data-coreui-theme="light"] .info-link {
    color: #6366f1;
}

[data-coreui-theme="light"] .info-link:hover {
    color: #4338ca;
}

/* ============================================
   Sticky Side Navigator
   ============================================ */
.demo-nav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    padding: 0.5rem;
}

.demo-nav-inner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0 16px 16px 0;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    transition: width 0.3s ease, padding 0.3s ease;
    width: 56px;
    overflow: hidden;
}

[data-coreui-theme="light"] .demo-nav-inner {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

.demo-nav.expanded .demo-nav-inner {
    width: 170px;
}

.demo-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

[data-coreui-theme="light"] .demo-nav-item {
    color: rgba(0, 0, 0, 0.6);
}

.demo-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

[data-coreui-theme="light"] .demo-nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.9);
}

.demo-nav-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

[data-coreui-theme="light"] .demo-nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.demo-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.demo-nav-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.demo-nav.expanded .demo-nav-label {
    opacity: 1;
}

/* Hide nav on very small screens or show as bottom bar */
@media (max-width: 768px) {
    .demo-nav {
        display: none;
    }
}
