/* ==========================================================================
   FILE: 3_Source_Code/decyphr/report_builder/assets/styles/main_theme.css
   PURPOSE: The complete high-end design system for the Decyphr HTML report.
   VERSION: 6.0 (Custom "Monochrome" Theme)
   ========================================================================== */

/* ==========================================================================
   1. DESIGN SYSTEM & THEME DEFINITIONS (CSS VARIABLES)
   ========================================================================== */
:root {
    /* Typography */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* --- NEW "Monochrome" Light Theme --- */
    --bg-light: #f5f5f5;                      /* Off-white background */
    --header-bg-light: rgba(255, 255, 255, 0.85); /* Semi-transparent white */
    --card-bg-light: #ffffff;                 /* Pure white cards */
    --details-bg-light: #ffffff;              /* Pure white details */
    --text-primary-light: #000000;             /* Pure black text */
    --text-secondary-light: #525252;           /* Dark grey secondary text */
    --border-light: #e5e5e5;                  /* Light grey border */
    --accent-primary-light: #000000;           /* Black for hover text */
    --accent-secondary-light: #e5e5e5;         /* Light grey for hover backgrounds */
    --glow-color-light: rgba(0, 0, 0, 0.2);
    --highlight-active-light: #000000;         /* Black for active tab background */
    --highlight-text-light: #ffffff;          /* White for active tab text */


    /* --- NEW "Monochrome" Dark Theme --- */
    --bg-dark: #000000;                      /* Pure black background */
    --header-bg-dark: rgba(10, 10, 10, 0.75); /* Semi-transparent near-black */
    --card-bg-dark: #111111;                 /* Very dark grey cards */
    --details-bg-dark: #111111;              /* Very dark grey details */
    --text-primary-dark: #ffffff;             /* Pure white text */
    --text-secondary-dark: #a3a3a3;           /* Light grey secondary text */
    --border-dark: #262626;                  /* Medium-dark grey border */
    --accent-primary-dark: #ffffff;           /* White for hover text */
    --accent-secondary-dark: #1f1f1f;         /* Dark grey for hover backgrounds */
    --glow-color-dark: rgba(255, 255, 255, 0.3);
    --highlight-active-dark: #ffffff;         /* White for active tab background */
    --highlight-text-dark: #000000;          /* Black for active tab text */
}

.js-plotly-plot .plotly {
    background-color: transparent !important;
}

/* ==========================================================================
   2. THEME APPLICATION & GLOBAL RESET
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body[data-theme="light"] {
    --bg-color: var(--bg-light);
    --header-bg-color: var(--header-bg-light);
    --card-bg-color: var(--card-bg-light);
    --details-bg-color: var(--details-bg-light);
    --text-primary-color: var(--text-primary-light);
    --text-secondary-color: var(--text-secondary-light);
    --border-color: var(--border-light);
    --accent-primary: var(--accent-primary-light);
    --accent-secondary: var(--accent-secondary-light);
    --glow-color: var(--glow-color-light);
    --highlight-active: var(--highlight-active-light);
    --highlight-text: var(--highlight-text-light);
}

body[data-theme="dark"] {
    --bg-color: var(--bg-dark);
    --header-bg-color: var(--header-bg-dark);
    --card-bg-color: var(--card-bg-dark);
    --details-bg-color: var(--details-bg-dark);
    --text-primary-color: var(--text-primary-dark);
    --text-secondary-color: var(--text-secondary-dark);
    --border-color: var(--border-dark);
    --accent-primary: var(--accent-primary-dark);
    --accent-secondary: var(--accent-secondary-dark);
    --glow-color: var(--glow-color-dark);
    --highlight-active: var(--highlight-active-dark);
    --highlight-text: var(--highlight-text-dark);
}

/* ==========================================================================
   3. FIXED APPLICATION HEADER & NAVIGATION (UPDATED COLORS)
   ========================================================================== */
.app-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: 72px;
    background-color: var(--header-bg-color);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    max-width: 1800px;
    height: 100%;
    margin: 0 auto;
    padding: 0 .75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left { display: flex; align-items: center; gap: 2.5rem; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 1.5rem; flex-shrink: 0; }

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary-color);
    letter-spacing: -1px;
    transition: all 0.3s ease;
    cursor: default;
}
.logo-text:hover {
    color: var(--text-primary-color);
    text-shadow: 0 0 15px var(--glow-color), 0 0 25px var(--glow-color);
}

.top-nav { flex-grow: 1; }
.top-nav ul { list-style: none; display: flex; justify-content: center; gap: 0.5rem; }
.top-nav li a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    border-radius: 0.5rem;
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap; 
}
.top-nav li a:hover {
    color: var(--text-primary-color);
    background-color: var(--accent-secondary);
}
.top-nav li a.active {
    color: var(--highlight-text);
    background-color: var(--highlight-active);
    box-shadow: 0 0 20px var(--glow-color);
}

/* ==========================================================================
   4. STYLED FORMS & BUTTONS (UPDATED COLORS)
   ========================================================================== */
.variable-explorer label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary-color); }
.variable-explorer select {
    background-color: var(--card-bg-color);
    color: var(--text-primary-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a3a3a3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    transition: all 0.2s ease;
}
.variable-explorer select:hover { border-color: var(--text-secondary-color); }

.theme-toggle-button {
    background: none; border: 1px solid var(--border-color); border-radius: 50%;
    cursor: pointer; width: 32px; height: 32px; display: flex;
    justify-content: center; align-items: center; padding: 0; position: relative;
    overflow: hidden; color: var(--text-secondary-color);
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.theme-toggle-button:hover { color: var(--text-primary-color); background-color: var(--accent-secondary); }
.theme-toggle-button .icon-sun, .theme-toggle-button .icon-moon {
    position: absolute; width: 20px; height: 20px;
    transition: transform 0.4s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    background-repeat: no-repeat; background-position: center;
    background-image: var(--icon-url);
}
.icon-sun { --icon-url: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='5'%3e%3c/circle%3e%3cline x1='12' y1='1' x2='12' y2='3'%3e%3c/line%3e%3cline x1='12' y1='21' x2='12' y2='23'%3e%3c/line%3e%3cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'%3e%3c/line%3e%3cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'%3e%3c/line%3e%3cline x1='1' y1='12' x2='3' y2='12'%3e%3c/line%3e%3cline x1='21' y1='12' x2='23' y2='12'%3e%3c/line%3e%3cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'%3e%3c/line%3e%3cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'%3e%3c/line%3e%3c/svg%3e"); }
.icon-moon { --icon-url: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3e%3c/path%3e%3c/svg%3e"); }

body[data-theme='light'] .icon-sun { transform: rotate(0) scale(1); }
body[data-theme='light'] .icon-moon { transform: rotate(90deg) scale(0); }
body[data-theme='dark'] .icon-sun { transform: rotate(-90deg) scale(0); }
body[data-theme='dark'] .icon-moon { transform: rotate(0) scale(1); }
/* ==========================================================================
   5. MAIN CONTENT AREA & CARDS
   ========================================================================== */
.main-content { padding: 96px 3rem 3rem 3rem; max-width: 1800px; margin: 0 auto; }
.report-header { text-align: center; margin-bottom: 3rem; }
.report-header h2 { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.5px; }
.report-header p { color: var(--text-secondary-color); font-size: 1.125rem; }

.content-panel { display: none; }
.content-panel.active { display: block; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-title {
    font-size: 1.75rem;
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.details-container {
    background-color: var(--details-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
}
.details-container p, .details-container li { line-height: 1.6; color: var(--text-secondary-color); }
.details-container ul { padding-left: 1.5rem; margin-top: 1rem; }
.details-container code { background-color: var(--bg-color); padding: 0.2rem 0.4rem; border-radius: 0.25rem; font-family: monospace; }
.details-table { width: 100%; border-collapse: collapse; }
.details-table th, .details-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.details-table th { font-weight: 600; color: var(--text-primary-color); }

.details-grid, .details-grid-univariate {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 2rem;
}

.analysis-card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}
.analysis-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.analysis-card .js-plotly-plot { width: 100% !important; height: 100% !important; }

/* ==========================================================================
   6. MODAL & FOOTER
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.7); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 2000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }
.modal-card {
    background-color: var(--bg-color); border-radius: 1rem; padding: 2rem;
    width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto;
    position: relative; transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal-card { transform: scale(1); }
.modal-close-button {
    position: absolute; top: 1rem; right: 1rem; background: none; border: none;
    font-size: 2rem; color: var(--text-secondary-color); cursor: pointer;
}

.app-footer { text-align: center; padding: 2rem; color: var(--text-secondary-color); font-size: 0.875rem; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary-color); }