@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* CSS Variables for Material 3 Expressive Theme */
:root {
    --md-sys-color-primary: #f97316;          /* Orange-500 (Bitcoin Orange) */
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #ffedd5; /* Orange-100 */
    --md-sys-color-on-primary-container: #7c2d12; /* Orange-900 */

    --bg-primary: #f8fafc;        /* slate-50 - clean M3 background */
    --bg-secondary: #ffffff;      /* white - M3 Surface */
    --text-primary: #0f172a;      /* slate-900 - M3 On Background */
    --text-secondary: #475569;    /* slate-600 - M3 On Surface Variant */
    --border-color: #cbd5e1;      /* slate-300 - M3 Outline Variant */
    --button-bg: #e2e8f0;        /* slate-200 - M3 Surface Container */
    --button-hover-bg: #cbd5e1;  /* slate-300 - M3 Surface Container High */

    --chart-grid-color: rgba(15, 23, 42, 0.05);
    --chart-gradient-start: rgba(249, 115, 22, 0.25);
    --chart-gradient-end: rgba(249, 115, 22, 0);
    --grid-color: rgba(15, 23, 42, 0.03);
}

/* REVAMPED DARK MODE THEME */
.dark {
    --md-sys-color-primary: #fb923c;          /* Orange-400 */
    --md-sys-color-on-primary: #0f172a;
    --md-sys-color-primary-container: #431407; /* Orange-950 */
    --md-sys-color-on-primary-container: #ffddd2;

    --bg-primary: #060814;        /* Deep cyber space dark background */
    --bg-secondary: #0f172a;      /* slate-900 - M3 Surface */
    --text-primary: #f1f5f9;      /* slate-100 - M3 On Background */
    --text-secondary: #94a3b8;    /* slate-400 - M3 On Surface Variant */
    --border-color: #1e293b;      /* slate-800 - Outlines in dark mode */
    --button-bg: #1e293b;        /* slate-800 - M3 Surface Container Low */
    --button-hover-bg: #334155;  /* slate-700 - M3 Surface Container */

    --chart-grid-color: rgba(241, 245, 249, 0.08);
    --chart-gradient-start: rgba(249, 115, 22, 0.25);
    --chart-gradient-end: rgba(249, 115, 22, 0);
    --grid-color: rgba(241, 245, 249, 0.015);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.07) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(234, 179, 8, 0.04) 0px, transparent 50%),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    background-attachment: fixed;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6, .display-font {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.025em;
}

.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem; /* 24px - M3 Extra Large shape */
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05); /* Subtle M3-style shadow */
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
    border-color: var(--md-sys-color-primary);
}
.dark .card {
    box-shadow: none;
}
.dark .card:hover {
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.3);
}
.live-dot {
    width: 10px; height: 10px; border-radius: 50%;
    transition: background-color 0.3s ease;
    background-color: #6b7280; /* Grey for disconnected */
}
.live-dot.connected {
    background-color: #ef4444; /* Red-500 for connected */
    animation: pulse 2s infinite;
}
.live-dot.flash { background-color: #4ade80; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.price-up { color: #4ade80; } /* green-400 */
.price-down { color: #f87171; } /* red-400 */

.transaction-item:hover, .block-item:hover { background-color: var(--button-hover-bg); }

.time-range-btn {
    background-color: var(--button-bg); color: var(--text-primary);
    transition: background-color 0.2s, color 0.2s;
}
.time-range-btn:hover { background-color: var(--button-hover-bg); }
.time-range-btn.active { background-color: #f97316; color: #ffffff; }

/* Article specific styles */
.prose {
    max-width: 80ch;
}
.prose h2 {
    font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; margin-top: 2.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem;
}
.prose h3 {
    font-size: 1.5rem; line-height: 2rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem;
}
.prose p, .prose li, .prose dd {
    font-size: 1rem; line-height: 1.75; margin-bottom: 1.25rem; color: var(--text-secondary);
}
.prose dt {
    font-weight: 600;
    color: var(--text-primary);
}
.dark .prose p, .dark .prose li, .dark .prose dd {
     color: var(--text-secondary);
}
.prose a {
    color: #f97316; text-decoration: none; border-bottom: 2px solid #fdba74; transition: all 0.2s;
}
.prose a:hover {
    background-color: #fdba74;
    color: #000;
}
.prose strong {
    color: var(--text-primary);
}
.prose figure {
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.prose figcaption {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.5rem;
}
.prose blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    font-style: italic;
    color: var(--text-secondary);
}
/* Material 3 Expressive Article Cards */
.article-card {
    display: block;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 1.5rem; /* 24px - M3 Extra Large shape */
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 1.5rem;
    background-color: var(--bg-secondary);
}
.article-card:hover {
    border-color: var(--md-sys-color-primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}
.dark .article-card:hover {
    box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.3);
}
.article-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.article-card p {
    margin-bottom: 0;
    color: var(--text-secondary);
}

/* Custom Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-block;
}
.tooltip-text {
    visibility: hidden;
    width: 180px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.75rem;
    line-height: 1rem;
    border-radius: 0.5rem; /* 8px */
    padding: 0.5rem; /* 8px */
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    margin-left: -90px; /* Half of width */
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Navigation styles */
.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}
.nav-link.active {
    background-color: var(--button-bg);
    font-weight: 600;
}
.nav-link:not(.active):hover {
    background-color: var(--button-hover-bg);
}
mark {
    background-color: #fef08a; /* yellow-200 */
    color: black;
    padding: 2px 1px;
    border-radius: 3px;
}
.dark mark {
    background-color: #facc15; /* yellow-400 */
}

/* --- Timeline Styles --- */
.timeline-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}
.timeline-container::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: var(--border-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
}
.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.timeline-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.timeline-item::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: var(--bg-primary);
    border: 4px solid #f97316;
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}
.timeline-left {
    left: 0;
}
.timeline-right {
    left: 50%;
}
.timeline-left::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    right: 30px;
    border: medium solid var(--border-color);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent var(--border-color);
}
.timeline-right::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    left: 30px;
    border: medium solid var(--border-color);
    border-width: 10px 10px 10px 0;
    border-color: transparent var(--border-color) transparent transparent;
}
.timeline-right::after {
    left: -16px;
}
.timeline-content {
    padding: 20px 30px;
    background-color: var(--bg-secondary);
    position: relative;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}
.timeline-content:hover {
    transform: scale(1.03);
}
.timeline-content h3 {
    margin-top: 0;
}
.timeline-content p {
    margin-bottom: 0;
}
/* Responsive timeline */
@media screen and (max-width: 768px) {
    .timeline-container::after {
        left: 31px;
    }
    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }
    .timeline-item::before {
        left: 60px;
        border: medium solid var(--border-color);
        border-width: 10px 10px 10px 0;
        border-color: transparent var(--border-color) transparent transparent;
    }
    .timeline-left::after, .timeline-right::after {
        left: 15px;
    }
    .timeline-right {
        left: 0%;
    }
}

/* --- Particle Background canvas hidden --- */
#particle-background {
    display: none;
}

/* --- SKELETON LOADER ANIMATIONS --- */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: var(--button-bg);
    border-radius: 0.5rem;
    opacity: 0.65;
}
.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 20%,
        rgba(255, 255, 255, 0.3) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 1.6s infinite;
}
.dark .skeleton::after {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 20%,
        rgba(255, 255, 255, 0.1) 60%,
        rgba(255, 255, 255, 0) 100%
    );
}
@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}
.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
    border-radius: 0.25rem;
}
.skeleton-title {
    height: 1.5rem;
    margin-bottom: 0.75rem;
    width: 60%;
    border-radius: 0.25rem;
}
.skeleton-chart {
    height: 100%;
    width: 100%;
    border-radius: 0.5rem;
}

/* --- TAB SYSTEM --- */
.dashboard-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
}
.dashboard-tab-btn:hover {
    background-color: var(--button-bg);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.dashboard-tab-btn.active {
    background-color: var(--md-sys-color-primary);
    color: #ffffff;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* --- PREMIUM GLASSMORPHISM --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
}
.dark .glass-panel {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- DCA CALCULATOR --- */
.dca-result-card {
    background-color: var(--button-bg);
    border-radius: 1rem;
    padding: 1rem;
    border-left: 4px solid var(--md-sys-color-primary);
    transition: all 0.3s ease;
}

/* --- INTERACTIVE HALVING TIMELINE --- */
.halving-milestone {
    border-left: 3px dashed var(--border-color);
    padding-left: 1.5rem;
    position: relative;
    padding-bottom: 2rem;
    transition: all 0.3s ease;
}
.halving-milestone:last-child {
    padding-bottom: 0;
    border-left: none;
}
.halving-milestone::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 4px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 3px solid var(--md-sys-color-primary);
    transition: all 0.3s ease;
}
.halving-milestone.active::before {
    background: var(--md-sys-color-primary);
    box-shadow: 0 0 0 4px var(--md-sys-color-primary-container);
}
.timeline-pill {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    background-color: var(--button-bg);
    color: var(--text-secondary);
}
.halving-milestone.active .timeline-pill {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* ==========================================
   NEW PREMIUM REDESIGN AND FEATURE OVERHAUL
   ========================================== */

/* Bento Grid Layout styling */
.bento-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    .bento-col-3 { grid-column: span 3 / span 3; }
    .bento-col-4 { grid-column: span 4 / span 4; }
    .bento-col-5 { grid-column: span 5 / span 5; }
    .bento-col-6 { grid-column: span 6 / span 6; }
    .bento-col-7 { grid-column: span 7 / span 7; }
    .bento-col-8 { grid-column: span 8 / span 8; }
    .bento-col-9 { grid-column: span 9 / span 9; }
    .bento-col-12 { grid-column: span 12 / span 12; }
}

/* Glassmorphism card borders glowing effect */
.glass-panel {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 1.75rem;
    box-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.04);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .glass-panel {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
}
.glass-panel:hover {
    border-color: rgba(249, 115, 22, 0.35);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px 0 rgba(249, 115, 22, 0.08);
}

/* Animated sliding theme toggle */
.theme-toggle-btn {
    position: relative;
    display: inline-flex;
    height: 2.25rem;
    width: 4rem;
    align-items: center;
    border-radius: 9999px;
    background-color: var(--button-bg);
    border: 1px solid var(--border-color);
    padding: 0 0.25rem;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.theme-toggle-btn:hover {
    background-color: var(--button-hover-bg);
}
.theme-toggle-knob {
    display: flex;
    height: 1.75rem;
    width: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}
.dark .theme-toggle-knob {
    transform: translateX(1.75rem);
    background-color: #0f172a;
}
.theme-toggle-icon {
    width: 1.05rem;
    height: 1.05rem;
    transition: opacity 0.2s ease;
}
.theme-toggle-icon.sun {
    color: #f97316;
}
.theme-toggle-icon.moon {
    color: #fb923c;
}

/* Ticker Tape Scroller */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    height: 2.75rem;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
.dark .ticker-wrap {
    background-color: rgba(15, 23, 42, 0.5);
}
.ticker {
    display: inline-flex;
    white-space: nowrap;
    animation: ticker 45s linear infinite;
}
.ticker:hover {
    animation-play-state: paused;
}
.ticker-item {
    display: inline-flex;
    align-items: center;
    padding: 0 2.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}
.ticker-item:last-child {
    border-right: none;
}
.ticker-val {
    margin-left: 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-33.33%, 0, 0);
    }
}

/* Circular Radial Progress Gauge */
.progress-ring {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.progress-ring-circle {
    transition: stroke-dashoffset 0.5s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* Saylor Quote Styles */
.quote-card {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.quote-text {
    font-size: 1.15rem;
    line-height: 1.6;
    font-weight: 500;
    font-style: italic;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}
.quote-author {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--md-sys-color-primary);
    margin-top: 1rem;
    transition: opacity 0.3s ease;
}

/* Custom range slider track and thumb */
.slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 9999px;
    background: var(--button-bg);
    outline: none;
    transition: background 0.3s;
}
.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
    transition: transform 0.1s;
}
.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.slider-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
    transition: transform 0.1s;
}
.slider-input::-moz-range-thumb:hover {
    transform: scale(1.2);
}

