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

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Modern Header */
.modern-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    padding: 15px 0;
    box-shadow: 0 2px 30px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
}

.megam-logo {
    display: flex;
    flex-direction: column;
}

.megam-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    letter-spacing: -0.5px;
}

.megam-subtitle {
    font-size: 0.85rem;
    color:rgb(86, 112, 150);
    font-weight: 500;
    margin-top: -2px;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Dropdown Menu */
.dropdown-menu {
    position: relative;
}

.dropdown-btn {
    background: linear-gradient(135deg, #667eea,rgb(30, 32, 146));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.dropdown-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px;
    font-weight: 500;
}

.dropdown-item:hover {
    background: #f7fafc;
    color: #2d3748;
    transform: translateX(4px);
}

.dropdown-icon {
    font-size: 1.2rem;
}

/* Hero Section */
.hero-section {
    padding: 60px 0 80px;
    background: transparent;
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    text-align: center;
}

.hero-title {
    margin-bottom: 50px;
}

.hero-title h2 {
    font-size: 2.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-title p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

/* Modern Navigation */
.modern-nav {
    margin-top: 40px;
}

.areas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.area-card {
    border: none;
    border-radius: 20px;
    padding: 0;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    height: 220px;
    min-width: 200px;
}

.matematica-card {
    background: linear-gradient(135deg, #667eea 0%,rgb(57, 18, 129) 100%);
}

.fisica-card {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.quimica-card {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.biologia-card {
    background: linear-gradient(135deg, #d3e62bff 0%, #aedf2aff 100%);
}

.card-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
    transition: all 0.3s ease;
}



.card-content {
    position: relative;
    z-index: 2;
    padding: 25px 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.area-icon {
    font-size: 2.8rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.area-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.area-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.area-card:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.area-card:hover .card-background {
    background: rgba(255, 255, 255, 0.2);
}

.area-card:hover .card-accent {
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
}

.menu-card:hover::before {
    height: 100%;
    opacity: 0.1;
}

.menu-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
}

.menu-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #2c3e50;
}

.menu-card p {
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: 500;
}

.menu-card.matematica:hover h3 {
    color: #FF6B35;
}

.menu-card.fisica:hover h3 {
    color: #4ECDC4;
}

.menu-card.quimica:hover h3 {
    color: #A8E6CF;
}

.menu-card.biologia:hover h3 {
    color: #FFD93D;
}

/* Submenus - Estilo */
.submenu-nav {
    background: transparent;
    padding: 20px 0;
    animation: slideInFromTop 0.5s ease;
}

.submenu-nav.active {
    display: block !important;
}

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

.submenu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: linear-gradient(135deg, #667eea,rgb(57, 18, 129));
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.submenu-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    font-weight: 700;
    margin: 0;
}

.submenu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.submenu-card {
    border: none;
    border-radius: 15px;
    padding: 20px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.submenu-card.matematica {
    background: linear-gradient(135deg, #667eea 0%,rgb(57, 18, 129) 100%);
}

.submenu-card.fisica {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.submenu-card.quimica {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.submenu-card.biologia {
    background: linear-gradient(135deg, #d3e62bff 0%, #d8ec22ff 100%);
}

.submenu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.submenu-card:hover::before {
    transform: scaleX(1);
}

.submenu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.submenu-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.submenu-card h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.submenu-card p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.submenu-card:hover h4 {
    color: white;
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

.content-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Dynamic Content Styles */
#dynamic-content {
    display: none;
    min-height: 60vh;
    padding: 2rem;
    background: transparent;
    position: relative;
    z-index: 2;
}

.hero-section {
    position: relative;
    z-index: 1;
}

/* Aplicar tema escuro apenas no modo molecular */
#dynamic-content.molecular-mode {
    background-color: #0b0f1a !important;
}

/* Remover fundos e sombras brancas no molecular */
#dynamic-content.molecular-mode .sub-page,
#dynamic-content.molecular-mode .sub-page-content,
#dynamic-content.molecular-mode .formula-section,
#dynamic-content.molecular-mode .molecular-input-section,
#dynamic-content.molecular-mode .model-controls,
#dynamic-content.molecular-mode .molecular-3d-container,
#dynamic-content.molecular-mode #molecular-info,
#dynamic-content.molecular-mode .content-area,
#dynamic-content.molecular-mode .formula-result,
#dynamic-content.molecular-mode .formula-section .sub-page-content {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    color: #e5e7eb;
    border: none !important;
}

/* Forçar visibilidade dos blocos no molecular-mode (evitar display:none herdado) */
#dynamic-content.molecular-mode,
#dynamic-content.molecular-mode .container,
#dynamic-content.molecular-mode #content-area,
#dynamic-content.molecular-mode .formula-section,
#dynamic-content.molecular-mode .sub-page-content {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Botões e cards no molecular em tema escuro */
#dynamic-content.molecular-mode .model-btn,
#dynamic-content.molecular-mode .sub-item-card {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e5e7eb !important;
}

/* Ajustes de legibilidade em cabeçalhos e textos no molecular */
#dynamic-content.molecular-mode .sub-page-header h1,
#dynamic-content.molecular-mode .sub-page-header p,
#dynamic-content.molecular-mode .formula-result h3,
#dynamic-content.molecular-mode .formula-result p {
    color: #e5e7eb !important;
}

/* Garantir altura útil para o canvas quando entrar no molecular */
#dynamic-content.molecular-mode #content-area {
    min-height: calc(100vh - 80px);
}

/* Sub Page Styles */
.sub-page {
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #84bde2ff 0%, rgb(57, 18, 129) 100%);
    color: white;
}

.sub-page-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.back-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.sub-page-header h1 {
    font-size: 2.5rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.sub-page-header p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0 0 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sub-page-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.sub-item-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    color: white;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.sub-item-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.sub-item-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.sub-item-card h3 {
    font-size: 1.4rem;
    margin: 0.5rem 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.sub-item-card p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

/* Responsive adjustments for sub-pages */
@media (max-width: 768px) {
    .sub-page {
        padding: 1rem;
    }
    
    .sub-page-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .sub-page-header h1 {
        font-size: 2rem;
    }
    
    .sub-page-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sub-item-card {
        min-height: 150px;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .sub-page-header h1 {
        font-size: 1.8rem;
    }
    
    .sub-item-icon {
        font-size: 2.5rem;
    }
    
    .sub-item-card h3 {
        font-size: 1.2rem;
    }
}

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

.welcome-screen h2 {
    font-size: 2.5rem;
    color: #73a0f3ff;
    margin-bottom: 20px;
    font-weight: 700;
}

.welcome-screen p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature-card {
    background: linear-gradient(135deg, #5e9ef3ff 0%,rgb(57, 18, 129) 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.feature-card p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Formula Input Section */
.formula-section {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.section-title {
    font-size: 2rem;
    color: #6c94e9ff;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.input-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.input-method {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.method-title {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.formula-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.formula-input:focus {
    outline: none;
    border-color: #587de2ff;
}

.file-input {
    width: 100%;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.file-input:hover {
    border-color: #4c51bf;
    background: #f8f9fa;
}

.process-btn {
    background: linear-gradient(45deg, #4c51bf, #667eea);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 81, 191, 0.3);
}

/* 3D Viewer */
.viewer-container {
    background: #000;
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

/* Estilos para o visualizador 3D e 2D */
#viewer-container {
    width: 100%;
    height: 500px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: linear-gradient(135deg, #4c6aeeff 0%,rgb(57, 18, 129) 100%);
    display: none;
    position: relative;
    overflow: hidden;
}

/* Estilos específicos para visualizador 2D */
#canvas-2d {
    display: block;
    margin: 0 auto;
    cursor: grab;
}

#canvas-2d:active {
    cursor: grabbing;
}

.formula-info-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    font-size: 14px;
    z-index: 10;
}

.formula-info-panel h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.formula-info-panel p {
    margin: 5px 0;
    color: #666;
}

.controls-2d {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.controls-2d button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #007bff;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.controls-2d button:hover {
    background: #0056b3;
}

.viewer-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 15px;
    max-width: 300px;
    z-index: 10;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-label {
    display: block;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn {
    background: linear-gradient(135deg, #5370eeff 0%,rgb(57, 18, 129) 100%);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: white;
    margin: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.control-btn:hover {
    background: linear-gradient(135deg,rgb(57, 18, 129) 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.advanced-controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.slider-control {
    margin-bottom: 10px;
}

.slider-control label {
    display: block;
    color: #ffffff;
    font-size: 10px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.slider-control input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f81ecff 0%,rgb(57, 18, 129) 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%,rgb(57, 18, 129) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.interaction-help {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 11px;
    max-width: 280px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.viewer-controls .interaction-help {
    position: static;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    padding: 10px 0 0 0;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 100%;
    backdrop-filter: none;
    box-shadow: none;
}

.viewer-controls .interaction-help p {
    font-size: 10px;
    opacity: 0.9;
}

.interaction-help p {
    margin: 4px 0;
    line-height: 1.4;
}

.interaction-help strong {
    color: #64b5f6;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .viewer-controls {
        position: relative;
        top: 0;
        right: 0;
        max-width: 100%;
        margin-bottom: 10px;
    }
    
    .control-group {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 5px;
    }
    
    .control-label {
        margin-bottom: 0;
        margin-right: 10px;
        min-width: 80px;
    }
    
    .control-btn {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .interaction-help {
        position: relative;
        bottom: 0;
        left: 0;
        margin-top: 10px;
    }
    
    .advanced-controls {
        margin-top: 15px;
    }
}

.download-section {
    text-align: center;
    margin-top: 30px;
}

.download-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Modern Footer */
.modern-footer {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    padding: 25px 0;
    margin-top: 60px;
    box-shadow: 0 -2px 30px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

.footer-content {
    text-align: center;
    position: relative;
}

.footer-text {
    color: #4a5568;
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
}

.footer-accent {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #526eecff,rgb(57, 18, 129));
    margin: 15px auto 0;
    border-radius: 2px;
}

/* Responsividade */
@media (max-width: 1024px) {
    .areas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        max-width: 600px;
    }
    
    .area-card {
        height: 200px;
        min-width: 180px;
    }
    
    .hero-title h2 {
        font-size: 2.4rem;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .megam-title {
        font-size: 1.8rem;
    }
    
    .megam-subtitle {
        font-size: 0.8rem;
    }
    
    .areas-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 350px;
    }
    
    .area-card {
        height: 180px;
        min-width: 280px;
    }
    
    .hero-title h2 {
        font-size: 2rem;
    }
    
    .hero-title p {
        font-size: 1.1rem;
    }
    
    .hero-section {
        padding: 40px 0 60px;
    }
    
    .dropdown-content {
        right: -10px;
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .hero-container {
        padding: 0 20px;
    }
    
    .area-card {
        min-width: 260px;
        height: 160px;
    }
    
    .area-icon {
        font-size: 2.4rem;
    }
    
    .area-title {
        font-size: 1.3rem;
    }
    
    .megam-title {
        font-size: 1.6rem;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        padding: 15px;
    }
    
    .formula-actions {
        justify-content: center;
    }
}

/* Molecular submenu unified styles */
.content-area .formula-section .back-button {
    background: linear-gradient(135deg, #4061f1ff 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

.content-area .formula-section .back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.content-area .formula-section .sub-page-header {
    background: linear-gradient(135deg, #667eea 0%, #472bacff 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    text-align: left;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
    display: flex;
    align-items: center;
    gap: 24px;
}

.content-area .formula-section .sub-page-header .page-title {
    flex: 1;
}

.content-area .formula-section .sub-page-header h1,
.content-area .formula-section .sub-page-header h2 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.content-area .formula-section .sub-page-header p {
    font-size: 0.9rem;
    margin: 4px 0 0 0;
    opacity: 0.9;
}

.content-area .formula-section .back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.content-area .formula-section .back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.content-area .formula-section .sub-page-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.content-area .formula-section .molecular-input-section {
    background: linear-gradient(135deg, #ff6b6b 0%, #f5576c 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    color: white;
}

.content-area .formula-section .molecular-input-section h3 {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.content-area .formula-section .molecular-input-section p {
    margin: 0 0 12px 0;
    opacity: 0.95;
}

.content-area .formula-section .input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.content-area .formula-section .input-group input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(8px);
}

.content-area .formula-section .input-group input::placeholder {
    color: rgba(255, 255, 255, 0.85);
}

.content-area .formula-section .input-group button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.35);
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.content-area .formula-section .input-group button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.content-area .formula-section .model-controls {
    display: flex;
    gap: 12px;
    margin: 16px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.content-area .formula-section .model-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.content-area .formula-section .model-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.content-area .formula-section .model-btn.active {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.3);
}

/* Container do visualizador 3D - garante tamanho visível */
.content-area .molecular-3d-container {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #667eea 0%, #3b38c5ff 100%);
    border-radius: 12px;
    margin: 16px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Corrige canvas 0x0 e garante expansão total dentro do container */
.content-area .molecular-3d-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 12px;
}

/* Bloco de informações da molécula */
.content-area .formula-section #molecular-info {
    margin-top: 16px;
}

/* Responsivo */
@media (max-width: 768px) {
    .content-area .formula-section .input-group {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 1024px) {
    .formula-result {
        padding: 18px;
        margin: 15px 0;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: center;
    }
    
    .input-methods {
        grid-template-columns: 1fr;
    }
    
    .feature-cards {
        grid-template-columns: 1fr;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .formula-result {
        padding: 15px;
        margin: 12px 0;
    }
    
    .formula-result h3 {
        font-size: 1.2em;
    }
    
    .formula-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-3d, .btn-download {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    .ocr-preview-actions {
        flex-direction: column;
    }
    
    .ocr-preview-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .formula-result {
        padding: 12px;
        margin: 10px 0;
    }
    
    .formula-result h3 {
        font-size: 1.1em;
    }
    
    .formula-result p {
        font-size: 0.9em;
    }
    
    .formula-status {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .btn-3d, .btn-download {
        padding: 12px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 360px) {
    .formula-result {
        padding: 10px;
    }
    
    .formula-result h3 {
        font-size: 1em;
    }
    
    .formula-result p {
        font-size: 0.85em;
    }
    
    .formula-status {
        padding: 8px 10px;
        font-size: 0.85em;
    }
    
    .btn-3d, .btn-download {
        padding: 10px 14px;
        font-size: 0.85em;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .formula-result {
        padding: 12px;
    }
    
    .formula-actions {
        flex-direction: row;
        gap: 10px;
    }
    
    .btn-3d, .btn-download {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.8em;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Formula screen styles */
.formula-screen {
    background: linear-gradient(135deg, #4965e4ff 0%,rgb(57, 18, 129) 100%);
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.1), 0 8px 32px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.formula-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
                linear-gradient(45deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* Formula result styles */
.formula-result {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.formula-result h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 600;
}

.formula-result p {
    color: #34495e;
    margin: 8px 0;
    line-height: 1.6;
}

.formula-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
}

.formula-status.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.formula-status.warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.formula-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-3d, .btn-download {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-3d {
    background: linear-gradient(135deg, #3f5bdbff,rgb(57, 18, 129));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-download {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

.btn-3d:hover, .btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-3d::before, .btn-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-3d:hover::before, .btn-download:hover::before {
    left: 100%;
}

/* OCR Preview Styles */
.ocr-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ocr-preview-header {
    background: #e9ecef;
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ocr-preview-header h4 {
    margin: 0;
    color: #495057;
    font-size: 16px;
}

.close-preview-btn, .close-debug-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-preview-btn:hover, .close-debug-btn:hover {
    background: #c82333;
}

.ocr-preview-content {
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.ocr-preview-content pre {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
}

.ocr-preview-actions {
    padding: 12px 16px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
}

.edit-ocr-btn, .retry-ocr-btn, .save-ocr-btn, .cancel-edit-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.edit-ocr-btn {
    background: #007bff;
    color: white;
}

.edit-ocr-btn:hover {
    background: #0056b3;
}

.retry-ocr-btn {
    background: #28a745;
    color: white;
}

.retry-ocr-btn:hover {
    background: #1e7e34;
}

.save-ocr-btn {
    background: #28a745;
    color: white;
}

.save-ocr-btn:hover {
    background: #1e7e34;
}

.cancel-edit-btn {
    background: #6c757d;
    color: white;
}

.cancel-edit-btn:hover {
    background: #545b62;
}

/* Section Header Styles */
.section-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.section-header .back-button {
    position: absolute;
    left: 0;
    top: 0;
    margin-bottom: 0;
}

.section-header h2 {
    color: #00ff88;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ff88;
}

.section-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin: 0;
}

/* Back Button Styles */
.back-button {
    background: linear-gradient(45deg, #3855daff, #4657bbff);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* Sub-page Header Styles */
.sub-page-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.sub-page-header h1 {
    color: #ffffff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sub-page-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin: 0;
}

/* Formula Section Styles */
.formula-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e);
    border-radius: 15px;
    color: #ffffff;
    min-height: 80vh;
}

/* Sub-page Content Styles */
.sub-page-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Responsive Design for Back Button */
@media (max-width: 768px) {
    .back-button {
        padding: 8px 16px;
        font-size: 0.8rem;
        margin-bottom: 15px;
    }
    
    .section-header .back-button {
        position: static;
        margin-bottom: 15px;
    }
    
    .sub-page-header h1 {
        font-size: 2rem;
    }
    
    .sub-page-header p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .back-button {
        padding: 6px 12px;
        font-size: 0.75rem;
        margin-bottom: 10px;
    }
    
    .section-header .back-button {
        position: static;
        margin-bottom: 10px;
    }
    
    .sub-page-header {
        padding: 15px;
    }
    
    .sub-page-header h1 {
        font-size: 1.8rem;
    }
    
    .sub-page-header p {
        font-size: 0.9rem;
    }
}

/* Debug Info Styles */
.debug-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.debug-info-header {
    background: #ffeaa7;
    padding: 12px 16px;
    border-bottom: 1px solid #fdcb6e;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-info-header h4 {
    margin: 0;
    color: #856404;
    font-size: 16px;
}

.debug-info-content {
    padding: 16px;
}

.debug-section {
    margin-bottom: 16px;
}

.debug-section:last-child {
    margin-bottom: 0;
}

.debug-section h5 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 14px;
    font-weight: 600;
}

.debug-text {
    background: white;
    border: 1px solid #fdcb6e;
    border-radius: 4px;
    padding: 8px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.3;
    max-height: 100px;
    overflow-y: auto;
}

.debug-text-small {
    background: #f1f3f4;
    padding: 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 60px;
    overflow-y: auto;
    margin: 4px 0;
}

.debug-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.debug-result-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px;
    background: #fafafa;
}

.debug-result-item strong {
    color: #1976d2;
    font-size: 12px;
}