/* Reset и общие стили */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1e293b; /* Темный фон */
    color: #f8f8f2; /* Светлый текст для контраста */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Visually hidden класс для доступности */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* App Header */
.app-header {
    background-color: #2d3748; /* Темный цвет хедера */
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Мягкая тень */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Ubuntu', sans-serif;
    color: #64ffda; /* Акцентный цвет логотипа */
    margin: 0;
    font-size: 2rem;
}

.language-select {
    margin-left: 20px;
}

.language-dropdown {
    padding: 10px 15px;
    border: 1px solid #4a5568; /* Темный бордер */
    border-radius: 5px;
    background-color: #3b4b60; /* Цвет фона дропдауна */
    color: #f8f8f2; /* Светлый текст */
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* Белая стрелка */
    background-repeat: no-repeat;
    background-position-x: 100%;
    background-position-y: 5px;
    padding-right: 30px;
}

.language-dropdown:focus {
    outline: none;
    border-color: #64ffda; /* Акцентный цвет при фокусе */
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.3);
}


/* Top Bar Navigation */
.top-bar {
    background-color: #4a5568; /* Темный цвет навбара */
    padding: 15px 20px;
    color: #f8f8f2;
}

.navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-button {
    background: none;
    border: none;
    color: #f8f8f2;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    font-size: 1rem;
}

.nav-button:hover, .nav-button.active {
    background-color: rgba(255, 255, 255, 0.1); /* Светлый фон при наведении/активности */
}

.nav-button.active {
    font-weight: bold;
    color: #64ffda; /* Акцентный цвет для активной кнопки */
}

/* Main Container */
.container {
    width: 100%;
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    flex-grow: 1;
}

.section {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.section.active {
    display: flex;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    color: #f8f8f2;
    font-size: 2rem;
    margin-bottom: 10px;
}

.section-subtitle {
    color: #a0aec0; /* Серый цвет для подзаголовков */
    font-size: 1.3rem;
    margin-top: 30px;
    margin-bottom: 15px;
    text-align: center;
    cursor: pointer;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #6b7280; /* Темная линия */
}

.collapsable-header::after {
    content: ' \25BE'; /* Down arrow */
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.3s ease;
    color: #a0aec0;
}

.collapsable-header.collapsed::after {
    transform: rotate(-180deg);
}


/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
    max-width: 700px;
}

.control-item {
    display: flex;
    flex-direction: column;
}

.level-control {
    grid-column: 1 / -1;
}

.controls-grid label {
    margin-bottom: 8px;
    color: #a0aec0;
    font-weight: bold;
}

.input-select, .input-text {
    padding: 12px 15px;
    border: 1px solid #4a5568; /* Темный бордер */
    border-radius: 5px;
    font-size: 1rem;
    color: #f8f8f2; /* Светлый текст */
    background-color: #3b4b60; /* Цвет фона инпутов */
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 10px;
}

.input-text::placeholder {
    color: #6b7280; /* Цвет плейсхолдера */
}


.input-select:focus, .input-text:focus {
    outline: none;
    border-color: #64ffda; /* Акцентный цвет при фокусе */
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.3);
}


/* Action Buttons */
.action-button {
    background-color: #64ffda; /* Акцентный цвет для кнопок */
    color: #2d3748; /* Темный цвет текста кнопок */
    border: none;
    padding: 14px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease; /* Добавляем transition для цвета текста */
    margin: 5px;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.action-button:hover {
    background-color: #4fd1c5; /* Затемненный акцентный при наведении */
}

.generate-button {
    background-color: #48bb78; /* Зеленый для генерации */
    color: #f8f8f2;
}

.generate-button:hover {
    background-color: #3ca76b;
}

.learned-button {
    background-color: #f6e05e; /* Желтый для "Изучено" */
    color: #2d3748;
}

.learned-button:hover {
    background-color: #f3c42a;
}

.add-button {
    background-color: #63b3ed; /* Светло-синий для "Добавить" */
    color: #2d3748;
}

.add-button:hover {
    background-color: #50a5e7;
}

.delay-button {
    background-color: #f6ad55; /* Оранжевый для "Отложить" */
    color: #2d3748;
}

.delay-button:hover {
    background-color: #f4921d;
}

.remove-button {
    background-color: #e53e3e; /* Красный для "Удалить" */
    color: #f8f8f2;
}

.remove-button:hover {
    background-color: #c63636;
}


/* Card Area and Card */
.card-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 550px;
    margin-bottom: 30px;
}

.card {
    background-color: #2d3748; /* Темный фон карточки */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Более выраженная тень */
    cursor: pointer;
    user-select: none;
    width: 100%;
    max-width: 500px;
    min-height: 250px;
    perspective: 1000px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Еще больше тень при наведении */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 125px;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column; /* Added to ensure vertical flow */
    justify-content: flex-start; /* Align items to the top */
    align-items: stretch; /* Стретч, чтоб текст растягивался на всю ширину карточки */
    border-radius: 10px;
    background-color: #2d3748; /* Темный фон карточки */
    font-size: 1.2rem;
    text-align: center;
    color: #f8f8f2; /* Светлый текст */
    border: 2px solid #4a5568; /* Темный бордер */
    overflow-y: auto; /* Add scroll if content overflows */
    top: 0; /* Anchor to top */
    left: 0;
}

.card-back {
    transform: rotateY(180deg);
}

.card-placeholder-text {
    color: #6b7280; /* Серый placeholder text */
    font-style: italic;
     padding: 10px; /* Немного места вокруг плейсхолдер текста */
}

.card-text {
    color: #f8f8f2; /* Светлый основной текст */
    font-weight: 500;
    padding: 10px; /* Отступы, чтобы текст не прилипал к краям карточки */
    text-align: left; /* Выравнивание текста по левому краю внутри карточки */
}


/* Card Navigation */
.card-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.nav-group {
    display: flex;
    gap: 10px;
}


.card-nav-button {
    background-color: #3b4b60; /* Темный фон кнопок навигации */
    border: none;
    border-radius: 5px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 1rem;
    color: #f8f8f2; /* Светлый цвет текста */
    transition: background-color 0.3s ease;
}

.card-nav-button:hover:not(:disabled) {
    background-color: #4a5568; /* Затемнение при наведении */
}

.card-nav-button:disabled {
    opacity: 0.5;
    cursor: default;
}


.card-progress {
    color: #a0aec0; /* Серый текст прогресса */
    font-size: 1rem;
    margin-left: 15px;
}


/* Card Lists */
.card-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Мягкая тень */
    border: 1px solid #4a5568; /* Темный бордер для списков */
}

.card-list.list-large {
    max-height: 300px;
    overflow-y: auto;
}

.card-list.collapsed {
    max-height: 0;
    overflow: hidden;
    border: none;
    margin-top: 0;
    box-shadow: none;
}


.card-list li {
    background-color: #2d3748; /* Темный фон списка */
    padding: 15px 20px;
    border-bottom: 1px solid #4a5568; /* Темный разделитель */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #f8f8f2; /* Светлый текст */
}

.card-list li:last-child {
    border-bottom: none;
}

.card-list li:nth-child(even) {
    background-color: #3b4b60; /* Чуть светлее для четных строк */
}

.card-list li:hover {
    background-color: #4a5568; /* Затемнение при наведении */
}

.card-list .delete-button, .card-list .speak-button {
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-left: 8px;
}

.card-list .speak-button {
    background-color: #63b3ed; /* Светло-синий для кнопок озвучки */
    color: #2d3748;
}

.card-list .speak-button:hover {
    background-color: #50a5e7;
}

/* Add Card Form */
.add-card-container {
    width: 100%;
    max-width: 700px;
    margin-bottom: 30px;
}

.card-form {
    background-color: #2d3748; /* Темный фон формы */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Мягкая тень */
    margin-bottom: 20px;
    border: 1px solid #4a5568; /* Темный бордер для формы */
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    color: #a0aec0;
    font-weight: bold;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 15px;
}

.my-cards-list-section {
    /* Styles for my cards list section if needed */
}


/* Learned Stats и Graph */
.learned-stats-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 700px;
    margin-bottom: 30px;
}

.stats-panel {
    background-color: #2d3748; /* Темный фон панели статистики */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Мягкая тень */
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    border: 1px solid #4a5568; /* Темный бордер для панели статистики */
}

.stats-panel > span {
    margin: 10px 15px;
    font-size: 1rem;
    color: #a0aec0;
    display: block;
    min-width: 100px;
    text-align: center;
}


.stats-graph {
    background-color: #2d3748; /* Темный фон графика */
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Мягкая тень */
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 20px;
    width: 100%;
    max-width: 700px;
    min-height: 150px;
    border: 1px solid #4a5568; /* Темный бордер для графика */
}

.graph-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20%;
    text-align: center;
    position: relative;
}

.graph-bar {
    background-color: #64ffda; /* Акцентный цвет столбиков */
    width: 100%;
    border-radius: 5px 5px 0 0;
    transition: height 0.5s ease;
    height: 10px;
}


.graph-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #a0aec0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.graph-label {
    margin-top: 8px;
    color: #a0aec0;
    font-size: 0.9rem;
}


/* App Footer */
.app-footer {
    background-color: #2d3748; /* Темный цвет футера */
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    margin-top: 40px;
    border-top: 1px solid #4a5568; /* Темная линия-разделитель */
}


/* Responsive Design */
@media (max-width: 768px) {
    .app-header, .top-bar {
        padding: 15px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .logo {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .language-select {
        margin-left: 0;
        margin-bottom: 10px;
    }

    .navigation {
        flex-direction: column;
        gap: 10px;
    }

    .nav-button {
        width: 100%;
        display: block;
        text-align: center;
    }

    .container {
        padding: 15px;
    }

    .section-header h2 {
        font-size: 1.8rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .level-control {
        grid-column: auto;
    }

    .card-area {
        max-width: 100%;
    }

    .card, .card-area {
        width: 95%;
        max-width: none;
    }

    .card-navigation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .nav-group {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .nav-group .card-nav-button, .nav-group .action-button {
        display: block;
        width: 100%;
        text-align: center;
    }

    .card-progress {
        margin-left: 0;
        margin-top: 10px;
        text-align: center;
    }

    .card-list, .card-list.list-large {
        max-width: 95%;
        margin-left: auto;
        margin-right: auto;
    }

    .learned-stats-container, .stats-panel, .stats-graph, .add-card-container, .card-form, .card-list {
        max-width: 95%;
    }

    .stats-panel {
        flex-direction: column;
        text-align: center;
    }

    .stats-panel > span {
        margin: 10px 0;
        min-width: auto;
        display: block;
    }

    .stats-graph {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .graph-bar-container {
        width: 80%;
        margin-bottom: 20px;
    }
}

/* Шрифт Nunito Sans для текста */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700&display=swap');
/* Шрифт Ubuntu для логотипа */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap');