/* Modern CSS for 3D Model Generator */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* Three.js container - Full screen background */
#three-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #111827 !important;
    z-index: 1 !important;
    overflow: hidden !important;
}

/* Three.js canvas - Full screen */
#three-container canvas {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

/* Viewer placeholder */
#viewer-placeholder {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* When placeholder is hidden, ensure it's completely out of the way */
#viewer-placeholder[style*="display: none"] {
    z-index: -1 !important;
    pointer-events: none !important;
}

/* Custom loading animation for the generate button */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Console output placeholder text */
#output:empty::before {
    content: "Output will appear here...";
    color: #6b7280;
    font-style: italic;
    opacity: 0.7;
}

/* Smooth scrollbar for console output */
#output::-webkit-scrollbar {
    width: 4px;
}

#output::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 2px;
}

#output::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 2px;
}

#output::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile sidebar styles */
@media (max-width: 1023px) {
    .sidebar-mobile {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar-mobile.open {
        transform: translateX(0);
    }
    
    /* Adjust sidebar width on mobile */
    .mobile-sidebar {
        width: calc(100vw - 2rem);
        max-width: 320px;
    }
}

/* Enhanced focus states for accessibility */
.parameter-group input:focus {
    outline: none;
}

/* Smooth transitions for hover effects */
button {
    transition: all 0.2s ease-in-out;
}

/* Custom backdrop blur effect for better browser support */
.backdrop-blur-sm {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.backdrop-blur-xl {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* Ensure proper z-index stacking */
.floating-sidebar {
    z-index: 100;
}

.three-container {
    z-index: 1;
}

.status-bar {
    z-index: 101;
}

/* Animation for sidebar entrance */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in {
    animation: slideInLeft 0.4s ease-out;
}

/* Custom gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Hide scrollbar in the main parameters area while keeping scroll functionality */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive text sizing */
@media (max-width: 640px) {
    .text-6xl {
        font-size: 3rem;
    }
    
    .text-xl {
        font-size: 1.125rem;
    }
}

/* Glass morphism effect for sidebar */
.glass-morphism {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading state for inputs */
.parameter-group input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* Enhanced button press effect */
button:active {
    transform: scale(0.98);
}

/* Generate button consistent sizing */
#run-code {
    min-width: 180px; /* Prevent button resize during loading */
}

#run-code .loading-spinner {
    vertical-align: middle;
}

/* Floating effect for sidebar */
.floating-effect {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Status indicator animations */
.status-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Error and success state colors */
.status-error {
    color: #ef4444;
}

.status-success {
    color: #22c55e;
}

/* Smooth resize transitions */
* {
    box-sizing: border-box;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-white\/95 {
        background: rgba(255, 255, 255, 1);
    }
    
    .text-gray-400 {
        color: #6b7280;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .animate-slide-in,
    .animate-pulse,
    .loading::after {
        animation: none;
    }
    
    button:hover {
        transform: none;
    }
}

/* Force full screen layout */
body {
    background: #111827 !important;
    overflow: hidden !important;
}

/* Prevent any default Tailwind or browser styles from interfering */
.fixed.inset-0 {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
}

/* Ensure sidebar doesn't interfere with 3D container */
.sidebar {
    pointer-events: auto;
}

#three-container {
    pointer-events: auto;
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    .fixed.left-3.top-3.bottom-3 {
        left: 0.5rem;
        top: 0.5rem;
        bottom: 0.5rem;
        width: calc(100vw - 1rem);
        max-width: 280px;
    }
}

/* Console tab styles */
.console-tab {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.console-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.console-tab.active {
    background: rgba(59, 130, 246, 0.3);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.5);
}

.console-content {
    display: block;
}

.console-content.hidden {
    display: none !important;
}

/* Console-specific styling */
#js-output:empty::before {
    content: "JavaScript output will appear here...";
    color: #6b7280;
    font-style: italic;
    opacity: 0.7;
}

#python-output:empty::before {
    content: "Python output will appear here...";
    color: #6b7280;
    font-style: italic;
    opacity: 0.7;
}

/* Smooth scrollbar for both consoles */
#js-output::-webkit-scrollbar,
#python-output::-webkit-scrollbar {
    width: 4px;
}

#js-output::-webkit-scrollbar-track,
#python-output::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 2px;
}

#js-output::-webkit-scrollbar-thumb,
#python-output::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 2px;
}

#js-output::-webkit-scrollbar-thumb:hover,
#python-output::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}