/* Styles spécifiques pour la page de code Python */

.code-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc, #e0f2fe);
    padding-top: 100px;
}

.code-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.code-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.code-header p {
    font-size: 1.25rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.code-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.copy-btn, .download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.copy-btn {
    background: #3b82f6;
    color: white;
}

.copy-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.download-btn {
    background: #10b981;
    color: white;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.code-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.code-section {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.code-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc, #e0f2fe);
    border-bottom: 1px solid #e5e7eb;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.section-header svg {
    color: #3b82f6;
}

.copy-section-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.copy-section-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.code-block {
    position: relative;
    overflow: hidden;
}

.code-block pre {
    margin: 0;
    padding: 2rem;
    background: #1e293b;
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block code {
    font-family: inherit;
}

/* Syntax highlighting */
.language-python .token.comment {
    color: #64748b;
    font-style: italic;
}

.language-python .token.string {
    color: #22d3ee;
}

.language-python .token.keyword {
    color: #f472b6;
    font-weight: 600;
}

.language-python .token.function {
    color: #fbbf24;
}

.language-python .token.number {
    color: #34d399;
}

.language-python .token.operator {
    color: #f87171;
}

.language-python .token.builtin {
    color: #a78bfa;
}

/* Custom syntax highlighting for Python */
.code-block pre code {
    color: #e2e8f0;
}

/* Keywords */
.code-block pre code .keyword {
    color: #f472b6;
    font-weight: 600;
}

/* Strings */
.code-block pre code .string {
    color: #22d3ee;
}

/* Comments */
.code-block pre code .comment {
    color: #64748b;
    font-style: italic;
}

/* Functions */
.code-block pre code .function {
    color: #fbbf24;
}

/* Numbers */
.code-block pre code .number {
    color: #34d399;
}

/* Copy success message */
.copy-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.copy-success.show {
    transform: translateX(0);
}

/* Responsive design */
@media (max-width: 768px) {
    .code-page {
        padding-top: 80px;
    }

    .code-header {
        margin: 0 1rem 2rem;
        padding: 1.5rem;
    }

    .code-header h1 {
        font-size: 2rem;
    }

    .code-header p {
        font-size: 1rem;
    }

    .code-actions {
        flex-direction: column;
        align-items: center;
    }

    .copy-btn, .download-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .code-sections {
        margin: 0 1rem;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    .section-header h2 {
        font-size: 1.125rem;
    }

    .code-block pre {
        padding: 1rem;
        font-size: 0.8rem;
    }

    .copy-success {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }

    .copy-success.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .code-header h1 {
        font-size: 1.75rem;
    }

    .section-header h2 {
        font-size: 1rem;
        flex-direction: column;
        gap: 8px;
    }

    .code-block pre {
        font-size: 0.75rem;
        padding: 0.75rem;
    }
}

/* Scrollbar styling for code blocks */
.code-block pre::-webkit-scrollbar {
    height: 8px;
}

.code-block pre::-webkit-scrollbar-track {
    background: #334155;
    border-radius: 4px;
}

.code-block pre::-webkit-scrollbar-thumb {
    background: #64748b;
    border-radius: 4px;
}

.code-block pre::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for sections */
.code-section {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading animation for copy buttons */
.copy-section-btn.copying {
    background: #6b7280;
    cursor: not-allowed;
}

.copy-section-btn.copying::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 4px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}