* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: #f0f8ff;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00c6ff, #0072ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    color: #a0d2ff;
    margin-bottom: 15px;
}

.main-content {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 20px;
}

.canvas-container {
    flex: 2;
    min-width: 300px;
    min-height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #0a1929;
    position: relative;
    aspect-ratio: 16/9;
}

#3d-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.controls-panel {
    flex: 1;
    min-width: 300px;
    background: rgba(16, 42, 67, 0.8);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(64, 156, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.panel-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #4da6ff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title i {
    font-size: 1.3rem;
}

.point-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #b3d9ff;
    font-size: 1rem;
}

input, textarea {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #3a6186;
    background: rgba(10, 25, 41, 0.8);
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
    width: 100%;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #0072ff;
    box-shadow: 0 0 0 2px rgba(0, 114, 255, 0.3);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(90deg, #0072ff, #00c6ff);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(90deg, #0062e0, #00b4e6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 114, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.points-list {
    background: rgba(10, 25, 41, 0.6);
    border-radius: 8px;
    padding: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.points-list-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.points-list-header h3 {
    color: #4da6ff;
}

.point-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(16, 42, 67, 0.8);
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #0072ff;
    transition: all 0.3s;
}

.point-item:hover {
    background: rgba(24, 58, 90, 0.9);
    transform: translateX(5px);
}

.point-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.point-name {
    font-weight: 600;
    color: #a0d2ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.point-coords {
    font-size: 0.85rem;
    color: #89b6e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.point-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.point-action-btn {
    background: transparent;
    border: none;
    color: #a0d2ff;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    padding: 5px;
    border-radius: 4px;
}

.point-action-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.octant-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.color-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.color-label {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.custom-color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.color-preview:hover {
    transform: scale(1.1);
}

.color-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.color-input-wrapper input {
    padding: 8px;
    font-size: 0.9rem;
}

.color-sliders {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.color-slider {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-slider label {
    min-width: 40px;
    font-size: 0.9rem;
}

.color-slider input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

.color-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4da6ff;
    cursor: pointer;
}

.color-slider-value {
    min-width: 30px;
    text-align: right;
    font-size: 0.9rem;
}

.axis-naming {
    margin-top: 15px;
}

.axis-inputs {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.axis-input-group {
    flex: 1;
    min-width: 0;
}

.axis-input-group input {
    width: 100%;
}

.octant-naming {
    margin-top: 15px;
}

.octant-names-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.octant-names-grid input {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
}

.data-management {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.data-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.data-buttons .btn {
    flex: 1;
}

.file-input-wrapper {
    position: relative;
    width: 100%;
}

#file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #89b6e6;
    font-size: 0.9rem;
}

/* Modal for custom color picker */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(16, 42, 67, 0.95);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(64, 156, 255, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    color: #4da6ff;
    font-size: 1.3rem;
}

.close-modal {
    background: none;
    border: none;
    color: #a0d2ff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #ff6b6b;
}

@media (max-width: 1100px) {
    .main-content {
        flex-direction: column;
    }
    
    .canvas-container {
        min-height: 500px;
    }
    
    .octant-colors, .octant-names-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .controls-panel {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .octant-colors, .octant-names-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row, .axis-inputs, .data-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row .form-group, .axis-input-group {
        width: 100%;
    }
    
    h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .octant-colors, .octant-names-grid {
        grid-template-columns: 1fr;
    }
    
    .color-picker {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .color-label {
        text-align: left;
        margin-bottom: 0;
    }
}