/* 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%);
    overflow: hidden;
    user-select: none;
    height: 100vh;
    width: 100vw;
}

/* Container setup for iframe and full screen compatibility */
.container {
    position: relative;
    width: 100%;
    height: 450px; /* Default iframe height */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Full screen mode when not in iframe */
@media (min-height: 500px) {
    .container {
        height: 90vh;
    }
}

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

/* Mind map container */
.mind-map {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Base bubble styles */
.bubble {
    position: absolute;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid #fff;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    padding: 8px 12px;
    min-width: 80px;
    max-width: 180px;
    word-wrap: break-word;
}

/* Bubble text styling */
.bubble-text {
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    display: block;
    width: 100%;
}

/* Central bubble - largest and most prominent */
.central-bubble {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    width: 140px;
    height: 80px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    font-size: 14px;
}

.central-bubble .bubble-text {
    font-size: 14px;
    font-weight: 700;
}

/* Main branch bubbles */
.main-branch {
    background: linear-gradient(135deg, #4834d4, #686de0);
    width: 100px;
    height: 60px;
    z-index: 8;
}

/* Sub-branch bubbles */
.sub-branch {
    width: 90px;
    height: 50px;
    z-index: 6;
    font-size: 10px;
}

/* Color coding for different sub-branch categories */
.speed-sub {
    background: linear-gradient(135deg, #00d2d3, #54a0ff);
}

.velocity-sub {
    background: linear-gradient(135deg, #ff9ff3, #f368e0);
}

.measurement-sub {
    background: linear-gradient(135deg, #feca57, #ff9f43);
}

.examples-sub {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
}

/* Hover effects for better interactivity */
.bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

.central-bubble:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Active/dragging state */
.bubble.dragging {
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    z-index: 25;
}

/* Connection lines styling */
.connection-line {
    stroke: #666;
    stroke-width: 2;
    opacity: 0.6;
    stroke-dasharray: 5,5;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -200;
    }
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    max-width: 200px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

.tooltip.show {
    opacity: 1;
}

/* Instructions panel */
.instructions {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

/* Initial positioning for bubbles */
#speed {
    top: 20%;
    left: 15%;
}

#velocity {
    top: 20%;
    right: 15%;
}

#measurement {
    bottom: 25%;
    left: 15%;
}

#examples {
    bottom: 25%;
    right: 15%;
}

/* Speed sub-branches */
#distance-time {
    top: 10%;
    left: 5%;
}

#no-direction {
    top: 35%;
    left: 5%;
}

/* Velocity sub-branches */
#speed-direction {
    top: 10%;
    right: 5%;
}

#vector {
    top: 35%;
    right: 5%;
}

/* Measurement sub-branches */
#units {
    bottom: 15%;
    left: 5%;
}

#tools {
    bottom: 5%;
    left: 20%;
}

/* Examples sub-branches */
#car {
    bottom: 15%;
    right: 5%;
}

#runner {
    bottom: 5%;
    right: 20%;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .bubble-text {
        font-size: 10px;
    }
    
    .central-bubble .bubble-text {
        font-size: 12px;
    }
    
    .bubble {
        min-width: 70px;
        max-width: 150px;
    }
    
    .central-bubble {
        width: 120px;
        height: 70px;
    }
    
    .main-branch {
        width: 90px;
        height: 55px;
    }
    
    .sub-branch {
        width: 80px;
        height: 45px;
    }
}