/* MINISTRY OF SCIENCE - CORE STANDARDS
   Structure: Root -> Common -> Components -> Mobile Overrides -> Desktop Overrides
*/

/* --- 1. ROOT & COMMON STANDARDS --- */
:root {
    /* CORE PALETTE - Updated to new RGB Defaults */
    --color-bg: #050505;       /* rgb(5, 5, 5) */
    --color-surface: #000000;  /* rgb(0, 0, 0) */
    --color-border: #191919;   /* rgb(25, 25, 25) */
    
    /* ACCENTS & HIGHLIGHTS */
    --color-amber: rgb(234, 179, 8);             /* rgb(255, 115, 0) */
    
    /* Granular Controls */
    --color-border-hover: #ffe100;      /* rgb(255, 225, 0) */
    --color-panel-title: #ff7300;       /* rgb(255, 115, 0) */
    --color-slider-highlight: #ff7300;  /* rgb(255, 115, 0) */

    /* STATUS */
    --color-emerald: #10b981; /* Success/Bugs */
    --color-blue: #3b82f6;    /* Info/Squids */
    --color-red: #ef4444;     /* Danger/Bots */
    
    /* TEXT */
    --color-text-primary: #f8fafc;
    --color-text-secondary: #94a3b8;
    
    /* DIMENSIONS */
    --site-padding: 5px;
    --radius-standard: 3px;
    --radius-sharp: 2px;
    
    /* ANIMATION */
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }

/* Typography */
.t-header { font-weight: 400; text-transform: uppercase; letter-spacing: 0.025em; line-height: 1; }
.t-subhead { font-weight: 700; color: var(--color-panel-title); text-transform: uppercase; letter-spacing: 0.05em; }
.t-body { font-size: 0.875rem; color: var(--color-text-secondary); line-height: 1.6; }

/* Formatting Utilities */
.format-b { font-weight: 800; color: white; }
.format-i { font-style: italic; color: var(--color-text-primary); }
.format-u { text-decoration: underline; text-decoration-color: var(--color-amber); text-underline-offset: 4px; }
.text-white-force { color: #ffffff !important; }

/* --- 2. COMPONENTS --- */

/* Standard Panel */
.terminal-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-standard);
    padding: 1rem;
    position: relative;
    transition: border-color 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease;
}

.terminal-card:hover {
    border-color: var(--color-border-hover);
}

/* Scrollbar Utility (Thin/Disappearing) */
.scroll-thin {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-amber) transparent;
}

.scroll-thin::-webkit-scrollbar {
    width: 2px;
}

.scroll-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-thin::-webkit-scrollbar-thumb {
    background-color: var(--color-amber);
    border-radius: 20px;
}

/* Scaling Faction Switch */
.tab-header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 0;
}

.tab-title {
    cursor: pointer;
    transition: transform 0.5s var(--ease-elastic), opacity 0.4s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-title img { width: 20px; height: 20px; transition: 0.5s var(--ease-elastic); }
.tab-title.active { transform: scale(1); opacity: 1; color: white; }
.tab-title.inactive { transform: scale(0.8); opacity: 0.4; color: var(--color-text-secondary); }

/* Hover State - Pure White Text */
.tab-title:hover {
    text-shadow: none;
    color: #ffffff;
    opacity: 1;
}

/* Fade Views */
.view-stack { display: grid; grid-template-areas: "content"; min-height: 200px; }
.fade-view {
    grid-area: content;
    transition: opacity var(--transition-smooth), transform var(--transition-smooth);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    pointer-events: none;
}
.fade-view.active { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; z-index: 10; }

/* Slider Switch */
.slider-container {
    background: rgba(0, 0, 0, 1);
    border: 1px solid var(--color-border);
    padding: 2px;
    display: inline-flex;
    position: relative;
    border-radius: var(--radius-sharp);
    overflow: hidden;
}

.slider-highlight {
    position: absolute;
    top: 2px; left: 2px; height: calc(100% - 4px);
    background: var(--color-slider-highlight);
    border-radius: 1px;
    transition: transform 0.4s var(--ease-elastic), width 0.4s var(--ease-elastic);
    z-index: 0;
}

.slider-option {
    padding: 0.25rem 1.25rem;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--color-text-secondary);
    position: relative; z-index: 10; cursor: pointer;
    transition: color 0.3s ease; line-height: 1.2;
}

.slider-option.active { color: #000; }

/* Sticky Bar */
.sticky-bar {
    position: sticky;
    top: 60px; /* Offset for main header */
    left: var(--site-padding); right: var(--site-padding);
    background: var(--color-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    padding: 10px;
    z-index: 950;
    margin-bottom: 2rem;
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.sticky-bar:hover { border-color: var(--color-border-hover); }

.sticky-bar-label {
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
    margin-right: 1rem;
    border-right: 1px solid var(--color-border);
    padding-right: 1rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* Theme Configurator */
.theme-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
}
.theme-group-title {
    font-size: 0.7rem; font-weight: 900; text-transform: uppercase; 
    color: var(--color-text-secondary); margin-bottom: 0.5rem; border-bottom: 1px solid var(--color-border);
}
.theme-input-group { display: flex; flex-direction: column; gap: 5px; }
.theme-input-group label {
    font-size: 10px; text-transform: uppercase; font-weight: 700; color: var(--color-text-secondary);
}
input[type="color"] {
    -webkit-appearance: none; border: none; width: 100%; height: 35px;
    border-radius: var(--radius-standard); cursor: pointer; padding: 0; background: none;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--color-border); border-radius: var(--radius-standard); }
input[type="range"] {
    width: 100%; accent-color: var(--color-amber);
}

/* Sub-Nav (Static) */
.sub-nav-static {
    background: #000000;
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    display: flex; gap: 2rem; justify-content: center;
    margin-bottom: 1rem;
}

.sub-link {
    background-color: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-weight: 700; text-transform: uppercase; font-size: 1rem;
    cursor: pointer; position: relative; padding-bottom: 4px;
    transition: color 0.3s ease;
}

.sub-link::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
    background-color: var(--color-amber);
    transform: scaleX(0); transform-origin: right; transition: transform 0.3s var(--ease-elastic);
}
.sub-link:hover, .sub-link.active { color: white; }
.sub-link:hover::after, .sub-link.active::after { transform: scaleX(1); transform-origin: left; }

/* Table Standards */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-standard);
}
.ministry-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    white-space: nowrap;
}
.ministry-table thead {
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
    color: var(--color-text-secondary);
}
.ministry-table th { padding: 1rem; text-align: left; font-weight: 700; letter-spacing: 0.05em; }
.ministry-table td { padding: 1rem; border-bottom: 1px solid rgba(51, 65, 85, 0.2); color: var(--color-text-primary); transition: background 0.2s; }
.ministry-table tr:last-child td { border-bottom: none; }
.ministry-table tr:hover td { background: rgba(245, 158, 11, 0.05); color: white; }
.ministry-table .cell-flex { display: flex; align-items: center; gap: 0.75rem; }
.ministry-table i { width: 16px; text-align: center; }

/* Image & Chart Modules */
.image-template {
    width: 100%; aspect-ratio: 16/9;
    background: #0f172a; border: 1px solid var(--color-border);
    border-radius: var(--radius-standard);
    overflow: hidden; position: relative;
}
.chart-module { height: 250px; width: 100%; position: relative; }

/* Standard Dropdown Component */
.custom-select-container {
    position: relative;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 3.5rem; 
    padding: 0 0.5rem;
    background-color: #000000;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-standard);
    cursor: pointer;
    transition: all 0.1s ease;
}

.custom-select-trigger:hover {
    border-color: var(--color-amber);
}

.custom-select-trigger:active {
    transform: scale(0.98);
}

.custom-select-trigger .item-name {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--color-text-primary);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 50;
    margin-top: 0.25rem;
    background-color: #000000;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-standard);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    padding: 0.5rem;
}

.custom-select-options.open {
    display: flex;
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-standard);
    transition: background-color 0.2s;
}

.custom-select-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.custom-select-option img {
    width: 2rem;
    height: 2rem;
    margin-right: 0.75rem;
    object-fit: contain;
}

.custom-select-option span {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    background-color: rgba(30, 58, 138, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    max-width: 48rem;
    width: 100%;
    color: white;
    max-height: 90vh;
    overflow-y: auto;
}

.splash-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.splash-content p.warning {
    color: #fb923c;
    text-align: center;
    font-style: italic;
    margin-bottom: 1rem;
}

.splash-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e5e7eb;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.splash-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 2rem;
}

.splash-content li {
    color: #d1d5db;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.splash-btn {
    background-color: #facc15;
    color: black;
    font-weight: 700;
    padding: 0.75rem 2.5rem;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.splash-btn:hover {
    background-color: #eab308;
    transform: scale(1.05);
}

/* Button Types */
.btn-standard {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-standard);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    transition: all 0.1s ease; /* Speed up transition for snappier clicks */
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 120px;
}

/* Global Depression Effect on Click */
.btn-standard:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}

/* Type 1: Submission / Primary (Amber - RGB 234 179 8) */
.btn-type-1 {
    background-color: rgb(234, 179, 8);
    color: #000000;
}
.btn-type-1:hover {
    filter: brightness(1.1);
    /* Removed transform: translateY(-1px) */
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

/* Type 2: Settings / Secondary (Grey) */
.btn-type-2 {
    background-color: #4b5563;
    color: #ffffff;
}
.btn-type-2:hover {
    background-color: #374151;
    /* Removed transform: translateY(-1px) */
}

/* Type 3: Tertiary / Other (Outline/Ghost) */
.btn-type-3 {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}
.btn-type-3:hover {
    border-color: var(--color-text-primary);
    color: var(--color-text-primary);
    background-color: rgba(255,255,255,0.05);
}

/* --- MEDIA QUERIES --- */
@media (max-width: 768px) {
    .t-header { font-size: 1.75rem; }
    
    /* Horizontal scroll for tabs */
    .tab-header-container { 
        flex-direction: row; 
        gap: 1rem; 
        overflow-x: auto; 
        justify-content: flex-start; 
        padding-bottom: 5px; 
        width: 100%; 
    }
    
    .tab-title {
        flex-shrink: 0;
    }
    
    /* Smaller text for mobile */
    .tab-title h2 {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .column-split { grid-template-columns: 1fr; }
    .tab-title.inactive { transform: scale(0.9); }
    .sub-nav-static { overflow-x: auto; justify-content: flex-start; }
    
    .sticky-bar { top: 0; margin-top: 0; }
    
    .sticky-bar-label { display: none; }
}

@media (min-width: 769px) {
    .t-header { font-size: 3rem; }
    .tab-header-container { gap: 4rem; }
    .tab-title img { width: 28px; height: 28px; }
    .tab-title.inactive { transform: scale(0.7); }
    .column-split { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
}