/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 50px auto;
    padding: 30px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    color: #34495e;
    margin-bottom: 15px;
}

h3 {
    color: #555;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Participant ID Display */
.participant-id-display {
    background-color: #f0f8ff;
    border: 2px solid #2196F3;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2196F3;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
    margin: 0.5rem 0;
}

.help-text {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-top: 0.5rem;
}

.instruction {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Button Styles */
.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-primary:active {
    transform: translateY(1px);
}

/* BIF Questionnaire Styles */
.bif-question {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.bif-question .behavior {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.bif-question .options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bif-question .options label {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.bif-question .options label:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.bif-question .options input[type="radio"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.bif-question .options label:has(input:checked) {
    border-color: #3498db;
    background: #e3f2fd;
    font-weight: 600;
}
blockquote {
    margin-left: 40px;
    padding-left: 20px;
    border-left: 3px solid #ddd;
    color: #555;
}

blockquote ul {
    list-style-type: none;
}

/* Experiment Styles */
#jspsych-target {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #808080;
}

.welcome {
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 10px;
    max-width: 600px;
}

.welcome h1 {
    color: #2c3e50;
    margin-bottom: 30px;
}

.welcome p {
    font-size: 18px;
    margin-bottom: 15px;
    color: #555;
}

.completion-message {
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 10px;
}

.completion-message h2 {
    color: #27ae60;
    margin-bottom: 20px;
}

/* Preimages */
.preimage-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 600px;
    background-color: #808080;
}

/* Grid Styles */
.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    background-color: #808080;
    padding: 20px;
}

.question-text {
    font-size: 24px;
    color: white;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 5px;
    background-color: #fbfbfbc5;
    padding: 20px;
    border-radius: 10px;
    max-width: 80vw;
    margin: 0 auto;
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.grid-cell:not(.empty) {
    cursor: pointer;
}

.grid-cell:not(.empty):hover {
    background-color: #e3f2fd;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.grid-cell.selected {
    border: 3px solid #4CAF50 !important;
    background-color: #e8f5e9;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.grid-cell.empty {
    opacity: 0.3;
}

.grid-cell img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Fixation cross */
.fixation {
    font-size: 72px;
    color: white;
    text-align: center;
}

/* Video container */
video {
    max-width: 100%;
    max-height: 80vh;
    background-color: black;
}

/* ==================== GRILLE DE SÉLECTION ==================== */
:root {
    /* Variables modifiables pour ajuster la grille */
    --cell-size: 6vw;
    --cell-gap: 0.15vh;
    --spacer-width: 1.8vw;
    --quadrant-gap-h: 2vw;
    --quadrant-gap-v: 0.8vh;
    --row-offset: 3vw;
    --separator-color: #575757;
    --separator-width: 1px;
    --sprite-scale-large: 1.08;
    --sprite-scale-small: 0.68;
}

.grid-wrapper {
    width: 100vw;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 1vh;
    overflow: hidden;
    box-sizing: border-box;
    padding: 2vh 2vw 6vh 2vw;
}

.grid-title {
    margin: 0 0 0.5vh 0;
    font-weight: bold;
    font-size: clamp(1rem, 2vw, 1.5rem);
}

.grid-instruction {
    text-align: center;
    margin: 0 0 2vh 0;
    color: #666;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.grid-container {
    position: relative;
    display: inline-block;
    width: fit-content;
    height: fit-content;
    min-height: 0;
    padding: 20px;
    background: #808080;
    border-radius: 10px;
}

.grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    gap: 0;
    padding: 0;
    margin: 0;
    max-width: none;
    background: #fbfbfbc5;
    border-radius: 10px;
}

.grid-row {
    display: flex;
    align-items: center;
}



/* Espace supplémentaire entre lignes 1 et 2 (quadrants verticaux) 
.grid-row[data-row="1"] {
    margin-bottom: calc(var(--cell-gap) + var(--quadrant-gap-v));
}*/

.grid-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    flex-shrink: 0;
    border: 2px solid transparent;
    padding: 0.5vh;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.grid-cell:hover {
    opacity: 0.8;
}

.grid-cell.selected {
    border: 4px solid #4CAF50 !important;
    background: #d4edda !important;
}

.grid-cell img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
    transform-origin: center center;
}

.grid-cell.large img {
    max-width: 100%;
    max-height: 100%;
    transform: scale(var(--sprite-scale-large));
}

.grid-cell.small img {
    max-width: 100%;
    max-height: 100%;
    transform: scale(var(--sprite-scale-small));
}

.grid-spacer {
    width: var(--spacer-width);
    height: var(--cell-size);
    flex-shrink: 0;
}

/* Espace supplémentaire entre colonnes 2 et 3 (quadrants horizontaux) */
.grid-spacer.quadrant-spacer {
    width: calc(var(--spacer-width) + var(--quadrant-gap-h));
}

/* Séparateurs (croix entre quadrants) */
.separator-h {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--separator-width);
    background: var(--separator-color);
    pointer-events: none;
    z-index: 10;
}

.separator-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: var(--separator-width);
    background: var(--separator-color);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 20px;
        padding: 20px;
    }
    
    :root {
        --cell-size: 8vw;
        --cell-gap: 0.3vh;
        --quadrant-gap-v: 1.5vh;
    }
    
    .grid-wrapper {
        padding: 2vh 1vw;
    }
}

@media (max-width: 480px) {
    :root {
        --cell-size: 10vw;
        --spacer-width: 3vw;
        --cell-gap: 0.2vh;
        --quadrant-gap-v: 1vh;
        --quadrant-gap-h: 1.5vw;
    }
    
    .grid-wrapper {
        padding: 1vh 0.5vw;
    }
}
