/* Mole Map Specific Styles - Integrated with Main Theme */

/* Ensure the app fits within the main layout */
.app-container {
    background: var(--card-bg); /* White */
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    position: relative;
    border: 1px solid #e9ecef;
    min-height: 800px;
}

.app-container h1 {
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: none;
}

.instruction {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    text-align: center;
}

/* Map Area */
.map-container {
    position: relative;
    width: 800px; /* Fixed width for coordinate consistency */
    height: 600px;
    margin-bottom: 20px;
    /* Scale down on smaller screens via media query on parent if needed */
}

/* SVG Layer */
.arrows-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.connection-line {
    stroke: #dee2e6; /* Light Gray for inactive */
    stroke-width: 4;
    transition: all 0.4s;
    stroke-dasharray: 8, 8;
}

.connection-line.active {
    stroke: var(--secondary-color);
    stroke-width: 5;
    stroke-dasharray: none;
    filter: drop-shadow(0 0 5px rgba(0, 168, 232, 0.4));
}

/* Nodes */
.node {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    z-index: 10;
    background: #ffffff;
    border: 3px solid #e9ecef;
    box-shadow: var(--shadow-sm);
}

.node:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.node.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.15);
    transform: none;
    background-color: #f8f9fa;
}

/* Badge for selection order */
.node.selected::after {
    background: var(--primary-color);
    content: attr(data-order);
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(0, 0);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 20;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.node .icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
    /* Remove text shadow from dark theme */
}

.node .label {
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    line-height: 1.2;
}

/* Specific Node Colors (Borders or Icons) */
.node-mole .icon { color: var(--accent-color); }
.node-volume .icon { color: #20c997; }
.node-mass .icon { color: #ff6b6b; }
.node-particles .icon { color: #845ef7; }


/* Coordinate Positioning (Keep strictly same as JS) */
.node-mole {
    top: 300px;
    left: 50%;
    margin-left: -65px;
    margin-top: -65px;
}
.node-volume {
    top: 80px;
    left: 50%;
    margin-left: -65px;
    margin-top: -65px;
}
.node-particles {
    top: 410px;
    left: 50%;
    margin-left: 125px; /* 400 + 125 + 65 = 590 */
    margin-top: -65px;
}
.node-mass {
    top: 410px;
    left: 50%;
    margin-left: -255px; /* 400 - 255 + 65 = 210 */
    margin-top: -65px;
}

/* Result Panel */
.result-panel {
    background: #f8f9fa;
    width: 100%;
    padding: 2rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid #e9ecef;
}

.sequence-label, .factor-label {
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-content {
    font-size: 1.5rem;
    color: var(--primary-dark);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.arrow {
    color: var(--text-light);
    font-size: 1.2rem;
}

/* Factors Display */
.factor-display {
    background: #ffffff;
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.2rem; 
    color: var(--text-color);
    margin: 0 10px;
}

.fraction .numerator {
    border-bottom: 2px solid var(--text-color);
    padding: 0 5px 2px;
    font-weight: 600;
}

.fraction .denominator {
    padding: 2px 5px 0;
    font-weight: 600;
}

.multiply-sign {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 0 10px;
}

/* Reset Button */
.reset-btn {
    background-color: var(--accent-color);
    color: #333;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Formula Box */
.formula-reference {
    width: 100%;
    border-top: 1px solid #dee2e6;
    padding-top: 1.5rem;
}

.formula-title {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.formula-box {
    background: #e3f2fd;
    border: 1px solid rgb(187, 222, 251);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 80px;
}

.formula-main {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.formula-equals {
    font-size: 1.5rem;
    color: var(--text-light);
}

.formula-fraction {
    background: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.formula-num, .formula-den {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

.formula-den {
    border-top: 1px solid var(--primary-color);
}

/* Responsive Scaling */
@media (max-width: 850px) {
    .map-container {
        transform: scale(0.7);
        transform-origin: top center;
        margin-bottom: -150px;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    .map-container {
        transform: scale(0.5);
        margin-bottom: -280px;
    }
}
