/* CSS Design System for 7 QC Tools Sequential Diagnostic Suite */
:root {
    --primary: #1A3A5C;
    --primary-light: #2A5683;
    --secondary: #607D8B;
    --accent: #E65100;
    --accent-light: #FFF3E0;
    --success: #2E7D32;
    --success-light: #E8F5E9;
    --info: #0277BD;
    --info-light: #E1F5FE;
    --warning: #F57F17;
    --warning-light: #FFFDE7;
    --danger: #C62828;
    --danger-light: #FFEBEE;
    --dark: #263238;
    --light: #F4F6F9;
    --white: #FFFFFF;
    --border: #CFD8DC;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    font-weight: 600;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: var(--primary);
    color: var(--white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--accent);
    box-shadow: var(--shadow);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo i {
    font-size: 2.2rem;
    color: #80DEEA;
}

.logo-text h1 {
    font-size: 1.5rem;
    color: var(--white);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.85rem;
    color: #B2DFDB;
    font-weight: 500;
}

/* Sidebar & Display Grid */
.app-workspace {
    display: flex;
    flex: 1;
}

.app-sidebar {
    width: 280px;
    background-color: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pipeline-heading {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary);
    letter-spacing: 1.5px;
    padding-left: 10px;
}

.pipeline-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-step {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--dark);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-step:hover {
    background-color: var(--light);
    color: var(--primary);
}

.nav-step.active {
    background-color: #E3F2FD;
    color: var(--primary);
    border-color: #90CAF9;
    font-weight: 600;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background-color: var(--light);
    border-radius: 50%;
    margin-right: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--secondary);
}

.nav-step.active .step-num {
    background-color: var(--primary);
    color: var(--white);
}

.step-label {
    flex: 1;
}

.step-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--light);
    color: var(--secondary);
    margin-right: 5px;
}

.nav-step.active .step-tag {
    background-color: var(--primary-light);
    color: var(--white);
}

.step-chevron {
    font-size: 0.8rem;
    opacity: 0.5;
}

.sidebar-info-card {
    background-color: #E1F5FE;
    border-left: 4px solid var(--info);
    padding: 15px;
    border-radius: var(--radius);
    margin-top: auto;
}

.sidebar-info-card .card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--info);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-info-card p {
    font-size: 0.82rem;
    color: #01579B;
    line-height: 1.4;
}

/* Display Window */
.app-display {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-width: 1400px;
}

.display-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.display-section.active {
    display: block;
}

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

/* Section Hero */
.section-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

.section-hero h2 {
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 10px;
    font-family: 'Outfit', sans-serif;
}

.section-hero p {
    font-size: 1.05rem;
    color: #CFD8DC;
    max-width: 900px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.section-title h2 {
    font-size: 1.8rem;
    font-family: 'Outfit', sans-serif;
}

/* Case Study Guide Panel */
.case-study-guide-panel {
    background-color: var(--white);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 25px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.guide-header {
    background-color: var(--primary-light);
    color: var(--white);
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guide-header h3 {
    color: var(--white);
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-body {
    padding: 20px;
    background-color: #F8F9FA;
    border-top: 1px solid var(--border);
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.4s ease;
}

.guide-body.collapsed {
    max-height: 0;
    padding: 0;
    border: none;
}

.step-by-step-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.guide-step {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-left: 3.5px solid var(--accent);
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #37474F;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* COPQ Iceberg Visual Layout */
.iceberg-visual-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background-color: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

#copq-iceberg-svg {
    border-radius: 6px;
    overflow: hidden;
}

/* Info Trigger Button */
.info-btn {
    margin-left: 6px;
    cursor: pointer;
    color: var(--secondary);
    transition: var(--transition);
    font-size: 0.92rem;
}

.info-btn:hover {
    color: var(--accent);
}

/* Guidance Contextual Modal Overlay */
.info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(26, 58, 92, 0.4);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.info-modal-content {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    width: 90%;
    max-width: 580px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--primary-light);
    animation: modalSlideUp 0.3s ease;
    position: relative;
}

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

.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.info-modal-header h3 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary);
    transition: var(--transition);
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--danger);
}

.info-modal-body {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 10px;
}

.info-modal-body::-webkit-scrollbar {
    width: 6px;
}
.info-modal-body::-webkit-scrollbar-track {
    background: #F1F1F1;
    border-radius: 4px;
}
.info-modal-body::-webkit-scrollbar-thumb {
    background: #C1C1C1;
    border-radius: 4px;
}
.info-modal-body::-webkit-scrollbar-thumb:hover {
    background: #A1A1A1;
}

.info-modal-body p {
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 15px;
    line-height: 1.5;
}

.info-modal-body h4 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 6px;
    margin-top: 15px;
}

.info-modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #37474F;
}

.info-modal-body li {
    margin-bottom: 5px;
}

/* Cards & Grid Layouts */
.grid {
    display: grid;
    gap: 25px;
    margin-bottom: 25px;
}

.grid-2col {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

.grid-2col-heavy-left {
    grid-template-columns: 2fr 1.2fr;
}

@media (max-width: 1024px) {
    .grid-2col-heavy-left, .grid-2col {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h3 {
    padding: 15px 20px;
    background-color: #F8F9FA;
    border-bottom: 1px solid var(--border);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header-highlight {
    background: linear-gradient(90deg, #E3F2FD 0%, #FFFFFF 100%);
    border-bottom: 2px solid #90CAF9;
}

.card-header-highlight h3 {
    background: transparent;
    border: none;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* UI Elements */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 50px;
    letter-spacing: 0.5px;
}

.badge-blue { background-color: var(--info-light); color: var(--info); }
.badge-purple { background-color: #EDE7F6; color: #5E35B1; }
.badge-red { background-color: var(--danger-light); color: var(--danger); }
.badge-teal { background-color: #E0F2F1; color: #00796B; }
.badge-orange { background-color: var(--accent-light); color: var(--accent); }

blockquote.course-quote {
    background-color: #ECEFF1;
    border-left: 4px solid var(--secondary);
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 25px;
    font-style: italic;
    font-size: 0.95rem;
    color: #37474F;
}

.help-text {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: 4px;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #D84315;
}

.btn-secondary {
    background-color: var(--primary-light);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--primary);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background-color: #1B5E20;
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #8E1C19;
}

/* Form Inputs */
.form-group {
    margin-bottom: 15px;
}

.form-group-inline {
    display: flex;
    gap: 10px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.select-inline {
    width: 200px;
}

.input-inline {
    flex: 1;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

.data-table th, .data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #ECEFF1;
    font-weight: 600;
    color: var(--primary);
}

.data-table tbody tr:hover {
    background-color: #F8F9FA;
}

.select-table tbody tr {
    cursor: pointer;
}

.select-table tbody tr.active-row {
    background-color: #E3F2FD;
    border-left: 4px solid var(--info);
}

.text-center {
    text-align: center;
}

/* Diagnostic Box */
.diagnosis-box {
    margin-top: 25px;
    background-color: var(--info-light);
    border: 1px solid #90CAF9;
    border-radius: var(--radius);
    padding: 20px;
}

.diagnosis-box h4 {
    color: var(--info);
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 1px solid #90CAF9;
    padding-bottom: 8px;
}

.diag-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.diag-col h5 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.diag-col p {
    font-size: 0.88rem;
    color: #263238;
}

.diag-case-study {
    background-color: var(--white);
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.88rem;
    border-left: 4px solid var(--primary);
}

.diag-btn-container {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Results Alerts */
.pareto-verdict, .capability-verdict, .correlation-verdict, .stability-verdict, .flow-verdict {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--radius);
    background-color: var(--accent-light);
    border: 1px solid #FFE0B2;
}

.pareto-verdict h4 {
    color: var(--accent);
    margin-bottom: 5px;
    font-size: 1rem;
}

.pareto-verdict p {
    font-size: 0.9rem;
    color: #E65100;
}

.hidden {
    display: none !important;
}

/* Fishbone SVG Visualization */
.fishbone-viz-card {
    background-color: #1C2B3E;
    border-color: #0F1A26;
}

.fishbone-viz-card h3 {
    background-color: #132030;
    color: #CFD8DC;
    border-bottom: 1px solid #0F1A26;
}

.fishbone-container {
    background-color: #101B2B;
    border-radius: 6px;
    padding: 20px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
    height: 400px;
}

.fishbone-spine {
    stroke: #ECEFF1;
    stroke-width: 4px;
}

.fishbone-bone {
    stroke: #90A4AE;
    stroke-width: 2px;
}

.fishbone-head-poly {
    fill: #E65100;
}

.fishbone-head-box {
    fill: #1A3A5C;
    stroke: #FFF;
    stroke-width: 2px;
}

.fishbone-head-text {
    fill: #FFF;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
}

.fishbone-head-sub {
    fill: #80DEEA;
    font-size: 11px;
    font-weight: 500;
}

.fishbone-label {
    fill: #CFD8DC;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: bold;
}

.fishbone-cause-text {
    fill: #81D4FA;
    font-size: 10px;
    font-weight: 500;
}

.fishbone-sub-bone {
    stroke: #37474F;
    stroke-width: 1.5px;
    stroke-dasharray: 2, 2;
}

/* 5-Why inputs */
.why-row {
    margin-bottom: 12px;
}

.why-label {
    display: inline-block;
    width: 160px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--secondary);
}

/* Capability Grid */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.metric-tile {
    background-color: #ECEFF1;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.capability-verdict {
    background-color: var(--success-light);
    border-color: #C8E6C9;
    color: var(--success);
}

/* Control Chart */
.stability-verdict {
    background-color: var(--warning-light);
    border-color: #FFF9C4;
    color: #F57F17;
}

.limits-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #ECEFF1;
    padding: 12px;
    border-radius: 6px;
}

.limit-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.limit-row strong {
    color: var(--primary);
}

/* Flowchart Nodes */
.flowchart-canvas {
    background-color: #ECEFF1;
    border-radius: var(--radius);
    padding: 30px;
    height: auto;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
    border: 2px dashed var(--border);
}

.flow-step-node {
    width: 250px;
    background-color: var(--white);
    border: 2px solid var(--primary);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.flow-step-node:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.flow-step-node.active-defect-source {
    border-color: var(--danger);
    background-color: var(--danger-light);
}

.node-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.node-stats {
    font-size: 0.78rem;
    color: var(--secondary);
    font-weight: 500;
}

.flow-connector {
    color: var(--primary);
    font-size: 1.2rem;
    animation: flowPulse 2s infinite;
}

@keyframes flowPulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Charts sizing */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.nav-next-container {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
}

/* Footer */
.app-footer-bar {
    background-color: var(--primary);
    color: #B2DFDB;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    border-top: 1px solid var(--primary-light);
}

/* Print Overrides */
@media print {
    body {
        background-color: white;
    }
    .app-sidebar, .app-header, .app-footer-bar, .header-actions, .btn-group, .btn, .nav-next-container, .help-text, .case-study-guide-panel, .info-btn {
        display: none !important;
    }
    .app-workspace {
        display: block;
    }
    .app-display {
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    .display-section {
        display: block !important;
        page-break-after: always;
    }
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
    .card-body {
        padding: 10px;
    }
}

/* Practitioner Knowledge / Suggestions Box */
.practitioner-knowledge-box {
    background-color: #F4F6F9;
    border-left: 4px solid var(--primary-light);
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.practitioner-knowledge-box h5 {
    color: var(--accent);
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.practitioner-knowledge-box p {
    font-size: 0.86rem;
    color: #455A64;
    line-height: 1.45;
    margin: 0 0 8px 0;
}

.practitioner-knowledge-box p:last-child {
    margin-bottom: 0;
}
