@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --background: #0f172a;
    --background-secondary: #1e293b;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --shadow: rgba(0, 0, 0, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --neutral: #6b7280;
    --axis-x: #ff0000;
    --axis-y: #00ff00;
    --axis-z: #0000ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--background-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Animated background */
html,
body {
  width: 100%;
  height: 100%;
}

body {
  background-image: radial-gradient(#021027, #000000);
}

.container {
  width: 100%;
  height: 100%;
}

/* Particle animations */
.circle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 5px;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

.circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    mix-blend-mode: screen;
    background-image: radial-gradient(
        hsl(180, 19%, 48%),
        hsla(180, 11%, 33%, 0.534) 10%,
        hsla(180, 25%, 55%, 0) 56%
    );
    animation: fade-frames 400ms infinite, scale-frames 2s infinite;
}

@keyframes fade-frames {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes scale-frames {
    0% { transform: scale3d(0.4, 0.4, 1); }
    50% { transform: scale3d(2.2, 2.2, 1); }
    100% { transform: scale3d(0.4, 0.4, 1); }
}

.circle-container:nth-child(1) {
    width: 8px;
    height: 8px;
    animation: move-frames-1 9000ms infinite;
    animation-delay: 1000ms;
}
.circle-container:nth-child(1) .circle {
    animation-delay: 500ms;
}
@keyframes move-frames-1 {
    from { transform: translate3d(20vw, 110vh, 0); }
    to { transform: translate3d(80vw, -20vh, 0); }
}

.circle-container:nth-child(2) {
    width: 6px;
    height: 6px;
    animation: move-frames-2 8000ms infinite;
    animation-delay: 2000ms;
}
.circle-container:nth-child(2) .circle {
    animation-delay: 1000ms;
}
@keyframes move-frames-2 {
    from { transform: translate3d(40vw, 120vh, 0); }
    to { transform: translate3d(60vw, -30vh, 0); }
}

.circle-container:nth-child(3) {
    width: 10px;
    height: 10px;
    animation: move-frames-3 10000ms infinite;
    animation-delay: 3000ms;
}
.circle-container:nth-child(3) .circle {
    animation-delay: 1500ms;
}
@keyframes move-frames-3 {
    from { transform: translate3d(60vw, 100vh, 0); }
    to { transform: translate3d(20vw, -10vh, 0); }
}

/* Glass interface */
#interface {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 360px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 
        0 8px 32px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#interface:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 20px 40px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* File input styling */
#modelInput {
    width: 100%;
    padding: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

#modelInput:hover {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.05);
}

#modelInput::file-selector-button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    margin-right: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#modelInput::file-selector-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Modern buttons */
.btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

.btn:disabled:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    transform: none;
    box-shadow: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover:not(:disabled) {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

/* Primary button variant */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

/* Button groups */
.btn-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-group .btn {
    flex: 1;
    min-width: 0;
}

.btn-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-row .btn {
    padding: 10px 12px;
    font-size: 13px;
    min-width: 44px;
}

/* Icon buttons for rotations */
.btn-icon {
    width: 44px;
    padding: 10px;
    font-family: monospace;
    font-weight: bold;
    background: var(--glass-bg);
}

.btn-icon:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: white;
}

canvas {
    background: transparent !important;
    pointer-events: auto !important;
}

#rotateX:hover:not(:disabled) {
    color: var(--axis-x);
}

#rotateY:hover:not(:disabled) {
    color: var(--axis-y);
}

#rotateZ:hover:not(:disabled) {
    color: var(--axis-z);
}

/* Voxel controls */
#voxelSlider {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#voxelSlider:not(.hidden) {
    opacity: 1;
    max-height: 300px;
    margin-bottom: 16px;
}

.control-group {
    margin-bottom: 16px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

/* Range slider */
#voxelRes {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    margin-bottom: 8px;
}

#voxelRes::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

#voxelRes::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

#voxelRes::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

#voxelResValue {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Color picker */
#voxelColor {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px;
    background: transparent;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

#voxelColor:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

#voxelColor::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

#voxelColor::-moz-color-swatch {
    border: none;
    border-radius: 8px;
}

/* Status messages */
.status-message {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid;
    display: flex;
    flex-direction: column; /* Changed to column for vertical stack */
    align-items: center;
    gap: 8px; /* Space between logo and status content */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.status-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.status-message.hidden {
    display: none;
}

#progress {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 280px;
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    z-index: 100;
}

#progress::before {
    content: '◐';
    animation: spin 2s linear infinite;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.3s ease-in-out;
}

#error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

#error::before {
    content: '⚠';
}

#modelStatus {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 200px;
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.3);
    color: var(--neutral);
    opacity: 1;
    transform: translateY(0);
    z-index: 100;
    display: flex;
    flex-direction: column; /* Empile le logo et le contenu verticalement */
    align-items: flex-start; /* Aligne à gauche */
    padding: 12px;
    border-radius: 12px;
}

#modelStatus.loading {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent);
}

#modelStatus.loading .status-symbol {
    animation: spin 1s linear infinite; /* Applique l'animation uniquement pour l'état loading */
}

#modelStatus.loaded {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

#modelStatus .logo-container {
    margin-bottom: 4px; /* Petit espace entre le logo et le contenu */
}

#modelStatus .status-content {
    display: flex;
    align-items: center; /* Aligne le symbole et le texte verticalement */
    gap: 8px; /* Espace entre le symbole et le texte */
    width: 100%; /* Utilise toute la largeur disponible */
}

#modelStatus .status-symbol {
    font-size: 16px;
    line-height: 1;
}

#modelStatus::before {
    content: none !important; /* Force la suppression du contenu du pseudo-élément */
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    width: 100%;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 280px;
    background: var(--background-secondary);
    color: var(--text-secondary);
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    left: 100%;
    top: 50%;
    margin-left: 10px;
    margin-top: -50px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--background-secondary) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsive design */
@media (max-width: 480px) {
    #interface {
        left: 16px;
        right: 16px;
        width: auto;
        padding: 20px;
    }
    
    #progress, #modelStatus {
        right: 16px;
        width: 200px;
    }
    
    .btn-row {
        flex-wrap: wrap;
    }
    
    .btn-row .btn {
        min-width: 60px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles */
.btn:focus,
#voxelRes:focus,
#voxelColor:focus,
#modelInput:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}