/* =========================================
   Base Layout & Colors (AIVA Vision Prototype)
   ========================================= */
:root {
    --bg-body: #0f172a;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --color-sidebar: #334155;
    --color-card: #1e293b;
    --color-chart-placeholder: #0f172a;
    --color-ai-placeholder: #475569;
    --border-color: #475569;
    --header-height: 116px;
    /* 70px Navbar + 46px Ticker */
}

/* Force Body Background & Reset */
html,
body {
    background-color: #0f172a !important;
    background-image: none !important;
    /* Reset main.css background */
    font-family: 'Inter', 'Outfit', sans-serif;
    color: var(--text-main);
    overflow-x: hidden;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
}

/* Reset main.css watermark for dashboard */
body::before {
    display: none !important;
}

* {
    box-sizing: border-box;
}

/* Header Container (Wraps Navbar + Ticker) */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Override main.css fixed navbar to flow inside header */
.navbar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100%;
}

/* Ticker Box Styles */
.ticker-box {
    width: 100%;
    height: 46px;
    background-color: #131722;
    border-bottom: 1px solid rgba(0, 128, 128, 0.3);
    overflow: hidden;
    position: relative;
    display: flex;
    z-index: 999;
}

.ticker-content-loop {
    display: flex;
    width: max-content;
    animation: force-smooth-gapless 25s linear infinite;
}

.ticker-item {
    flex-shrink: 0;
    display: flex;
    min-width: 100vw;
    pointer-events: auto !important;
}

/* Ticker Animation */
@keyframes force-smooth-gapless {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.ticker-box:hover .ticker-content-loop {
    animation-play-state: paused !important;
}

/* =========================================
   Main Layout Structure - ROBUST FIXES
   ========================================= */
.main-container {
    display: flex !important;
    flex-direction: row !important;
    /* Explicitly set Row */
    align-items: flex-start !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 1600px;
    margin: 0 auto;
    margin-top: var(--header-height);
    /* Offset for fixed header */
    min-height: calc(100vh - var(--header-height) - 100px);
    /* Adjust for footer */
    padding-top: 2rem;
}

/* Left: Content Area */
.content-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem;
    flex: 3 1 75% !important;
    /* Explicit flex 75% */
    width: 75% !important;
    min-width: 0 !important;
    padding: 1.5rem;
}

/* Right: Sidebar */
aside.sidebar {
    display: block !important;
    flex: 1 1 25% !important;
    /* Explicit flex 25% */
    width: 25% !important;
    min-width: 300px !important;
    background-color: var(--color-sidebar);
    padding: 1.5rem;
    border-left: 2px solid var(--border-color);
    position: sticky;
    top: var(--header-height);
    /* Stick below header */
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
}

.sidebar-box {
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 0.9rem;
}

/* =========================================
   Analysis Card - ROBUST FIXES
   ========================================= */
.analysis-card {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    /* Default to Row (PC) */
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    height: 500px !important;
    min-height: 500px !important;
    background: var(--color-card) !important;
    box-sizing: border-box !important;
    margin-bottom: 2rem !important;
}

.chart-placeholder {
    width: 70% !important;
    flex: 0 0 70% !important;
    min-width: 70% !important;
    background-color: var(--color-chart-placeholder) !important;
    position: relative !important;
    border-right: 1px solid var(--border-color) !important;
    height: 100% !important;
    min-height: 500px !important;
    display: block !important;
    overflow: hidden !important;
}

/* Ensure TradingView iframe fills the container */
.chart-placeholder iframe {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

.ai-panel-placeholder {
    width: 30% !important;
    flex: 0 0 30% !important;
    min-width: 30% !important;
    background-color: var(--color-ai-placeholder) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    color: #f1f5f9 !important;
    font-size: 1.2rem !important;
    padding: 1rem !important;
    position: relative !important;
    overflow: hidden !important;
    height: 100% !important;
    min-height: 500px !important;
}

/* =========================================
   Premium Lock / Mosaic Effect
   ========================================= */
.premium-blur-content {
    filter: blur(8px);
    opacity: 0.6;
    pointer-events: none;
    user-select: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1;
}

.premium-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(4px);
    background: rgba(15, 23, 42, 0.4);
}

.lock-icon-svg {
    width: 24px;
    height: 24px;
    fill: #cbd5e1;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.lock-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* =========================================
   Image Cards (Strength / Heatmap)
   ========================================= */
.analysis-card.image-card {
    height: auto !important;
    min-height: auto !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.image-card-inner {
    width: 100%;
    padding: 1.25rem 1.25rem 1.5rem;
}

.image-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.image-card-title {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #f1f5f9;
    font-size: 1.1rem;
}

.image-card-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.zoomable-image {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 0;
    cursor: zoom-in;
    overflow: hidden;
    display: block;
}

.zoomable-image:focus-visible {
    outline: 2px solid rgba(20, 184, 166, 0.7);
    outline-offset: 2px;
}

.zoomable-image img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* =========================================
   Image Modal (Full Screen)
   ========================================= */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.image-modal.is-open {
    display: block;
}

.image-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.image-modal__content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem 1.5rem;
}

.image-modal__img {
    max-width: min(1200px, 96vw);
    max-height: 86vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
    background: rgba(15, 23, 42, 0.9);
}

.image-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.image-modal__close:hover {
    border-color: rgba(20, 184, 166, 0.55);
}

.image-modal__close:focus-visible {
    outline: 2px solid rgba(20, 184, 166, 0.7);
    outline-offset: 2px;
}

/* =========================================
   Responsive Design (Mobile)
   ========================================= */
@media (max-width: 768px) {

    /* Navbar Alignment */
    .nav-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Force Vertical Stack */
    .main-container {
        flex-direction: column !important;
        padding-top: 1rem;
    }

    /* Hide Sidebar */
    aside.sidebar {
        display: none !important;
    }

    .content-area {
        width: 100% !important;
        flex: 1 1 100% !important;
        padding: 1rem;
    }

    /* Stack Card Vertically */
    .analysis-card {
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
    }

    /* Full Width for Chart */
    .chart-placeholder {
        width: 100% !important;
        height: 350px !important;
        min-height: 350px !important;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex: none !important;
    }

    /* Full Width for AI Panel */
    .ai-panel-placeholder {
        width: 100% !important;
        height: auto !important;
        min-height: 250px !important;
        flex: none !important;
    }

    .image-card-inner {
        padding: 1rem;
    }

    .image-modal__content {
        padding-top: 3.25rem;
    }

    .image-modal__img {
        max-width: 96vw;
        max-height: 82vh;
    }
}
/* ナビゲーションジャンプ位置の補正（固定ヘッダー対策） */
#strength_section, 
#heatmap_section, 
{
    scroll-margin-top: 150px !important;
}