/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
    touch-action: manipulation;
}

/* Container setup for iframe compatibility */
.container {
    width: 100%;
    height: 450px;
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Responsive height for full browser */
@media (min-height: 600px) {
    .container {
        height: 90vh;
    }
}

/* Analytics Panel */
.analytics-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
}

.analytics-header {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 5px;
    text-align: center;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
    font-size: 11px;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: #4CAF50;
}

/* Mind Map Container */
.mindmap-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

/* SVG Connections */
.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: #4CAF50;
    stroke-width: 2;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.connection-line.highlighted {
    stroke: #FF6B6B;
    stroke-width: 3;
    opacity: 1;
}

/* Node Styles */
.node {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    min-height: 44px; /* Touch target minimum */
    display: flex;
    align-items: center;
    justify-content: center;
}

.node:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.node.active {
    background: #4CAF50;
    color: white;
    transform: scale(1.05);
}

.node-content {
    padding: 8px 12px;
    text-align: center;
}

.node-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 2px;
}

.node-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.node-formula {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.node-desc {
    font-size: 11px;
    opacity: 0.8;
}

/* Central Node */
.central-node {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    width: 140px;
    height: 80px;
    font-size: 16px;
}

/* Branch Positioning */
.speed-branch {
    position: absolute;
    top: 20%;
    left: 15%;
}

.velocity-branch {
    position: absolute;
    top: 20%;
    right: 15%;
}

.examples-branch {
    position: absolute;
    bottom: 25%;
    left: 15%;
}

.differences-branch {
    position: absolute;
    bottom: 25%;
    right: 15%;
}

/* Concept Nodes */
.concept-node {
    width: 120px;
    height: 60px;
    background: linear-gradient(135deg, #FF6B6B, #ee5a52);
    color: white;
    position: relative;
}

/* Sub Nodes */
.sub-node {
    position: absolute;
    width: 100px;
    height: 50px;
    background: white;
    border: 2px solid #ddd;
    font-size: 12px;
}

/* Sub-node positioning relative to parent */
.speed-branch .sub-node:nth-of-type(2) {
    top: 80px;
    left: -20px;
}

.speed-branch .sub-node:nth-of-type(3) {
    top: 80px;
    right: -20px;
}

.velocity-branch .sub-node:nth-of-type(2) {
    top: 80px;
    left: -20px;
}

.velocity-branch .sub-node:nth-of-type(3) {
    top: 80px;
    right: -20px;
}

.examples-branch .sub-node:nth-of-type(2) {
    top: -70px;
    left: -20px;
}

.examples-branch .sub-node:nth-of-type(3) {
    top: -70px;
    right: -20px;
}

.differences-branch .sub-node:nth-of-type(2) {
    top: -70px;
    left: -20px;
}

.differences-branch .sub-node:nth-of-type(3) {
    top: -70px;
    right: -20px;
}

/* Controls Panel */
.controls-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid #ddd;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

select, .control-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    min-height: 44px; /* Touch target */
    transition: all 0.2s ease;
}

.control-btn {
    background: #4CAF50;
    color: white;
    border: none;
    font-weight: bold;
}

.control-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* Info Panel */
.info-panel {
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-height: 120px;
    overflow-y: auto;
    z-index: 100;
    transition: all 0.3s ease;
}

.info-header {
    font-weight: bold;
    font-size: 14px;
    color: #4CAF50;
    margin-bottom: 8px;
}

.info-content {
    font-size: 12px;
    line-height: 1.4;
}

/* Hidden state for filtering */
.node.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.branch.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mindmap-container {
        padding: 10px;
    }
    
    .central-node {
        width: 120px;
        height: 70px;
        font-size: 14px;
    }
    
    .concept-node {
        width: 100px;
        height: 50px;
        font-size: 12px;
    }
    
    .sub-node {
        width: 80px;
        height: 40px;
        font-size: 10px;
    }
    
    .controls-panel {
        flex-direction: column;
        gap: 5px;
    }
    
    .analytics-panel {
        position: relative;
        margin: 5px;
        width: auto;
    }
    
    .info-panel {
        position: relative;
        margin: 5px;
        max-height: 80px;
    }
}

/* Animation classes */
.pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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