/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (Day Mode Only)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Premium Academic Slate & Blue */
    --bg-main: #f8fafc;        /* Slate 50 (Very light grey for main background) */
    --bg-card: #ffffff;        /* Pure White for cards and containers */
    --bg-tertiary: #f1f5f9;    /* Slate 100 for sub-panels and headers */
    --border-color: #e2e8f0;   /* Slate 200 for clean structural lines */
    
    /* Typography Colors - Strict Contrast (WCAG AA Compliance) */
    --text-primary: #0f172a;   /* Slate 900 (Deep charcoal for high contrast headers and body) */
    --text-secondary: #334155; /* Slate 700 (Medium dark grey for secondary descriptions) */
    --text-muted: #57606a;     /* Slate 600 (Accessible dark grey for labels) */
    
    /* Branding & Interactive Accents */
    --primary: #1e40af;        /* Dark Blue for primary actions/academic headers */
    --primary-hover: #1e3a8a;
    --primary-light: #eff6ff;  /* Light Blue tint for backgrounds */
    --accent: #2563eb;         /* Bright Royal Blue */
    
    /* Material Specific Accents */
    --steel-color: #475569;    /* Slate 600 - Representing raw steel */
    --steel-bg: #f1f5f9;
    --aluminum-color: #0369a1; /* Sky 700 - Representing aerospace aluminum */
    --aluminum-bg: #f0f9ff;
    --bronze-color: #b45309;   /* Amber 700 - Representing bronze */
    --bronze-bg: #fef3c7;
    
    /* Status Colors */
    --success: #15803d;        /* Green 700 */
    --success-bg: #f0fdf4;
    --info: #0369a1;           /* Sky 700 */
    --info-bg: #f0f9ff;
    --neutral-badge: #64748b;
    --neutral-badge-bg: #f1f5f9;
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-premium: 0 25px 50px -12px rgba(15, 23, 42, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    padding: 2rem 1.5rem;
}

/* Headings font */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Container */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Academic Header / Cover Banner */
.academic-header {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: center;
}

@media (min-width: 768px) {
    .academic-header {
        grid-template-columns: auto 1fr;
        gap: 2rem;
    }
}

.academic-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}

.logo-unad-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 160px;
    width: 100%;
    height: auto;
}

.logo-unad-wrapper img {
    width: 100%;
    height: auto;
    max-height: 110px;
    object-fit: contain;
}

.cover-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.institution {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.institution svg {
    width: 16px;
    height: 16px;
}

.title-area h1 {
    font-size: 2rem;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.title-area p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 400;
    max-width: 850px;
    margin-bottom: 0.75rem;
}

/* Student Metadata Grid */
.student-meta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .student-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .student-meta-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.meta-field {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: transform var(--transition-fast);
}

.meta-field:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.meta-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   LAYOUT GRID
   ========================================================================== */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: start;
    }
}

/* Cards styling */
.card-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-tertiary);
}

.card-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h2 svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: var(--radius-sm);
    gap: 2px;
}

.tab-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Card Body */
.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ==========================================================================
   DIAGRAM VISUALIZER
   ========================================================================== */
.visualizer-container {
    position: relative;
    width: 100%;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #ffffff 0%, #f1f5f9 100%);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
    overflow: hidden;
    padding: 1rem;
}

/* Real Wrench Image Container */
.real-image-container {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.real-image-container img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

/* Interactive Wrench SVG Styling */
.wrench-svg {
    width: 100%;
    max-height: 280px;
    height: auto;
}

/* Wrench SVG Parts */
.interactive-part {
    cursor: pointer;
    transition: filter var(--transition-normal), opacity var(--transition-normal), fill var(--transition-normal);
}

.interactive-part:hover {
    filter: brightness(1.05) drop-shadow(0px 0px 8px rgba(37, 99, 235, 0.4));
}

.interactive-part.selected {
    filter: brightness(1.1) drop-shadow(0px 0px 12px rgba(37, 99, 235, 0.6));
    stroke: var(--accent);
    stroke-width: 1.5px;
}

.non-interactive-part {
    transition: opacity var(--transition-normal);
}

/* Dimming parts that are not selected */
.wrench-svg.has-selection .interactive-part:not(.selected) {
    opacity: 0.55;
}

.wrench-svg.has-selection .non-interactive-part {
    opacity: 0.35;
}

/* Schematic callout elements */
.schematic-callout {
    cursor: pointer;
}

.schematic-callout circle {
    fill: #ffffff;
    stroke: var(--text-muted);
    stroke-width: 2px;
    transition: var(--transition-normal);
}

.schematic-callout text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 11px;
    fill: var(--text-primary);
    text-anchor: middle;
    dominant-baseline: central;
}

.schematic-callout.active circle {
    fill: var(--accent);
    stroke: var(--accent);
}

.schematic-callout.active text {
    fill: #ffffff;
}

.schematic-callout:hover circle {
    stroke: var(--accent);
    transform: scale(1.1);
    transform-origin: center;
}

/* Visualizer instructions */
.instruction-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1rem;
}

.instruction-banner svg {
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

/* ==========================================================================
   COMPONENT SELECTOR / LIST
   ========================================================================== */
.component-selector-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.component-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition-normal);
    user-select: none;
}

.component-item:hover {
    border-color: var(--accent);
    background-color: var(--primary-light);
    transform: translateX(4px);
}

.component-item.active {
    border-color: var(--accent);
    background-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.component-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.component-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition-normal);
}

.component-item.active .component-number {
    background-color: var(--accent);
    color: #ffffff;
}

.component-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-proposal {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.badge-no-change {
    background-color: var(--neutral-badge-bg);
    color: var(--neutral-badge);
    border: 1px solid #cbd5e1;
}

/* ==========================================================================
   COMPARISON DYNAMIC PANEL
   ========================================================================== */
.comparison-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 380px;
}

.panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    height: 100%;
}

.placeholder-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

/* Panel Header */
.panel-selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.panel-title h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.panel-title p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Compare Cards Container */
.compare-cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .compare-cards-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Material Card */
.material-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    background-color: var(--bg-card);
    position: relative;
    transition: transform var(--transition-normal);
}

.material-card:hover {
    transform: translateY(-2px);
}

.material-card-header {
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.material-card.current .material-card-header {
    background-color: var(--steel-bg);
    color: var(--steel-color);
    border-bottom: 1px solid var(--border-color);
}

.material-card.proposed .material-card-header {
    background-color: var(--primary-light);
    color: var(--accent);
    border-bottom: 1px solid #bfdbfe;
}

/* Special Proposed Background based on Material Type */
.material-card.proposed.aluminum .material-card-header {
    background-color: var(--aluminum-bg);
    color: var(--aluminum-color);
    border-bottom: 1px solid #bae6fd;
}

.material-card.proposed.bronze .material-card-header {
    background-color: var(--bronze-bg);
    color: var(--bronze-color);
    border-bottom: 1px solid #fde68a;
}

.material-card-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.material-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Specs List */
.specs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--text-muted);
    font-weight: 500;
}

.spec-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Dynamic Charts / Progress Comparison */
.comparison-metrics {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.metric-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric-bar-group:last-child {
    margin-bottom: 0;
}

.metric-name-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-progress-wrapper {
    height: 10px;
    background-color: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.metric-progress-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Technical Justification Box (Strict Light Mode Legibility) */
.justification-box {
    background-color: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.justification-box.aluminum-theme {
    background-color: var(--aluminum-bg);
    border-color: #bae6fd;
    border-left-color: var(--aluminum-color);
}

.justification-box.bronze-theme {
    background-color: var(--bronze-bg);
    border-color: #fde68a;
    border-left-color: var(--bronze-color);
}

.justification-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.justification-text {
    font-size: 0.95rem;
    /* High contrast, high legibility text as per user strict requirements */
    color: #0f172a; 
    line-height: 1.6;
    font-weight: 500;
}

/* Static Component Info (For Component 2 & 4) */
.static-info-box {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.static-info-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.static-info-body {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.static-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Footer style */
.academic-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   CONCLUSION SECTION
   ========================================================================== */
.conclusion-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-top: 1.5rem;
    position: relative;
    overflow: hidden;
}

.conclusion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--success), var(--accent));
}

.conclusion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.conclusion-header h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conclusion-header h2 svg {
    color: var(--success);
    width: 24px;
    height: 24px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.result-item {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform var(--transition-normal);
}

.result-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.result-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--success-bg);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.result-item.weight-reduction .result-icon {
    background-color: var(--aluminum-bg);
    color: var(--aluminum-color);
}

.result-item.tribology .result-icon {
    background-color: var(--bronze-bg);
    color: var(--bronze-color);
}

.result-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.result-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
