/* CSS Variables untuk konsistensi */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --info-color: #1abc9c;
    --purple-color: #9b59b6;
    
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 8px 25px rgba(0,0,0,0.2);
    --border-radius: 12px;
}

/* Reset dan Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-gradient);
    height: 100vh;
    user-select: none;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
    perspective: 1000px;
}

/* Scene 3D */
#scene {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

/* Loading Screen */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

/* Panel Informasi */
#info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: none;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 100;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background-color: rgba(0,0,0,0.1);
}

#component-name {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: bold;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    padding-right: 30px;
}

#component-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-style: italic;
    color: #7f8c8d;
    overflow: hidden;
    border: 2px solid #e9ecef;
}

#component-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

#component-image img:hover {
    transform: scale(1.05);
}

#component-function, #component-analogy, #component-fact {
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--secondary-color);
    text-align: justify;
}

.section-title {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 1.1em;
    border-left: 4px solid var(--accent-color);
    padding-left: 10px;
}

/* Tooltip */
#tooltip {
    position: absolute;
    background: linear-gradient(135deg, var(--secondary-color), #34495e);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    pointer-events: none;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

/* Controls */
#controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 50;
}

#controls button {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 0 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#controls button:hover {
    background: linear-gradient(135deg, #2980b9, #2471a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#controls button:active {
    transform: translateY(0);
}

.control-info {
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

/* Scrollbar untuk panel info */
#info-panel::-webkit-scrollbar {
    width: 6px;
}

#info-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#info-panel::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

#info-panel::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Responsive Design */
@media (max-width: 768px) {
    #info-panel {
        width: 90%;
        right: 5%;
        left: 5%;
        top: 10px;
        max-height: 70vh;
    }
    
    #controls {
        bottom: 10px;
        left: 10px;
        padding: 10px;
    }
    
    #controls button {
        padding: 8px 12px;
        font-size: 11px;
        margin: 2px;
    }
    
    .control-info {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    #component-name {
        font-size: 1.2em;
    }
    
    .section-title {
        font-size: 1em;
    }
    
    #controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
        width: calc(100% - 20px);
    }
    
    #controls button {
        margin: 0;
    }
    
    .control-info {
        grid-column: 1 / -1;
    }
}