/* Global Styles */
:root {
    --primary-color: #a68838;
    --secondary-color: #776228;
    --accent-color: #00ff88;
    --dark-bg: #525252;
    --darker-bg: #555454;
    --light-bg: #585757;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --glow-intensity: 0.5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(82, 82, 82, 0.603);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-brand img {
    width: 70px;
    height: 70px;
}

.nav-brand h1 {
    font-size: 1.2rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(166, 136, 56, var(--glow-intensity));
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: rgba(166, 136, 56, 0.1);
    box-shadow: 0 0 15px rgba(166, 136, 56, var(--glow-intensity));
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    margin: 3px 0;
    transition: 0.3s;
}

/* Main Content */
.main-content {
    margin-top: 80px;
    padding: 2rem;
}

.section {
    display: none;
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out;
}

.section.active {
    display: block;
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(166, 136, 56, var(--glow-intensity));
}

/* Home Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 60vh;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.glow-text {
    color: var(--primary-color);
    text-shadow: 0 0 30px rgba(166, 136, 56, var(--glow-intensity));
}

.hero-content h3 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.project-meta {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.project-meta p {
    margin: 0.5rem 0;
}

.cta-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(166, 136, 56, var(--glow-intensity));
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(166, 136, 56, 0.8);
}

.process-preview .node {
    fill: var(--primary-color);
    stroke: white;
    stroke-width: 2;
    filter: drop-shadow(0 0 10px rgba(166, 136, 56, var(--glow-intensity)));
}

.process-preview .flow-line {
    stroke: var(--accent-color);
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 5,5;
    animation: dash 2s linear infinite;
}

@keyframes dash {
    to { stroke-dashoffset: -10; }
}

.key-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.highlight-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.highlight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(166, 136, 56, 0.3);
}

/* Introduction Section */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.info-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-table td:first-child {
    font-weight: bold;
    color: var(--primary-color);
}

.usage-chart {
    margin: 1rem 0;
}

.usage-bar {
    height: 30px;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-radius: 5px;
    font-weight: bold;
}

.pharma { background: var(--primary-color); }
.chemical { background: var(--secondary-color); }
.resin { background: var(--accent-color); }

.reaction-block {
    background: var(--light-bg);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.chemical-equation {
    font-family: 'Courier New', monospace;
    background: rgba(166, 136, 56, 0.1);
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--accent-color);
    margin: 1rem 0;
}

/* Process Flow Section */
.flow-container {
    display: flex;
    gap: 2rem;
}

#process-diagram {
    flex: 1;
    background: var(--darker-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.equipment-group {
    cursor: pointer;
    transition: all 0.3s ease;
}

.equipment-group:hover {
    filter: drop-shadow(0 0 15px rgba(166, 136, 56, var(--glow-intensity)));
}

.tank {
    fill: var(--secondary-color);
    stroke: white;
    stroke-width: 2;
}

.reactor {
    fill: var(--primary-color);
    stroke: white;
    stroke-width: 2;
}

.separator {
    fill: var(--accent-color);
    stroke: white;
    stroke-width: 2;
}

.equipment {
    fill: #555;
    stroke: white;
    stroke-width: 2;
}

.label {
    fill: white;
    font-size: 12px;
    font-weight: bold;
    text-anchor: middle;
}

.sublabel {
    fill: var(--text-secondary);
    font-size: 10px;
    text-anchor: middle;
}

.flow-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    marker-end: url(#arrowhead);
}

.product-label {
    fill: var(--accent-color);
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
}

.product-sublabel {
    fill: var(--text-secondary);
    font-size: 10px;
    text-anchor: middle;
}

.flow-legend {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    min-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

.legend-symbol {
    width: 30px;
    height: 20px;
    border-radius: 3px;
}

.legend-symbol.tank { background: var(--secondary-color); }
.legend-symbol.reactor { background: var(--primary-color); }
.legend-symbol.separator { background: var(--accent-color); }
.legend-symbol.equipment { background: #555; }

/* Popup */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
}

.popup-content {
    background: var(--darker-bg);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    padding: 2rem;
    max-width: 600px;
    margin: 5% auto;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close-popup {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary-color);
}

/* Equipment Grid */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.equipment-card {
    background: var(--light-bg);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.equipment-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 0 25px rgba(166, 136, 56, 0.4);
}

.equipment-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.specs p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.detail-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--light-bg);
    border-radius: 10px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}

.data-table tr:hover {
    background: rgba(166, 136, 56, 0.1);
}

/* Energy Balance */
.energy-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.energy-list {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 10px;
}

.energy-unit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: var(--darker-bg);
    border-radius: 5px;
}

.energy-bar {
    height: 8px;
    background: var(--primary-color);
    border-radius: 4px;
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}

.energy-bar.cooling {
    background: var(--accent-color);
}

.calculation-panel {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
}

.formula {
    font-family: 'Courier New', monospace;
    background: rgba(166, 136, 56, 0.1);
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    font-size: 1.2rem;
    margin: 1rem 0;
}

/* Economics */
.economic-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.metric-card:hover {
    box-shadow: 0 0 20px rgba(166, 136, 56, 0.3);
}

.metric-value {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    margin: 0.5rem 0;
}

.cost-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* HAZOP */
.guide-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.guide-word-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.guide-word-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(166, 136, 56, 0.4);
}

.guide-word-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.safety-measures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.safety-category {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--accent-color);
}

.team-structure {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.team-role {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* Credits */
.credits-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.credit-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.credit-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    background: var(--darker-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--darker-bg);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        padding: 2rem 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .hamburger {
        display: flex;
    }
    
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .content-grid,
    .flow-container,
    .energy-summary,
    .cost-breakdown {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 2rem;
    }
}
