/**
 * MivKit Tools - Ultra Modern Theme
 * French Edition - 2025
 * 
 * Design System: Glassmorphism + Gradient Accents
 * Optimized for AdSense compliance with rich content layout
 */

/* ============================================
   CSS Variables - Modern Color Palette
   ============================================ */
:root {
    /* Primary Colors - Deep Space Theme */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --bg-card: rgba(26, 35, 50, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    /* Accent Colors - Vibrant Gradients */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a855f7;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --accent-info: #3b82f6;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #a5b4fc;
    
    /* Gradient Definitions */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-card: linear-gradient(145deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    
    /* Borders & Shadows */
    --border-subtle: rgba(148, 163, 184, 0.1);
    --border-accent: rgba(99, 102, 241, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ============================================
   Base Styles & Reset
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        var(--gradient-glow),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg) 0;
}

/* ============================================
   Container & Layout
   ============================================ */
.tool-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ============================================
   Tool Header Section
   ============================================ */
.tool-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl) 0;
}

.tool-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.tool-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* ============================================
   Workspace Layout - Three Panel Design
   ============================================ */
.workspace {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    min-height: 500px;
}

/* Editor Panels */
.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.editor-panel:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-md);
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.panel-title .icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Panel Body */
.panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* Status Bar */
.panel-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.status-valid {
    color: var(--accent-success);
}

.status-error {
    color: var(--accent-error);
}

/* ============================================
   Control Panel (Center)
   ============================================ */
.control-panel {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.control-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.control-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-sm) 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--border-accent);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-sm);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
}

/* ============================================
   Form Controls
   ============================================ */
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    padding-right: 2.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: all var(--transition-fast);
}

.form-select:hover,
.form-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

/* ============================================
   ACE Editor Customization
   ============================================ */
.ace_editor {
    flex: 1;
    min-height: 350px;
    font-size: 14px !important;
    background: var(--bg-secondary) !important;
}

.ace_editor .ace_gutter {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted);
}

.ace_editor .ace_print-margin {
    display: none;
}

.ace_editor .ace_cursor {
    color: var(--accent-primary);
}

.ace_editor .ace_marker-layer .ace_selection {
    background: rgba(99, 102, 241, 0.3);
}

/* ============================================
   Content Sections
   ============================================ */
.content-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.section-header:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.08) 100%);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-header .toggle-icon {
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: var(--space-xl);
}

/* ============================================
   Guide Section Styling
   ============================================ */
.guide-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.guide-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-xl) 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.guide-content h3:first-child {
    margin-top: 0;
}

.guide-content p {
    margin-bottom: var(--space-md);
}

.guide-content ul, 
.guide-content ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.guide-content li {
    margin-bottom: var(--space-sm);
}

.guide-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.guide-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    color: var(--accent-tertiary);
}

.guide-content a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.guide-content a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Step List */
.step-list {
    counter-reset: step;
    list-style: none;
    margin-left: 0;
}

.step-list li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: var(--space-lg);
}

.step-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-lg) 0;
}

.feature-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

.feature-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.feature-card h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.faq-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.faq-item:hover {
    border-color: var(--border-accent);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.faq-question:hover {
    background: var(--bg-glass);
}

.faq-question h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding-right: var(--space-md);
}

.faq-question .faq-icon {
    color: var(--accent-primary);
    transition: transform var(--transition-normal);
    flex-shrink: 0;
}

.faq-item.active .faq-question .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.faq-item.active .faq-answer {
    max-height: 1000px;
}

.faq-answer-content {
    padding: 0 var(--space-lg) var(--space-lg);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .workspace {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .control-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: var(--space-md);
    }
    
    .control-section {
        flex: 1 1 auto;
        min-width: 150px;
    }
    
    .control-divider {
        display: none;
    }
    
    .btn-full {
        width: auto;
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 0 var(--space-md);
    }
    
    .tool-header h1 {
        font-size: 1.5rem;
    }
    
    .panel-header {
        flex-wrap: wrap;
        padding: var(--space-sm) var(--space-md);
    }
    
    .panel-body {
        min-height: 300px;
    }
    
    .ace_editor {
        min-height: 250px;
        font-size: 12px !important;
    }
    
    .section-content {
        padding: var(--space-lg);
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: var(--space-md) 0;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .control-section {
        width: 100%;
    }
    
    .faq-question h4 {
        font-size: 0.95rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-success); }
.text-error { color: var(--accent-error); }
.text-warning { color: var(--accent-warning); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Copy Success Feedback */
.copy-success {
    position: relative;
}

.copy-success::after {
    content: 'Copié !';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-success);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    animation: fadeIn 0.2s ease-out;
}
