/* ============================================
   CSS Variables & Design Tokens (Repris du thème global)
   ============================================ */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --accent-glow: rgba(139, 92, 246, 0.4);

    --error: #ef4444;
    --success: #22c55e;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-3xl: 4rem;

    /* Borders & Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    --border-subtle: 1px solid rgba(255, 255, 255, 0.08);

    /* Shadows */
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.lab-app {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

::selection {
    background: var(--accent-primary);
    color: white;
}

/* ============================================
   Lab Container & Header
   ============================================ */
.lab-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.lab-header {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-xl);
}

.lab-hero-icon {
    font-size: 4rem;
    display: inline-block;
    margin-bottom: var(--space-md);
    filter: drop-shadow(0 0 20px var(--accent-glow));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.lab-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
}

.lab-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ============================================
   Upload Zone
   ============================================ */
.hidden-input {
    display: none;
}

.upload-area {
    background: var(--bg-card);
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-bottom: var(--space-xl);
    position: relative;
}

.upload-area:hover {
    border-color: rgba(139, 92, 246, 0.6);
    background: var(--bg-card-hover);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.upload-icon-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.upload-icon-wrap svg {
    width: 40px;
    height: 40px;
    color: var(--accent-secondary);
}

.upload-area h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.upload-limit {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

/* ============================================
   Upload Queue (Progress Bar)
   ============================================ */
.upload-queue {
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    animation: fadeIn var(--transition-normal);
}

.queue-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.queue-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.3s linear;
    border-radius: var(--radius-full);
}

.queue-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Share Panel
   ============================================ */
.share-panel {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    overflow: hidden;
    animation: slideInDown var(--transition-normal);
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.share-panel-title {
    font-weight: 700;
    color: var(--success);
    font-size: 1.1rem;
}

.share-panel-close {
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: color var(--transition-fast);
}

.share-panel-close:hover {
    color: var(--text-primary);
}

.share-links-grid {
    padding: var(--space-lg);
}

.share-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.share-link-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.share-link-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.share-url-text {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 var(--space-xs);
}

.share-copy-btn {
    padding: var(--space-sm) var(--space-md);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.share-copy-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    color: var(--text-primary);
}

/* ============================================
   Gallery
   ============================================ */
.gallery-toolbar {
    display: flex;
    align-items: center;
    border-bottom: var(--border-subtle);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-xl);
}

.gallery-toolbar h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-xl);
    min-height: 200px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
    font-size: 1.1rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: var(--border-subtle);
}

.gallery-item {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-card);
    border: var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(139, 92, 246, 0.3);
}

.gallery-item video,
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: rgba(0,0,0,0.5);
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 40%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-md);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.gallery-item-actions {
    display: flex;
    gap: var(--space-sm);
}

.gallery-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.1rem;
    backdrop-filter: blur(4px);
    transition: background var(--transition-fast);
}

.gallery-item-btn:hover {
    background: rgba(139, 92, 246, 0.5);
}

.gallery-item-type-badge {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(0,0,0,0.6);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.gallery-item-type-badge.image { color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.3); }
.gallery-item-type-badge.video { color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }

/* ============================================
   Copy Toast (généré en JS)
   ============================================ */
.copy-badge {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    z-index: 10000;
    animation: fadeInScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.8) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .lab-container {
        padding: var(--space-md);
    }
    
    .lab-title {
        font-size: 2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--space-md);
    }
}