/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: 10px;
    width: 100%;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Header */
header {
    text-align: center;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

header h1 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.subtitle {
    font-size: 1.2em;
    color: #764ba2;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 0 10px;
}

.nav-btn {
    padding: 12px 20px;
    font-size: 1em;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 100px;
    max-width: 200px;
}

.nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Sections */
.content-section {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 1.8em;
    color: #667eea;
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.controls select {
    padding: 10px 12px;
    border: 2px solid #667eea;
    border-radius: 15px;
    font-size: 0.9em;
    font-family: inherit;
    background: white;
    cursor: pointer;
    flex: 1;
    min-width: 120px;
}

.custom-theme-input {
    padding: 10px 12px;
    border: 2px solid #667eea;
    border-radius: 15px;
    font-size: 0.9em;
    font-family: inherit;
    background: white;
    flex: 1;
    min-width: 120px;
    outline: none;
    transition: border-color 0.3s ease;
}

.custom-theme-input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-theme-input::placeholder {
    color: #999;
    font-style: italic;
}

.btn-generate {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 0.9em;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
    white-space: nowrap;
}

.btn-generate:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Devinettes */
.devinette-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.devinette-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.devinette-question {
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: bold;
    line-height: 1.4;
}

.devinette-answer {
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
    display: none;
    line-height: 1.5;
}

.devinette-answer.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-show-answer {
    padding: 12px 25px;
    background: white;
    color: #f5576c;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-show-answer:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Coloriages */
.coloriages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.coloriage-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.coloriage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.coloriage-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
}

.coloriage-info {
    padding: 15px;
}

.coloriage-title {
    font-size: 1.2em;
    color: #667eea;
    margin-bottom: 10px;
}

.coloriage-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-direction: column;
}

.btn-download, .btn-print {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download {
    background: #4ecdc4;
    color: white;
}

.btn-print {
    background: #ffd93d;
    color: #333;
}

.btn-download:hover, .btn-print:hover {
    transform: scale(1.05);
}

/* Blagues */
.blagues-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.blague-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.blague-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.blague-text {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 15px;
}

.blague-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 15px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px 20px;
    font-size: 1.2em;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    margin: 20px 0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-right-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 25px;
    flex-shrink: 0;
    display: block;
}

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

.loading small {
    display: block;
    margin-top: 10px;
    font-size: 0.8em;
    opacity: 0.8;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 15px;
    color: white;
    margin-top: 30px;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 15px 10px;
        border-radius: 15px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .main-nav {
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .nav-btn {
        padding: 10px 15px;
        font-size: 0.9em;
        min-width: 90px;
    }
    
    .content-section {
        padding: 15px;
        border-radius: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .section-header h2 {
        font-size: 1.5em;
        text-align: center;
    }
    
    .controls {
        width: 100%;
        flex-direction: column;
    }
    
    .controls select,
    .controls input,
    .btn-generate {
        width: 100%;
        min-width: 100%;
    }
    
    .coloriages-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .coloriage-image {
        height: 250px;
    }
    
    .coloriage-actions {
        flex-direction: row;
    }
    
    .btn-download, .btn-print {
        flex: 1;
    }
    
    .devinette-card {
        padding: 20px;
    }
    
    .devinette-question {
        font-size: 1.3em;
    }
    
    .devinette-answer {
        font-size: 1.1em;
    }
    
    .blague-card {
        padding: 15px;
    }
    
    .blague-text {
        font-size: 1.1em;
    }
    
    .blague-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .loading {
        padding: 30px 15px;
        font-size: 1em;
        min-height: 150px;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
        border-width: 5px;
        margin-bottom: 20px;
    }
    
    footer {
        padding: 15px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.85em;
        min-width: 80px;
    }
    
    .section-header h2 {
        font-size: 1.3em;
    }
    
    .devinette-question {
        font-size: 1.2em;
    }
    
    .devinette-answer {
        font-size: 1em;
    }
    
    .blague-text {
        font-size: 1em;
    }
    
    .coloriage-title {
        font-size: 1em;
    }
}

