/* ==========================================================================
   MAMAN & MAESTRO — INTERACTIVE WORKSHEET STYLES
   Styles pour le cahier d'exercices interactif (Dessin sur image & champs de texte)
   ========================================================================== */

.worksheet-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 12px;
    animation: fadeIn 0.2s ease;
}

.worksheet-card-container {
    background: #FFFFFF;
    border-radius: 24px;
    border: 3px solid #3B82F6;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 1080px;
    height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header Toolbar */
.worksheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #F8FAFC;
    border-bottom: 2px solid #E2E8F0;
    gap: 16px;
    flex-shrink: 0;
}

.worksheet-app-badge {
    font-size: 0.7rem;
    font-weight: 800;
    color: #2563EB;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.worksheet-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0F172A;
    margin: 0;
    font-family: 'Fredoka', sans-serif;
}

.worksheet-tabs-wrapper {
    display: flex;
    gap: 8px;
    background: #E2E8F0;
    padding: 4px;
    border-radius: 16px;
}

.worksheet-tab-btn {
    border: none;
    background: transparent;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.worksheet-tab-btn .tab-badge {
    background: #CBD5E1;
    color: #0F172A;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.worksheet-tab-btn.active {
    background: #2563EB;
    color: #FFFFFF;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.worksheet-tab-btn.active .tab-badge {
    background: #FFFFFF;
    color: #2563EB;
}

.worksheet-close-btn {
    background: #EFF6FF;
    border: 2px solid #BFDBFE;
    color: #1E40AF;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.worksheet-close-btn:hover {
    background: #DBEAFE;
    transform: scale(1.08);
}

/* Tools Bar */
.worksheet-tools-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #FFFFFF;
    border-bottom: 2px solid #F1F5F9;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.tools-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
}

.color-picker-row {
    display: flex;
    gap: 6px;
}

.color-swatch-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch-btn.active {
    transform: scale(1.35);
    outline: 2.5px solid #2563EB;
    outline-offset: 1px;
}

.brush-size-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #F8FAFC;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
}

.tool-action-btn {
    background: #F1F5F9;
    border: 1.5px solid #CBD5E1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.tool-action-btn:hover {
    background: #E2E8F0;
}

.tool-action-btn.active {
    background: #FEF3C7;
    border-color: #F59E0B;
    color: #B45309;
    font-weight: 800;
}

.stickers-scroll-row {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    max-width: 260px;
    padding: 2px 0;
}

.sticker-select-btn {
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    font-size: 1.25rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.sticker-select-btn:hover {
    transform: scale(1.3);
    background: #EFF6FF;
}

.dysvocal-listen-page-btn {
    background: #EFF6FF;
    border-color: #93C5FD;
    color: #1D4ED8;
}

/* Main Viewport and Paper Stage */
.worksheet-viewport-container {
    flex: 1;
    overflow: auto;
    background: #334155;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.worksheet-paper-stage {
    position: relative;
    width: 100%;
    max-width: 760px;
    aspect-ratio: 1240 / 1755;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    user-select: none;
}

.worksheet-background-img {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    object-fit: fill;
/* ==========================================================================
   INTERACTIVE OVERLAYS & COLORFUL HIGH-CONTRAST FIELD HIGHLIGHTS
   ========================================================================== */

.worksheet-interactive-overlay {
    position: absolute;
    inset: 0;
    pointer-events: auto;
}

/* Polaroid Drawing Boxes (Page 1) */
.polaroid-drawing-zone {
    border-radius: 12px;
    overflow: visible;
    background: rgba(255, 255, 255, 0.05);
    cursor: crosshair;
    border: 2.5px dashed rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
}

.polaroid-drawing-zone:hover {
    border-color: #2563EB;
    background: rgba(37, 99, 235, 0.04);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.2);
}

.polaroid-header-badge {
    position: absolute;
    top: -14px;
    left: 8px;
    color: #FFFFFF;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 9999px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.polaroid-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.polaroid-drawing-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    border-radius: 8px;
}

.polaroid-quick-toolbar {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    z-index: 15;
}

.polaroid-drawing-zone:hover .polaroid-quick-toolbar {
    opacity: 1;
}

.quick-btn-undo, .quick-btn-speak {
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    font-size: 0.8rem;
    padding: 4px 8px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.15s ease;
}

.quick-btn-undo:hover, .quick-btn-speak:hover {
    transform: scale(1.1);
}

/* Polaroid Caption Box (Page 1) */
.polaroid-caption-zone {
    position: relative;
}

.caption-label-pill {
    font-size: 0.72rem;
    font-weight: 800;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.worksheet-caption-textarea {
    width: 100%;
    height: calc(100% - 14px);
    border: 1.5px solid #CBD5E1;
    background: rgba(255, 255, 255, 0.8);
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1E293B;
    resize: none;
    outline: none;
    padding: 4px 8px;
    line-height: 1.25;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.worksheet-caption-textarea:focus {
    background: #FFFFFF;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Bubble Line Inputs (Page 2) */
.bubble-line-zone {
    position: relative;
}

.bubble-input-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 2.5px dashed var(--bubble-color, #2563EB);
    border-radius: 6px;
    padding: 0 4px;
    transition: all 0.2s ease;
}

.bubble-input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 12px var(--bubble-color, #2563EB);
    border-bottom-style: solid;
}

.bubble-index-pill {
    color: #FFFFFF;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    margin-right: 4px;
}

.worksheet-bubble-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #0F172A;
    padding: 0 28px 0 2px;
    outline: none;
}

.bubble-speak-btn, .box-speak-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.worksheet-field-zone:hover .bubble-speak-btn,
.worksheet-field-zone:hover .box-speak-btn {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* Multiline Box Zones (Page 3) */
.multiline-box-zone {
    position: relative;
    border-radius: 12px;
    border: 2px dashed rgba(15, 23, 42, 0.2);
    transition: all 0.2s ease;
}

.multiline-box-zone:hover {
    border-color: var(--box-accent, #2563EB);
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.15);
}

.multiline-input-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.box-theme-tag {
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    align-self: flex-start;
    margin: -10px 0 2px 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.worksheet-multiline-textarea {
    width: 100%;
    flex: 1;
    border: none;
    background: rgba(255, 255, 255, 0.75);
    font-family: 'Fredoka', 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0F172A;
    resize: none;
    outline: none;
    padding: 4px 26px 4px 6px;
    line-height: 1.35;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.worksheet-multiline-textarea:focus {
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}


/* Footer Controls */
.worksheet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #F8FAFC;
    border-top: 2px solid #E2E8F0;
    gap: 16px;
    flex-shrink: 0;
}

.worksheet-footer-left, .worksheet-footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-outline-worksheet {
    background: #FFFFFF;
    border: 2px solid #CBD5E1;
    color: #334155;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-worksheet:hover:not(:disabled) {
    background: #F1F5F9;
    border-color: #94A3B8;
}

.btn-outline-worksheet:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-counter-text {
    font-weight: 800;
    color: #64748B;
    font-size: 0.9rem;
}

.btn-export-worksheet {
    background: #EFF6FF;
    border: 2px solid #93C5FD;
    color: #1D4ED8;
    padding: 10px 18px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export-worksheet:hover {
    background: #DBEAFE;
    transform: translateY(-1px);
}

.btn-submit-worksheet {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    border: none;
    color: #FFFFFF;
    padding: 10px 22px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transition: all 0.2s ease;
}

.btn-submit-worksheet:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

/* Success Dialog Backdrop */
.worksheet-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.worksheet-dialog-card {
    background: #FFFFFF;
    border-radius: 24px;
    padding: 32px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    border: 3px solid #3B82F6;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}
