:root {
    /* Dark Theme (Default) */
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-primary: #e74c3c;
    --color-primary-dark: #c0392b;
    --color-text: #ecf0f1;
    --color-text-secondary: #bdc3c7;
    --color-border: #333;
    --shadow-md: 0 5px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.5);
    --shadow-header: 0 2px 10px rgba(0,0,0,0.5);
    --color-form-label-bg: var(--color-background);
    --font-family: 'Montserrat', sans-serif;
    --container-width: 1140px;
    --border-radius: 8px;
}

[data-theme="light"] {
    --color-background: #f8f9fa;
    --color-surface: #ffffff;
    --color-primary: #d62828;
    --color-primary-dark: #b22222;
    --color-text: #212529;
    --color-text-secondary: #6c757d;
    --color-border: #dee2e6;
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --shadow-header: 0 2px 10px rgba(0,0,0,0.1);
    --color-form-label-bg: var(--color-surface);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.7;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.products-section { background-color: var(--color-surface); }
#applications { background-color: var(--color-surface); }
.geography-section { background-color: var(--color-surface); text-align: center; }
.main-footer { padding: 30px 0; background-color: #000; text-align: center; }

.fire-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.2s ease-out; 
    will-change: transform;
}

[data-theme="light"] .fire-background {
    opacity: 0;
}

.fire-background::before, .fire-background::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    background: radial-gradient(circle, rgba(231, 76, 60, 0.1) 0%, transparent 30%),
                radial-gradient(circle, rgba(231, 76, 60, 0.08) 0%, transparent 40%);
    animation: fire-glow 40s linear infinite;
    will-change: transform;
}

.fire-background::after {
    animation-delay: -20s;
    animation-direction: reverse;
    opacity: 0.7;
}

@keyframes fire-glow {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1.3); }
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    font-weight: 600;
    color: var(--color-text);
}

h1 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(2rem, 4vw, 3rem); text-align: center; margin-bottom: 30px; position: relative; }
h2::after { content: ''; position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background-color: var(--color-primary); border-radius: 2px; }

.section-description { text-align: center; max-width: 800px; margin: -10px auto 60px; color: var(--color-text-secondary); font-size: 1.1rem; }
p { color: var(--color-text-secondary); margin-bottom: 1rem; }
a { color: var(--color-primary); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--color-primary-dark); }
section { padding: 100px 0; position: relative; }

/* Header */
.main-header { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; padding: 15px 0; background-color: rgba(18, 18, 18, 0.8); backdrop-filter: blur(10px); transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease; }
[data-theme="light"] .main-header { background-color: rgba(248, 249, 250, 0.8); }
.main-header.scrolled { background-color: var(--color-background); box-shadow: var(--shadow-header); }
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--color-text); }
.header-controls { display: flex; align-items: center; gap: 15px; }
.main-nav ul { list-style: none; display: flex; gap: 30px; }
.main-nav a { color: var(--color-text); font-weight: 600; position: relative; padding: 5px 0; }
.main-nav a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background-color: var(--color-primary); transition: width 0.3s ease; }
.main-nav a:hover::after { width: 100%; }
.burger-menu { display: none; background: none; border: none; cursor: pointer; z-index: 1001; }
.burger-menu span { display: block; width: 25px; height: 3px; background-color: var(--color-text); margin: 5px 0; transition: all 0.3s ease; }

/* Theme Switcher */
.theme-switcher { cursor: pointer; display: inline-block; position: relative; }
.theme-toggle-checkbox { display: none; }
.theme-switcher-slider { position: relative; width: 50px; height: 26px; background-color: var(--color-surface); border-radius: 13px; transition: background-color 0.3s; border: 1px solid var(--color-border); }
.theme-switcher-icon { position: absolute; top: 3px; left: 4px; width: 20px; height: 20px; background-color: var(--color-text-secondary); border-radius: 50%; transition: transform 0.3s ease; }
.theme-switcher-icon::before { content: '🌙'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; opacity: 1; transition: opacity 0.3s ease; }
.theme-toggle-checkbox:checked + .theme-switcher-slider .theme-switcher-icon { transform: translateX(23px); }
[data-theme="light"] .theme-switcher-icon::before { content: '☀️'; }

/* Hero Section */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding-top: 80px; position: relative; background: linear-gradient(45deg, #000000, #2c3e50, #000000); background-size: 400% 400%; animation: gradientBG 15s ease infinite; }
[data-theme="light"] .hero { background: linear-gradient(45deg, #e9ecef, #ffffff, #e9ecef); }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E'); }
[data-theme="light"] .hero-overlay { background: rgba(255, 255, 255, 0.4); background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23343a40" fill-opacity="0.05"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E'); }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.hero .container { position: relative; z-index: 2; }
.hero h1 { margin-bottom: 1rem; }
.hero p { font-size: 1.25rem; max-width: 700px; margin: 0 auto 2rem; color: var(--color-text-secondary); }
.cta-button { display: inline-block; background-color: var(--color-primary); color: white; padding: 15px 35px; border-radius: 50px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: 2px solid var(--color-primary); transition: all 0.4s ease; box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3); }
.cta-button:hover { background-color: transparent; color: var(--color-primary); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(231, 76, 60, 0.5); }

/* About Section */
.about-content { text-align: center; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; margin-top: 40px; }
.fact-item { background: var(--color-surface); padding: 30px; border-radius: var(--border-radius); text-align: center; border-left: 4px solid var(--color-primary); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.fact-item:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.fact-icon i { font-size: 50px; color: var(--color-text-secondary); transition: color 0.3s ease; margin-bottom: 15px; }
.fact-item:hover .fact-icon i { color: var(--color-primary); }
.fact-item h3 { font-size: 1.8rem; color: var(--color-text); }
.fact-item p { font-size: 1rem; color: var(--color-text-secondary); margin: 0; }

/* Products Section */
.products-section { background-color: transparent; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.product-card { background-color: var(--color-background); border-radius: var(--border-radius); border: 1px solid var(--color-border); display: flex; flex-direction: column; transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; overflow: hidden; }
.product-card:hover { transform: translateY(-10px); border-color: var(--color-primary); box-shadow: var(--shadow-lg); }
.product-image { width: 100%; height: 200px; object-fit: cover; cursor: pointer; transition: transform 0.3s ease; }
.product-card:hover .product-image { transform: scale(1.05); }
.product-card h3, .product-card p, .product-card ul, .product-card .cta-button-small { padding-left: 30px; padding-right: 30px; }
.product-card h3 { color: var(--color-primary); margin-top: 20px; margin-bottom: 15px; }
.product-card ul { list-style: none; padding-left: 30px; margin: 15px 0; flex-grow: 1; }
.product-card ul li { position: relative; padding-left: 25px; margin-bottom: 10px; }
.product-card ul li::before { content: '✔'; position: absolute; left: 0; color: var(--color-primary); }
.cta-button-small { display: inline-block; background: transparent; border: 2px solid var(--color-primary); color: var(--color-primary); padding: 10px 20px; border-radius: 50px; font-weight: 600; text-align: center; transition: all 0.3s ease; margin: 0 30px 30px; align-self: flex-start; }
.cta-button-small:hover { background: var(--color-primary); color: white; }

/* Advantages Section */
.advantages-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; text-align: center; }
.advantage-item { padding: 20px; }
.advantage-icon i { font-size: 60px; color: var(--color-text-secondary); transition: color 0.3s ease, transform 0.3s ease; margin-bottom: 15px; }
.advantage-item:hover .advantage-icon i { color: var(--color-primary); transform: scale(1.1); }
.advantage-item h4 { font-size: 1.2rem; margin: 15px 0 10px; }

/* Certificates Section */
.certificates-section { background-color: var(--color-background); }
.certificates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; margin-top: 60px; }
.certificate-item { background-color: var(--color-surface); border-radius: var(--border-radius); padding: 20px; text-align: center; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.certificate-item:hover { transform: translateY(-10px); box-shadow: var(--shadow-lg); }
.certificate-image { width: 100%; height: auto; border-radius: calc(var(--border-radius) / 2); margin-bottom: 15px; cursor: pointer; border: 1px solid var(--color-border); }
.certificate-item h4 { font-size: 1.2rem; color: var(--color-text); margin: 0; }

/* Applications Section */
#applications { background-color: transparent; }
.applications-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.application-item { text-align: center; padding: 30px; border-radius: var(--border-radius); transition: background-color 0.3s ease, transform 0.3s ease; }
.application-item:hover { background-color: var(--color-background); transform: scale(1.05); }
.app-icon i { font-size: 65px; color: var(--color-primary); margin-bottom: 1rem; }
.application-item h3 { margin-bottom: 0.5rem; }

/* Technology Section */
.technology-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; margin-top: 60px; }
.technology-text p { margin-bottom: 1.5rem; }
.technology-text p:last-child { margin-bottom: 0; }
.technology-diagram img { max-width: 100%; height: auto; border-radius: var(--border-radius); background-color: var(--color-surface); }

/* Geography Section */
.geography-section { background-color: transparent; text-align: center; }
.map-container { margin-top: 40px; max-width: 800px; margin-left: auto; margin-right: auto; }
.map-image { width: 100%; height: auto; border-radius: var(--border-radius); }

/* Contact Section */
.contact-section { background-color: var(--color-background); }
.contact-section .container { display: grid; grid-template-columns: 1fr 1.2fr; gap: 50px; align-items: flex-start; }
.contact-info p { margin-bottom: 1.5rem; }
.contact-form h3 { margin-bottom: 0.5rem; }
.contact-form p { margin-bottom: 2rem; }
.form-group { margin-bottom: 1.5rem; position: relative; }
.form-group label { position: absolute; top: 15px; left: 15px; color: var(--color-text-secondary); pointer-events: none; transition: all 0.3s ease; background-color: transparent; padding: 0 5px; }
.form-group input, .form-group textarea { width: 100%; padding: 15px; background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius); color: var(--color-text); font-family: var(--font-family); font-size: 1rem; transition: border-color 0.3s ease; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--color-primary); }
.form-group input:focus + label, .form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label, .form-group textarea:not(:placeholder-shown) + label {
    top: -10px; left: 10px; font-size: 0.8rem; color: var(--color-primary); background-color: var(--color-form-label-bg);
}

/* Footer */
.main-footer { padding: 30px 0; background-color: transparent; text-align: center; }
[data-theme="light"] .main-footer { background-color: var(--color-surface); }
.main-footer p { margin: 0; color: var(--color-text-secondary); }

/* Lightbox */
.lightbox { display: none; position: fixed; z-index: 2000; padding-top: 60px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.9); animation: fadeIn 0.5s; }
.lightbox-content { margin: auto; display: block; width: 80%; max-width: 900px; animation: zoomIn 0.5s; }
.lightbox-close { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; transition: 0.3s; cursor: pointer; }
.lightbox-close:hover, .lightbox-close:focus { color: #bbb; text-decoration: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { transform: scale(0.8); } to { transform: scale(1); } }

/* Animations */
.animate-on-scroll { opacity: 0; transform: translateY(50px); transition: opacity 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); will-change: transform, opacity; }
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }
.products-grid .animate-on-scroll:nth-child(1), .certificates-grid .animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.products-grid .animate-on-scroll:nth-child(2), .certificates-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.products-grid .animate-on-scroll:nth-child(3), .certificates-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }

/* Responsive */
@media (max-width: 992px) {
    .contact-section .container, .technology-grid { grid-template-columns: 1fr; }
}

/* Popup for Standard */
.popup {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.5s;
}

.popup-content {
    background-color: var(--color-surface);
    color: var(--color-text);
    margin: 5% auto;
    padding: 40px;
    border: 1px solid var(--color-border);
    width: 80%;
    max-width: 800px;
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.5s;
}

.popup-content {
    background-color: var(--color-surface);
    color: var(--color-text);
    margin: 5% auto;
    padding: 40px;
    border: 1px solid var(--color-border);
    width: 80%;
    max-width: 800px;
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.5s;
    max-height: 80vh; /* Limit height */
    overflow-y: auto;   /* Add scroll for overflow */
}

.popup-content h3, .popup-content h4 {
    color: var(--color-primary);
    margin-bottom: 15px;
    text-align: center;
}

.popup-content p {
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}

.popup-content .document-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 20px;
}

.popup-content .document-codes span {
    display: inline-block;
    margin: 0 10px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.popup-content .approval-stamp {
    margin-top: 20px;
    border: 2px solid var(--color-border);
    padding: 15px;
    display: inline-block;
}

.popup-content .document-meta {
    margin: 20px 0;
    font-size: 0.9rem;
}

.popup-content .document-section {
    margin-bottom: 25px;
}

.popup-content .document-section h4 {
    text-align: left;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.popup-content ul, .popup-content ol {
    list-style: disc;
    padding-left: 20px;
    color: var(--color-text-secondary);
}

.popup-content ol {
    list-style: decimal;
}

.popup-content .document-note {
    background-color: var(--color-background);
    border-left: 4px solid var(--color-primary);
    padding: 15px;
    margin: 20px 0;
    font-size: 0.9rem;
    font-style: italic;
}

.popup-content .tech-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.popup-content .tech-table th, .popup-content .tech-table td {
    border: 1px solid var(--color-border);
    padding: 12px;
    text-align: left;
}

.popup-content .tech-table th {
    background-color: var(--color-background);
}

.popup-content .tech-table caption {
    caption-side: bottom;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    color: var(--color-text-secondary);
}

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

.popup-close {
    color: var(--color-text-secondary);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    transition: color 0.3s;
}

.popup-close:hover,
.popup-close:focus {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    section { padding: 60px 0; }
    .main-nav { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: var(--color-background); flex-direction: column; padding: 20px 0; box-shadow: var(--shadow-header); }
    .main-nav.active { display: flex; }
    .main-nav ul { flex-direction: column; align-items: center; gap: 20px; }
    .header-controls { gap: 10px; }
    .logo { font-size: 1.3rem; }
    .burger-menu { display: block; }
    .burger-menu.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .burger-menu.active span:nth-child(2) { opacity: 0; }
    .burger-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }
    .section-description { font-size: 1rem; margin-bottom: 40px; }
    
    .hero { padding-left: 15px; padding-right: 15px; }
    .hero h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
        line-height: 1.3;
    }
    .hero p {
        font-size: 0.9rem;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    .cta-button {
        padding: 12px 20px;
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }

    .form-group input, .form-group textarea { font-size: 16px; /* Prevents iOS zoom */ }

    .popup-content {
        width: 95%;
        padding: 25px;
    }
}