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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f0 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    color: #ff6b35;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(255, 107, 53, 0.1);
}

header h2 {
    font-size: 1.2rem;
    color: #666;
    font-weight: 400;
}

/* Screen management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Card styles */
.welcome-card,
.question-card,
.result-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.1);
    border: 2px solid #fff0eb;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Welcome screen */
.welcome-card {
    text-align: center;
}

.welcome-card h3 {
    font-size: 2rem;
    color: #ff6b35;
    margin-bottom: 20px;
}

.welcome-card p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.8;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #fff0eb;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.question-counter {
    text-align: center;
    color: #ff6b35;
    font-weight: 600;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* Question styles */
.question-card h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.4;
}

.question-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 15px auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: block;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.answer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 15px 20px;
    margin: 10px 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: auto;
}

/* Adaptation selon le contenu */
.answer-btn:has(.answer-image:not(:empty)) {
    min-height: 180px;
}

.answer-btn:has(.answer-text:not(:empty)) {
    padding: 15px 20px;
}

.answer-btn:has(.answer-image:not(:empty)) .answer-text:not(:empty) {
    margin-top: 5px;
}

/* Boutons avec image seule */
.answer-btn:has(.answer-image:not(:empty)):not(:has(.answer-text:not(:empty))) {
    padding: 20px;
    min-height: 170px;
}

/* Boutons avec texte seul */
.answer-btn:not(:has(.answer-image:not(:empty))):has(.answer-text:not(:empty)) {
    padding: 20px;
    min-height: 60px;
    justify-content: center;
}

.answer-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Effet d'agrandissement pour les réponses sélectionnées avec image */
.answer-btn.selected .answer-image {
    max-width: 400px;
    max-height: 280px;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid #ff6b35;
}

/* Amélioration du style du bouton sélectionné avec image */
.answer-btn.selected {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.25);
    border-color: #ff6b35;
    z-index: 10;
    position: relative;
}

.answer-text {
    font-size: 1rem;
    line-height: 1.3;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.1), transparent);
    transition: left 0.5s ease;
}

.answer-btn:hover {
    border-color: #ff6b35;
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.2);
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn.selected {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    border-color: #ff6b35;
    transform: scale(1.02);
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: #ff6b35;
    border: 2px solid #ff6b35;
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    min-width: 150px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.btn-secondary:hover:not(:disabled) {
    background: #ff6b35;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(-1px);
}

#restart-btn {
    margin-top: 30px;
}

/* Result screen */
.result-card {
    text-align: center;
}

.result-card h3 {
    color: #ff6b35;
    margin-bottom: 30px;
}

/* Cartes de résultats dépliantes */
.result-metier {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.result-metier.best-result {
    background: linear-gradient(135deg, #fff9f7 0%, #fff5f0 100%);
    border-color: #ff6b35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.15);
    position: relative;
}

.result-metier.best-result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
}

.result-header {
    display: flex;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    gap: 15px;
    transition: background-color 0.3s ease;
}

.result-header:hover {
    background-color: rgba(255, 107, 53, 0.05);
}

.result-metier.best-result .result-header:hover {
    background-color: rgba(255, 107, 53, 0.1);
}

.result-rank {
    width: 40px;
    height: 40px;
    background: #ff6b35;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.result-metier.best-result .result-rank {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.result-title {
    flex: 1;
    text-align: left;
}

.best-badge-compact {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b35, #ff8f65);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 10px;
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.2);
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.best-result .result-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.result-title h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.3rem;
}

.result-metier.best-result .result-title h4 {
    color: #ff6b35;
    font-weight: 700;
}

.match-score {
    color: #ff6b35;
    font-weight: 600;
    font-size: 1rem;
}

.expand-icon {
    color: #ff6b35;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.result-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.3s ease;
    padding: 0 20px;
}

.result-content.expanded {
    max-height: none;
    height: auto;
    padding: 0 20px 20px 20px;
}

.result-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
}

.result-info {
    color: #555;
    margin-bottom: 10px;
    text-align: left;
}

.result-competences {
    margin: 15px 0;
    text-align: left;
}

.result-competences h5 {
    color: #ff6b35;
    margin-bottom: 10px;
}

.competences-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.competence-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.result-link {
    margin-top: 15px;
    text-align: left;
}

.result-link a {
    color: #ff6b35;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.result-link a:hover {
    color: #ff8c42;
    text-decoration: underline;
}

.best-badge {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* Profil de personnalité */
.profile-summary {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 15px;
    border: 2px solid #e0e0e0;
}

.profile-summary h4 {
    color: #ff6b35;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.profile-item {
    background: white;
    padding: 10px 8px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.1);
}

.profile-label {
    font-weight: 600;
    color: #ff6b35;
    font-size: 0.8rem;
    margin-bottom: 3px;
    line-height: 1.2;
}

.profile-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.navigation-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

/* Tags correspondants */
.result-tags {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
}

.result-tags h5 {
    margin: 0 0 10px 0;
    color: #ff6b35;
    font-size: 0.95rem;
    font-weight: 600;
}

.tag-category {
    margin-bottom: 12px;
}

.tag-category:last-child {
    margin-bottom: 0;
}

.tag-category strong {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.85rem;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-match {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.environement-tag {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.technical-tag {
    background: linear-gradient(135deg, #007bff, #6610f2);
}

.interest-tag {
    background: linear-gradient(135deg, #ff6b35, #ffc107);
}

/* Navigation buttons */
.nav-btn {
    border: 2px solid #ff6b35;
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.nav-btn:hover {
    background: #ff6b35;
    color: white;
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .answer-image {
        max-width: 250px;
        max-height: 180px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)) {
        min-height: 160px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)):not(:has(.answer-text:not(:empty))) {
        min-height: 150px;
    }
    
    .profile-summary {
        padding: 15px;
    }
    
    .profile-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .profile-item {
        padding: 8px 6px;
    }
    
    .profile-label {
        font-size: 0.75rem;
    }
    
    .profile-value {
        font-size: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header h2 {
        font-size: 1rem;
    }
    
    .welcome-card,
    .question-card,
    .result-card {
        padding: 25px;
    }
    
    .welcome-card h3,
    .result-card h3 {
        font-size: 1.5rem;
    }
    
    .question-card h3 {
        font-size: 1.3rem;
    }
    
    .answer-btn {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    .btn-primary {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .metier-icon {
        font-size: 3rem;
    }
    
    .metier-nom {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .answer-image {
        max-width: 200px;
        max-height: 150px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)) {
        min-height: 140px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)):not(:has(.answer-text:not(:empty))) {
        min-height: 130px;
    }
    
    .profile-summary {
        padding: 12px;
        margin-top: 20px;
    }
    
    .profile-summary h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .profile-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 4px;
    }
    
    .profile-item {
        padding: 6px 4px;
        border-radius: 6px;
    }
    
    .profile-label {
        font-size: 0.7rem;
        margin-bottom: 2px;
        line-height: 1.1;
    }
    
    .profile-value {
        font-size: 0.9rem;
    }
    
    .question-card,
    .result-card {
        padding: 20px;
    }
    
    .navigation-buttons {
        flex-direction: column;
    }
    
    .competences-list {
        flex-direction: column;
        align-items: center;
    }
    
    .competence-tag {
        width: 100%;
        text-align: center;
    }
}

@media (min-width: 1200px) {
    .answer-image {
        max-width: 400px;
        max-height: 250px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)) {
        min-height: 200px;
    }
    
    .answer-btn:has(.answer-image:not(:empty)):not(:has(.answer-text:not(:empty))) {
        min-height: 190px;
    }
}
