/* Custom System Creator Styles */

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Orbitron', sans-serif;
}

.modal-content {
    background-color: #0a1a2a;
    border: 2px solid #2c5a8c;
    border-radius: 5px;
    width: 80%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    color: #c5d8f1;
    box-shadow: 0 0 20px rgba(44, 90, 140, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #2c5a8c;
    background-color: #162c43;
}

.modal-header h2 {
    margin: 0;
    color: #4a9dff;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(74, 157, 255, 0.5);
}

.close-btn {
    background: none;
    border: none;
    color: #c5d8f1;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.close-btn:hover {
    color: #ff4a4a;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #4a9dff;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 10px;
    background-color: #0d1e2f;
    border: 1px solid #2c5a8c;
    border-radius: 3px;
    color: #c5d8f1;
    font-family: 'Orbitron', sans-serif;
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #4a9dff;
    box-shadow: 0 0 5px rgba(74, 157, 255, 0.5);
}

.planet-input {
    background-color: #162c43;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid #2c5a8c;
    position: relative;
}

.planet-input h3 {
    margin-top: 0;
    color: #4a9dff;
    font-size: 1.2rem;
}

.remove-planet-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #3a0f0f;
    color: #ff9191;
    border: 1px solid #8c2c2c;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.remove-planet-btn:hover {
    background-color: #5a1a1a;
}

.primary-btn, 
.secondary-btn, 
.danger-btn {
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    border: none;
    transition: all 0.2s ease;
}

.primary-btn {
    background-color: #2c5a8c;
    color: #f0f8ff;
}

.primary-btn:hover {
    background-color: #3a6fa8;
}

.secondary-btn {
    background-color: #333333;
    color: #f0f8ff;
}

.secondary-btn:hover {
    background-color: #444444;
}

.danger-btn {
    background-color: #8c2c2c;
    color: #f0f8ff;
}

.danger-btn:hover {
    background-color: #a83a3a;
}

.form-actions {
    margin-top: 20px;
    text-align: center;
}

.form-actions button {
    margin: 0 10px;
}

#add-planet-btn {
    margin-bottom: 20px;
}

/* Generation progress */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #0d1e2f;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #2c5a8c;
    width: 0%;
    border-radius: 10px;
    animation: progress-animation 2s infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 80%; }
    100% { width: 0%; }
}

#generation-status {
    text-align: center;
    color: #4a9dff;
}

/* Preview section */
.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.skybox-preview {
    flex: 1;
    min-width: 200px;
}

.planets-preview {
    flex: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.planet-preview {
    flex: 0 0 calc(33.33% - 10px);
    min-width: 150px;
}

.skybox-preview h4,
.planet-preview h4 {
    color: #4a9dff;
    margin-bottom: 10px;
    text-align: center;
}

.skybox-preview img,
.planet-preview img {
    width: 100%;
    border-radius: 5px;
    border: 1px solid #2c5a8c;
}

.special-btn {
    background: linear-gradient(135deg, #2c5a8c 0%, #4a76a8 100%);
    color: #f0f8ff;
    border: 1px solid #4a9dff;
    box-shadow: 0 0 10px rgba(74, 157, 255, 0.3);
}

.special-btn:hover {
    background: linear-gradient(135deg, #3a6fa8 0%, #5a8bc4 100%);
    box-shadow: 0 0 15px rgba(74, 157, 255, 0.5);
}

/* Mobile optimizations */
@media (max-width: 900px) {
    .modal-content {
        width: 94%;
        border-radius: 10px;
        max-height: 85vh;
        padding-bottom: 100px;
        /* Improved mobile scrolling */
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
    
    .modal-header {
        padding: 16px;
        /* Keep header fixed at the top */
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: #162c43;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .close-btn {
        font-size: 28px;
        padding: 12px;
        min-height: 48px;
        min-width: 48px;
        -webkit-tap-highlight-color: transparent;
    }
    
    .modal-body {
        padding: 16px;
        /* Fix for iOS momentum scrolling */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 150px !important;
    }
    
    .form-group {
        margin-bottom: 24px;
    }
    
    .form-group label {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .form-group input, 
    .form-group textarea,
    .form-group select {
        font-size: 16px !important;
        padding: 14px !important;
        height: auto !important;
        /* Fix for iOS form elements */
        -webkit-appearance: none;
        border-radius: 5px;
    }
    
    /* Prevent text selection on touch */
    .modal-container * {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Allow text selection in input fields */
    .modal-container input,
    .modal-container textarea {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* Fix momentum scrolling */
    .modal-container {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent scroll blocking on modal */
    body.modal-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    /* Make form elements more touch-friendly */
    input, select, textarea, button {
        touch-action: manipulation;
    }
    
    .planet-input {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .planet-input h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .property-row {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 20px;
    }
    
    .property-row label {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .slider {
        width: 100%;
        margin: 10px 0;
        height: 30px !important;
    }
    
    .slider-value {
        margin-top: 5px;
        align-self: flex-end;
    }
    
    /* Better sliders for touch */
    input[type="range"] {
        -webkit-appearance: none;
        height: 30px;
        background: #0d1e2f;
        border-radius: 15px;
        padding: 0;
        outline: none;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: #4a9dff;
        cursor: pointer;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: #4a9dff;
        cursor: pointer;
        border: none;
    }
    
    /* Active slider state */
    .slider-active {
        background: #3a5472 !important;
    }
    
    .remove-planet-btn {
        min-height: 50px;
        padding: 8px 12px;
        font-size: 16px;
        right: 15px;
        top: 15px;
    }
    
    .primary-btn, 
    .secondary-btn, 
    .danger-btn {
        width: 100%;
        margin: 10px 0;
        min-height: 50px;
        font-size: 16px;
        padding: 14px;
    }
    
    .primary-btn {
        min-height: 54px;
        font-size: 18px;
    }
    
    .form-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .form-actions button {
        margin: 8px 0;
    }
    
    /* Preview section adjustments */
    .preview-container {
        flex-direction: column;
    }
    
    .skybox-preview,
    .planets-preview {
        width: 100%;
    }
    
    .skybox-preview {
        margin-bottom: 20px;
    }
    
    .planet-preview {
        flex: 0 0 100%;
        margin-bottom: 15px;
    }
    
    /* Better touch feedback */
    button:active {
        transform: scale(0.95);
    }
    
    /* Custom checkboxes for mobile */
    input[type="checkbox"] {
        transform: scale(1.7);
        margin: 0 15px;
        min-height: 24px;
        min-width: 24px;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 900px) {
        /* Fix for iOS input zooming issue */
        input, select, textarea {
            font-size: 16px !important;
        }
        
        /* Fix for iOS momentum scrolling */
        .modal-content {
            -webkit-overflow-scrolling: touch;
        }
        
        /* Fix for iOS button tap highlight */
        button, input[type="button"] {
            -webkit-tap-highlight-color: transparent;
        }
        
        /* Fix iOS Safe Area issues */
        .modal-content {
            padding-top: env(safe-area-inset-top);
            padding-bottom: calc(100px + env(safe-area-inset-bottom));
        }
        
        /* Fix for iOS rubber-banding */
        .modal-container {
            overscroll-behavior: none;
        }
    }
} 