/* exercise-components.css */

:root {
    --ex-primary: #0f172a;
    --ex-primary-hover: #4f46e5;
    --ex-success: #10b981;
    --ex-success-light: #d1fae5;
    --ex-danger: #ef4444;
    --ex-danger-light: #fee2e2;
    --ex-border: #cbd5e1;
    --ex-bg: #f8fafc;
    --ex-text: #1e293b;
    --ex-text-muted: #64748b;
    --ex-radius: 12px;
}

.ex-container {
    background: #ffffff;
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 24px;
    margin-bottom: 24px;
    font-family: 'Exo 2', sans-serif;
    color: var(--ex-text);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ex-header {
    margin-bottom: 16px;
}

.ex-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ex-primary);
    margin-bottom: 4px;
}

.ex-instruction {
    font-size: 0.95rem;
    color: var(--ex-text-muted);
}

/* Fill in the Blanks */
.ex-fib-sentence {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.ex-fib-input {
    border: 2px solid var(--ex-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1.1rem;
    font-family: inherit;
    width: auto;
    min-width: 80px;
    text-align: center;
    outline: none;
    transition: all 0.2s;
    background: var(--ex-bg);
}

.ex-fib-input:focus {
    border-color: var(--ex-primary);
    background: #ffffff;
}

.ex-fib-input.correct {
    border-color: var(--ex-success);
    background: var(--ex-success-light);
    color: #047857;
}

.ex-fib-input.incorrect {
    border-color: var(--ex-danger);
    background: var(--ex-danger-light);
    color: #b91c1c;
}

/* Sentence Builder (Duolingo Style) */
.ex-sb-dropzone {
    min-height: 60px;
    border: 2px dashed var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    background: var(--ex-bg);
    transition: border-color 0.3s, background-color 0.3s;
}

.ex-sb-dropzone.correct {
    border-color: var(--ex-success);
    background: var(--ex-success-light);
    border-style: solid;
}

.ex-sb-dropzone.incorrect {
    border-color: var(--ex-danger);
    background: var(--ex-danger-light);
    border-style: solid;
}

.ex-sb-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 50px;
}

.ex-word-chip {
    background: #ffffff;
    border: 2px solid var(--ex-border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 0 var(--ex-border);
    transition: transform 0.1s, box-shadow 0.1s;
}

.ex-word-chip:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--ex-border);
}

/* Feedback Box */
.ex-feedback {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    display: none;
}

.ex-feedback.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.ex-feedback.correct {
    background: var(--ex-success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.ex-feedback.incorrect {
    background: var(--ex-danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Buttons */
.ex-btn {
    background: var(--ex-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.ex-btn:hover {
    background: var(--ex-primary-hover);
}

.ex-btn:disabled {
    background: var(--ex-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Multiple Choice */
.ex-mc-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ex-mc-option {
    border: 2px solid var(--ex-border);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    background: #ffffff;
    font-size: 1.05rem;
}

.ex-mc-option:hover:not(.disabled) {
    border-color: var(--ex-primary);
    background: #eef2ff;
}

.ex-mc-option.selected {
    border-color: var(--ex-primary);
    background: #eef2ff;
}

.ex-mc-option.correct {
    border-color: var(--ex-success);
    background: var(--ex-success-light);
}

.ex-mc-option.incorrect {
    border-color: var(--ex-danger);
    background: var(--ex-danger-light);
}

.ex-mc-option.disabled {
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Vocabulary Split Screen Presentation */
.vocab-split-container {
    display: flex;
    gap: 40px;
    align-items: stretch;
    justify-content: space-between;
    margin: 20px auto;
    font-family: 'Exo 2', sans-serif;
    min-height: 520px;
    width: 100%;
}

/* Wide view in lesson layout if supported */
.lesson-layout.wide-vocab {
    max-width: 1300px !important; /* Wider overall container to accommodate wider paper */
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Left: A4 Handwritten Paper */
.a4-paper-container {
    flex: 1.2; /* Give more weight to paper */
    min-width: 380px;
    max-width: 550px; /* Wider paper */
    display: flex;
    justify-content: center;
}

.a4-paper {
    background: #fdfdfa; /* Warm ivory/cream physical paper tone */
    border: 1px solid #e2e8f0;
    box-shadow: 
        0 4px 6px rgba(0,0,0,0.01),
        0 10px 25px rgba(0,0,0,0.04),
        -5px 5px 15px rgba(0,0,0,0.03);
    border-radius: 6px;
    width: 100%;
    min-height: 480px;
    position: relative;
    padding: 32px 24px; /* Removed left padding to control it at the item level */
    box-sizing: border-box;
    overflow: hidden;
}



.a4-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.a4-title {
    font-family: 'Indie Flower', cursive;
    font-size: 2.3rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding-left: 12px; /* Basic padding */
    color: #1e3a8a; /* Deep ink blue */
    border-bottom: 2px dashed #bfdbfe;
    padding-bottom: 6px;
}

.a4-list-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

.a4-line-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px; /* Allow height to grow */
    height: auto;
    border-bottom: 1.5px solid #e0f2fe; /* Light blue ruled lines */
    font-family: 'Indie Flower', cursive;
    font-size: 1.5rem;
    color: #334155; /* Soft ink grey */
    padding: 8px 4px 8px 24px; /* Add 24px left padding to leave room for the dot */
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    position: relative; /* For the dot positioning */
}

.a4-line-item:hover {
    background-color: rgba(240, 249, 255, 0.6);
    color: #2563eb;
    padding-left: 8px;
}

.a4-line-item.active {
    font-weight: 700;
    transform: scale(1.02);
}

.a4-word {
    font-weight: bold;
    color: #1e293b;
    white-space: nowrap; /* Do not wrap German words */
    flex-shrink: 0;
    padding-right: 4px;
    line-height: 1.2;
}

.a4-line-item.active .a4-word {
    color: inherit; /* Remove red color from active word */
}

/* Active indicator: Red dot to the left of the margin line */
.a4-line-item.active::before {
    content: '';
    position: absolute;
    left: 4px; /* Position the dot in the left padding space */
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #ef4444; /* Red dot */
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}



.a4-translation {
    color: #64748b;
    font-size: 1.3rem;
    white-space: normal; /* Allow translation to wrap */
    overflow: visible;
    text-overflow: clip;
    flex: 1;
    text-align: left; /* Align left after word */
    line-height: 1.2;
}

.a4-colon {
    color: #94a3b8;
    margin-right: 4px;
}



/* Right Side: 3D Flashcard Deck */
.card-deck-outer {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    max-width: 600px;
}

/* Slider buttons outside the deck frame */
.deck-nav-btn {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    color: #475569;
    border-radius: 50%;
    width: 54px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    z-index: 10;
    outline: none;
    flex-shrink: 0;
}

.deck-nav-btn:hover {
    background: var(--ex-primary);
    border-color: var(--ex-primary);
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.deck-nav-btn:active {
    transform: scale(0.95);
}

.card-deck-perspective {
    width: 380px;  /* Enlarged width */
    height: 480px; /* Enlarged height */
    perspective: 1200px;
    position: relative;
}

.card-deck-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

/* Beautiful stacked 3D deck-cards */
.deck-card {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 24px;
    box-sizing: border-box;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 15px 35px rgba(0,0,0,0.06), 
        0 5px 15px rgba(0,0,0,0.04);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s, z-index 0.6s;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.card-inner {
    width: 100%;
    height: 100%;
    padding: 40px; /* Increased padding */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Card Content Details */
.card-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.card-type-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 9999px;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.card-word {
    font-size: 1.95rem; /* Slightly larger word size */
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* Article coloring */
.card-article {
    font-weight: 800;
    font-size: 1.5rem;
    margin-right: 6px;
}

.card-plural {
    font-size: 1.15rem;
    color: #1e293b; /* Default text color (dark) */
    font-weight: 800;
    display: block; /* Underneath */
    margin-top: 4px;
}

.card-plural .article-pink {
    color: #ec4899; /* Only article is pink */
}

/* Custom row list styles for multiple meanings */
.card-translation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    align-items: flex-start;
    width: 100%;
}

.card-translation-row {
    font-size: 1.25rem;
    color: #4f46e5;
    margin: 0;
    font-weight: 600;
    border-bottom: 1.5px dashed rgba(79, 70, 229, 0.2);
    padding-bottom: 2px;
}

.card-spacer {
    flex-grow: 1;
}

/* Card Example Sentences Section */
.card-bottom {
    background: #f8fafc;
    border-radius: 18px;
    padding: 20px 24px;
    border: 1px solid #f1f5f9;
}

.card-example-de {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.55;
    margin-bottom: 8px;
}

.card-example-highlight {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    border-bottom: 2px solid rgba(79, 70, 229, 0.3);
}

.card-example-en {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
    font-style: italic;
}

/* Mobile stacking and scaling */
@media (max-width: 820px) {
    .vocab-split-container {
        flex-direction: column-reverse;
        gap: 30px;
        align-items: center;
        min-height: auto;
    }
    
    .a4-paper-container, .card-deck-outer {
        width: 100%;
        max-width: 100%;
    }
    
    .card-deck-perspective {
        width: 320px;
        height: 440px;
    }
}


/* WhatsApp Dialogue Ordering Exercise */
.wa-chat-container {
    background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 10h10v10H10V10zm20 20h10v10H30V30zm-20 20h10v10H10V50zm40-40h10v10H50V10zm20 20h10v10H70V30zm-20 20h10v10H50V50z' fill='%23d0c9c1' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    border: 1px solid #d1d5db;
    overflow: hidden;
}

.wa-message-row {
    display: flex;
    width: 100%;
    cursor: grab;
    transition: transform 0.2s;
    align-items: flex-end; /* Align to bottom so tails match up with avatars */
}

.wa-message-row:hover .wa-bubble {
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wa-message-row.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.wa-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
    margin: 0 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wa-message-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.wa-sender-name {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
    padding: 0 4px;
    font-weight: 500;
}

.wa-message-row[data-align="right"] {
    justify-content: flex-end;
}

.wa-message-row[data-align="left"] {
    justify-content: flex-start;
}

.wa-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 1rem;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border: 1.5px dashed rgba(0,0,0,0.2); /* Dashed border to indicate draggability */
    transition: all 0.2s ease;
}

.wa-bubble-sent {
    background-color: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.wa-bubble-received {
    background-color: #ffffff;
    border-bottom-left-radius: 4px;
}

/* Downward pointing tails */
.wa-bubble-sent::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-bottom: 12px solid #dcf8c6;
    border-right: 12px solid transparent;
}

.wa-bubble-received::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-bottom: 12px solid #ffffff;
    border-left: 12px solid transparent;
}

/* Inline Select Styles */
.ex-inline-select {
    border: 2px solid var(--ex-border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 1.05rem;
    font-family: inherit;
    background: #ffffff;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--ex-primary);
}

.ex-inline-select:focus {
    border-color: var(--ex-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.ex-inline-select.correct {
    border-color: var(--ex-success);
    background-color: var(--ex-success-light);
    color: #047857;
}

.ex-inline-select.incorrect {
    border-color: var(--ex-danger);
    background-color: var(--ex-danger-light);
    color: #b91c1c;
}

