/* Exercises page styles - cards, translation, paraphrase exercises */

.exercises {
    font-weight: 300;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 2rem;
}

.exercises.active {
    display: block;
}

.exercises.active .exercises-navigation {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background-color: var(--dark-brown-color);
    border-bottom: 1px solid var(--light-brown-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

/* Exercise navigation */
#navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 2rem;
    flex-wrap: wrap;
}

#navigation>div {
    font-weight: 220;
    flex: 1;
    text-align: center;
}

.exercises-navigation-cards button,
.exercises-navigation-translate button,
.exercises-navigation-paraphrase button,
.exercises-navigation-context button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.exercises-navigation-cards,
.exercises-navigation-translate,
.exercises-navigation-paraphrase,
.exercises-navigation-context {
    opacity: 0.6;
}

.exercises-navigation-inactive {
    opacity: 0.6;
}

.exercises-navigation-active {
    opacity: 1;
}

/* Cards exercise */
.cards {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 1rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    height: 100vh;
}

/* Slider layout */
.cards-viewport {
    position: relative;
    width: 100%;
    max-width: 600px;
    overflow: hidden; /* Hide non-active slides */
}

.cards-track {
    display: flex;
    flex-direction: row;
    will-change: transform;
    transition: transform 300ms ease;
}

.card-slide {
    flex: 0 0 100%; /* Each slide takes full viewport width */
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.card {
    background-color: #F1F1F1;
    border-radius: 12px;
    padding: 0 1.5rem 1.5rem 1.5rem;
    margin: 1rem auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: calc(100% - 2rem);
    max-width: 600px;
    position: relative;
    box-sizing: border-box;
    color: var(--dark-brown-color);
    perspective: 1000px; /* enable 3D for text flip */
    min-height: 220px; /* ensure space for faces */
    height: 60vh; /* 60% of viewport height */
    overflow: hidden; /* clip faces to rounded corners */
}

/* Card responsiveness */
@media screen and (max-width: 480px) {
    .card {
        padding: 1rem;
        margin: 0.75rem auto;
        width: calc(100% - 1.5rem);
    }
}

/* Update existing card content styles to work with new card design */
.card .phrase-rus {
    color: var(--dark-brown-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.card .phrase-eng {
    color: var(--dark-brown-color);
    margin-bottom: 0.5rem;
}

.card .phrase-transcription {
    color: var(--dark-brown-color);
    opacity: 0.7;
}

/* Examples styling for card front side */
.phrase-examples {
    font-size: 1rem;
    font-style: italic;
    opacity: 0.8;
    margin-top: 1rem;
    text-align: left;
    padding-left: 15px;
    max-width: 100%;
    word-wrap: break-word;
    line-height: 1.4;
}

.phrase-example-line {
    margin-bottom: 0.3rem;
}

.phrase-example-line:last-child {
    margin-bottom: 0;
}

.phrase-highlight {
    font-weight: 500;
}



.card-first-section {
    width: 100%;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateX(0);
    opacity: 1;
}

/* Removed second section */

/* Flip card */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Text flip container */
.card-text-flip {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.card.is-flipped .card-text-flip {
    transform: rotateY(180deg);
}

/* Faces (text only) */
.card-front-content,
.card-back-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20%; /* place text 30% from top */
}

.card-back-content {
    transform: rotateY(180deg);
}

/* Card navigation */
.cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cards-viewport {
    flex: 1;
}

.card-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.card-nav-prev,
.card-nav-next {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font: inherit;
    outline: inherit;}

.card-nav-prev {
    opacity: 0.7;
}

.card-nav-next {
    opacity: 1;
}

.card-counter {
    color: white;
    font-size: 0.9rem;
}

/* Back state visuals */
.card.is-flipped {
    background-color: #004187;
    color: white;
}

.card.is-flipped .card-back-content .phrase-rus,
.card.is-flipped .card-back-content .phrase-context-rus {
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.phrase-context-rus {
    font-size: 1.2rem;
    text-align: left;
    margin-top: 1.2rem;
    opacity: 0.8;
    /* font-style: italic; */
    padding: 0 1rem;
    line-height: 1.4;
}

/* Ensure card background matches back color when flipped to avoid white borders */
.card.is-flipped {
    background-color: #004187;
    color: white;
}



.phrase-control-buttons {
    position: absolute;
    bottom: 5rem;
    right: 20px;
    display: flex;
    gap: 10px;
}

.phrase-control-button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.icon-control {
    width: 20px;
    height: 20px;
}

.phrase-rus {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    margin-top: 6rem;
    margin-left: 20px;
    margin-right: 20px;
}

@media (min-width: 768px) {
    .phrase-rus {
        font-size: 1.75rem;
        margin-top: 2rem;
    }
}

.phrase-eng {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.25rem;
    margin-left: 20px;
    margin-right: 20px;
}

@media (min-width: 768px) {
    .phrase-eng {
        font-size: 1.75rem;
    }
}

.phrase-transcription {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 1rem;
    margin-left: 20px;
    margin-right: 20px;
    opacity: 0.6;
}

@media (min-width: 768px) {
    .phrase-transcription {
        font-size: 1.1rem;
    }
}


/* Removed examples block */

@media (min-width: 768px) {
    .phrase-examples {
        text-align: center;
    }
}

/* Removed example item */



/* Translation exercise */
.translate-phrases-exercise {
    max-width: 100%;
}

.current-phrase-to-translate {
    font-size: 2rem;
    text-align: center;
    margin-top: 6rem;
    margin-bottom: 2rem;
    color: white;
    font-weight: 300;
    margin-left: 10px;
    margin-right: 10px;
    min-height: 5rem;  /* Ensures space for two lines */
}

.translate-phrases-exercise-explanation {
    text-align: center;
    font-size: 1rem;
    font-weight: 300;
    opacity: 0.6;
    margin-top: 4rem;
    margin-left: 2rem;
}

/* Paraphrase exercise */
.paraphrase-exercise {
    position: relative;
    padding-top: 4rem;
    height: 100vh;
    overflow: hidden;
}

/* removed per-exercise progress bar placement; using nav progress bar */

.paraphrase-sentence-from {
    font-size: 1.5rem;
    text-align: center;
    margin-top: 0; /* Remove margin-top since parent has padding-top */
    margin-bottom: 1rem;
    margin-left: 20px;
    margin-right: 20px;
    color: white;
    font-weight: 250;
    min-height: 4rem; /* Reserve space for two lines */
}

.paraphrase-sentence-from-phrase {
    opacity: 70%;
}

.paraphrase-sentence-to {
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
    margin-top: 4rem;
    margin-left: 1rem;
    margin-right: 20px;
    color: white;
    font-weight: 250;
    min-height: 3.8rem; /* Reserve space for two lines */
}

.paraphrase-sentence-to-input {
    width: 7ch;
    min-width: 7ch;
    max-width: 20ch;
    background: none;
    border: none;
    border-bottom: 1px solid var(--light-brown-color);
    color: inherit;
    font: inherit;
    outline: none;
    text-align: center;
    box-sizing: content-box;
    padding: 0 4px;
    margin: 0 2px;
    -webkit-appearance: none;
    appearance: none;
    display: inline-block;
    vertical-align: baseline;
}

.paraphrase-sentence-to-input:focus {
    border-bottom: 2px solid var(--light-brown-color);
}

.paraphrase-sentence-to-explanation {
    margin-top: 4rem;
    opacity: 0.6;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

.dialog-exercise-title {
    text-align: center;
    font-size: 1.2rem;
    margin-top: 1rem;
    color: white;
    font-weight: 250;
}

.dialog-item {
    background-color: rgba(var(--figma-color-rgb), 0.15);
    border-radius: 10px;
    padding: 15px 10px;
    font-size: 0.8rem;
    max-width: 60%;
    margin: 0.3rem 1rem;
}

.dialog-item-left {
    margin-right: auto;
}

.dialog-item-right {
    margin-left: auto;
}
.dialog {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    padding: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--figma-color-rgb), 0.3) transparent;
    padding-bottom: 200px;
}
.dialog-window::-webkit-scrollbar {
    width: 4px;
}

.dialog-window::-webkit-scrollbar-track {
    background: transparent;
}

.dialog-window::-webkit-scrollbar-thumb {
    background-color: rgba(var(--figma-color-rgb), 0.3);
    border-radius: 2px;
}

.dialog-exercise {
    height: 100%;
}

/* Dialog input */
.dialog-input-container {
    display: flex;
    align-items: flex-start;
    padding: 0 1rem;
    gap: 0.5rem;
    background-color: var(--dark-brown-color);
    min-height: fit-content;
    height: auto;
    margin-top: auto;
    flex-shrink: 0;
}

.dialog-input {
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 48px;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.5rem;
    margin: 0;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: white;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    caret-color: var(--orange-color);
    font-weight: 300;
    box-sizing: border-box;
    padding-left: 20px;
}

.dialog-input:focus {
    border: none;
    outline: none;
}

.dialog-input::placeholder {
    color: var(--figma-color);
    -webkit-text-fill-color: var(--figma-color);
    font-weight: 200;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

.dialog-send-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: white;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
}

.dialog-send-button:hover {
    opacity: 0.8;
}

.dialog-send-button svg {
    width: 24px;
    height: 24px;
}

.dialog-exercise {
    /* position: relative; */
    /* display: flex; */
    /* flex-direction: column; */
    /* height: 100vh; */
    /* overflow: hidden; */
}

/* removed per-exercise progress bar placement; using nav progress bar */

.dialog-error {
    color: var(--orange-color);
    font-size: 0.9rem;
    margin: 0.5rem 1rem;
    padding: 0.5rem;
    background-color: rgba(var(--orange-color-rgb), 0.1);
    /* border-radius: 5px; */
    /* border-left: 3px solid var(--orange-color); */
    display: none;
}



.complete-dialog {
    text-align: center;
    width: 100%;
}

.complete-dialog button {
    color: var(--orange-color);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 300;
    background: none;
    border: none;
    padding: 0;
}

/* Loading animation */
.dialog-loading {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px;
    margin: 10px;
    opacity: 0.7;
}

.dialog-loading-dot {
    width: 3px;
    height: 3px;
    background-color: var(--figma-color);
    border-radius: 50%;
    animation: loadingDot 1.4s infinite ease-in-out;
}

.dialog-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dialog-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Smooth scrolling for dialog container */
.dialog {
    scroll-behavior: smooth;
}


.dialog-flex {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px); /* Account for top navigation and padding */
    padding-bottom: 20px;
    position: relative;
}

.dialog-window {
    flex: 1;
    overflow-y: auto;
}

.dialog-control {
    position: absolute;
    bottom: 100px;
    left: 0;
    right: 0;
    background-color: var(--dark-brown-color);
    z-index: 10;
}