/* Variables CSS pour harmonisation avec la page principale */
:root {
    --primary-color: #4caf50;
    --secondary-color: #ff4c4c;
    --highlight-color: #2196f3;
    --background-color: #f4f4f4;
    --button-color: #94a595;
    --button-hover-color: #66bb6a;
    --font-color: #333;
    --border-radius: 15px;
    --padding: 10px;
    --font-size: 16px;
    --heading-font: 'Poppins', sans-serif;
    --body-font: 'Open Sans', sans-serif;
}

/* Styles de base */
body {
    font-family: var(--body-font);
    background-color: var(--background-color);
    color: var(--font-color);
    overflow-y: auto;
}

body::-webkit-scrollbar,
.category::-webkit-scrollbar,
#definition-container::-webkit-scrollbar {
    width: 6px;
}

body::-webkit-scrollbar-thumb,
.category::-webkit-scrollbar-thumb,
#definition-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

header {
    background: linear-gradient(135deg, #42a5f5, #2196f3, #1976d2);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
}

h1 {
    font-family: var(--heading-font);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(33, 150, 243, 0.9), 0 0 20px rgba(33, 150, 243, 0.6);
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

h1:hover {
    transform: scale(1.05);
    text-shadow: 0 0 16px rgba(33, 150, 243, 1), 0 0 24px rgba(33, 150, 243, 0.8);
}

header p {
    font-family: var(--body-font);
    font-size: 1.2rem;
    margin: 0;
    color: #e1f5fe;
    text-shadow: 0 0 5px rgba(33, 150, 243, 0.4);
}

/* Conteneur principal */
.container {
    max-width: 1200px;
    padding: var(--padding);
}

/* Images */
.text-center img {
    max-width: 100%;
    height: auto;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
}

/* Catégories */
.category {
    background-color: white;
    padding: var(--padding);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.category h2 {
    font-family: var(--heading-font);
    color: #ff7f50;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    padding-bottom: 0.3rem;
}

.category h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #ff7f50;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.category h2:hover::after {
    width: 80px;
}

/* Mots sélectionnables */
.selectable {
    display: block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    cursor: pointer;
    border-radius: 5px;
    font-size: var(--font-size);
    transition: background-color 0.3s ease, transform 0.2s ease-in-out, box-shadow 0.2s ease;
    text-align: center;
}

.selectable:hover {
    background-color: var(--button-hover-color);
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

.selectable.selected {
    background-color: #ff7f50;
    color: white;
    font-weight: bold;
}

/* Boutons */
.btn {
    font-size: var(--font-size);
    padding: 0.5rem 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease-in-out, box-shadow 0.2s ease;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.btn-success {
    background-color: var(--primary-color);
    border: none;
}

.btn-success:hover {
    background-color: var(--button-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

.btn-danger {
    background-color: var(--secondary-color);
    border: none;
}

.btn-danger:hover {
    background-color: #ff3333;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

.btn-primary {
    background-color: var(--highlight-color);
    border: none;
}

.btn-primary:hover {
    background-color: #1e88e5;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.4);
}

/* Panneau de définition */
#definition-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    max-height: 80vh;
    background-color: white;
    border: 3px solid var(--highlight-color);
    padding: var(--padding);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    border-radius: var(--border-radius);
    z-index: 1000;
    flex-direction: column;
    gap: 15px;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

#definition-container::-webkit-scrollbar {
    width: 6px;
}

#definition-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#definition-container h2 {
    font-family: var(--heading-font);
    color: var(--highlight-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
}

#definition-container p {
    font-family: var(--body-font);
    color: var(--font-color);
    font-size: var(--font-size);
    line-height: 1.6;
    text-align: center;
}

#close-definition {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s ease, transform 0.2s ease;
    touch-action: manipulation;
    z-index: 1100;
}

#close-definition:hover {
    color: #ff3333;
    transform: rotate(90deg);
}

/* Suppression du texte "Fermer" */
#definition-container #close-definition::after {
    content: none !important;
    display: none !important;
}

#definition-image-container,
#definition-audio-container,
#definition-video-container {
    margin-top: 1rem;
}

#definition-image {
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

#definition-video-container {
    flex-grow: 1;
    min-height: 200px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#definition-video {
    max-width: 100%;
    max-height: 100%;
}

#definition-video-container,
#definition-image-container,
#definition-audio-container {
    display: none;
}

/* Mini-player */
.mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8f9fa;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mini-player .form-range {
    width: 200px;
    margin: 0 10px;
}

.mini-player button {
    padding: 5px 10px;
    border-radius: 5px;
}

.mini-player span {
    font-size: 0.9em;
    color: var(--font-color);
}

/* Animations */
.recording-indicator {
    color: var(--secondary-color);
    font-weight: bold;
    animation: blink 1s infinite;
}

.recording-confirmation {
    color: var(--primary-color);
    font-weight: bold;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes slideIn {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    .recording-indicator,
    .recording-confirmation,
    #definition-container {
        animation: none;
        opacity: 1;
    }
    .selectable,
    .btn,
    h1,
    .category,
    #close-definition {
        transition: none;
        transform: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    header p {
        font-size: 1rem;
    }
    .container {
        padding: 15px;
    }
    .category h2 {
        font-size: 1.5rem;
    }
    #definition-container {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 10px 0;
        box-shadow: none;
        border: 3px solid var(--highlight-color);
        animation: slideIn 0.3s ease-in-out;
    }
    .selectable {
        margin-bottom: 5px;
        font-size: var(--font-size);
        padding: 0.4rem 0.8rem;
    }
    .mini-player {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 20px;
    }
    .text-center img {
        margin-bottom: 1rem;
    }
    #definition-container {
        position: static;
        width: 100%;
        max-height: none;
        margin-bottom: 1.5rem;
    }
}