/*
Project: Letteralingo - Memoriter Tanulás v4
Author: Fazekas Bálint
Author URI: https://fazekass.com
Company: FazekassMedia
Version: 4.0
*/

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4e7ae6, #7c4ee6);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.logo {
    display: flex;
    align-items: center;
}

.logo-square {
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;        
}

.logo-square img{
    width: 60px;
    height: 60px;
}

.app-title {
    font-size: 1.8rem;
    margin: 0;
    text-decoration: none;
    color: white;
}

.app-header a {
    text-decoration: none !important;
}

.unit-step-counter {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.input-section {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.language-selection {
    margin-bottom: 20px;
    text-align: center;
}

.language-selection h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.language-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.language-btn {
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}

.language-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #4e7ae6;
}

.language-btn.selected {
    border-color: #4e7ae6;
    background-color: #f0f4ff;
    box-shadow: 0 4px 10px rgba(78, 122, 230, 0.2);
}

.language-flag {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.language-name {
    font-weight: 600;
    font-size: 1rem;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: #4e7ae6;
    outline: none;
}

button {
    background: linear-gradient(to bottom, #4e7ae6, #3a5bbf);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(to bottom, #4e7ae6, #3a5bbf);
}

.btn-secondary {
    background: linear-gradient(to bottom, #6c757d, #5a6268);
}

.btn-success {
    background: linear-gradient(to bottom, #28a745, #218838);
}

.btn-danger {
    background: linear-gradient(to bottom, #dc3545, #c82333);
}

.btn-warning {
    background: linear-gradient(to bottom, #ff7e5f, #feb47b);
}

.btn-info {
    background: linear-gradient(to bottom, #17a2b8, #138496);
}

.units-container {
    display: none;
    margin-bottom: 30px;
}

.units-bar {
    display: flex;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 5px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.unit-indicator {
    flex: 1;
    min-width: 40px;
    height: 10px;
    background-color: #ddd;
    margin: 0 2px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.unit-indicator.active {
    background: linear-gradient(to right, #4e7ae6, #7c4ee6);
}

.step-container {
    display: none;
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.step-title {
    font-size: 1.5rem;
    color: #4e7ae6;
    font-weight: 600;
}

.step-counter {
    font-size: 1rem;
    color: #777;
    background-color: #f0f4ff;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.content-area {
    min-height: 200px;
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    line-height: 1.8;
    font-size: 18px;
    background-color: #fafbff;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.control-group {
    display: flex;
    gap: 10px;
}

.speaker-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-container {
    margin-bottom: 20px;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    background-color: #f8f9fa;
}

.ticker-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-scroll 30s linear infinite;
}

.ticker-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.ticker-speed-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background-color: #f0f4ff;
    border: 1px solid #e6ebff;
    border-radius: 10px;
}

.ticker-speed-label {
    font-size: 0.9rem;
    color: #555;
    white-space: nowrap;
}

.ticker-speed-slider input[type="range"] {
    width: 160px;
}

.speed-btn.active {
    box-shadow: 0 0 0 2px #4e7ae6;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.consonant {
    color: #333;
}

.vowel-placeholder {
    color: #ccc;
    text-decoration: underline;
}

.word-bubble {
    display: inline-block;
    margin: 5px;
    padding: 10px 15px;
    border-radius: 25px;
    background-color: #e9ecef;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.word-bubble.revealed {
    box-shadow: 0 0 0 3px #28a745;
    cursor: default;
}

.word-bubble:hover:not(.revealed) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.word-options {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 10;
    min-width: 150px;
}

.word-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.word-option:hover {
    background-color: #f0f4ff;
}

.covered-container {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 300px;
    overflow-y: auto;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
}

.text-content {
    padding: 10px 20px;
    font-size: 18px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.cover-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    transition: transform 0.3s ease;
}

.first-letter .other-letters {
    display: none;
}

.first-letter.revealed .other-letters {
    display: inline;
}

.first-letter.revealed {
    box-shadow: 0 0 0 3px #28a745;
    cursor: default;
}

.language-notice {
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f4ff;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    color: #4e7ae6;
    font-weight: 500;
}

.language-notice .flag-icon {
    display: inline-block;
    width: 20px;
    height: 15px;
    margin: 0 5px;
    border-radius: 2px;
    vertical-align: middle;
}

/* Reszponzív design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .app-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 15px;
    }
    
    .logo {
        justify-content: center;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .language-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .language-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .input-section, .step-container {
        padding: 20px;
    }
    
    .content-area {
        font-size: 16px;
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        width: 100%;
        justify-content: center;
    }
    
    .control-group button {
        flex: 1;
    }
    
    .step-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .ticker-controls {
        justify-content: center;
    }
    
    .covered-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .text-content {
        line-height: 2;
    }
    
    .app-title {
        font-size: 1.3rem;
    }
    
    .step-title {
        font-size: 1.3rem;
    }
    
    button {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .ticker-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .covered-container {
        height: 200px;
    }
    
    .text-content {
        padding: 15px;
        font-size: 16px;
    }
    
    .unit-step-counter {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
}

/* Modal stílusok */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* ===== ÚJ STÍLUSOK ===== */

/* Szöveg egység beállítások */
.unit-settings {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
}

.unit-settings h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
    text-align: center;
}

.unit-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.unit-option {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s;
    background-color: #f8f9fa;
}

.unit-option:hover {
    border-color: #cfe2ff;
    background-color: #f0f7ff;
}

.unit-option input[type="radio"]:checked + label {
    font-weight: 700;
    color: #4e7ae6;
}

.unit-option input[type="radio"]:checked ~ * {
    display: block;
}

.number-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

#unit-length {
    width: 120px;
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s;
}

#unit-length:focus {
    border-color: #4e7ae6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 122, 230, 0.2);
}

#unit-length.valid {
    border-color: #28a745;
}

#unit-length.invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

#unit-length-label {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.unit-preview {
    margin-top: 10px;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #495057;
    display: none;
}

input[type="radio"]:checked ~ .unit-preview {
    display: block;
}

.unit-option input[type="radio"] {
    margin-right: 10px;
}

.unit-option label {
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unit-option label::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #adb5bd;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    transition: all 0.3s;
}

.unit-option input[type="radio"]:checked + label::before {
    border-color: #4e7ae6;
    background-color: #4e7ae6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8z'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.validation-error {
    margin-top: 15px;
    padding: 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.validation-error.show {
    display: block;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Reszponzív design kiegészítések */
@media (max-width: 768px) {
    .unit-settings {
        padding: 15px;
    }
    
    .unit-options {
        gap: 15px;
    }
    
    .unit-option {
        padding: 12px;
    }
    
    .number-input-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    #unit-length {
        width: 100%;
    }
    
    #unit-length-label {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .unit-settings h3 {
        font-size: 1.1rem;
    }
    
    .unit-option label {
        font-size: 0.9rem;
    }
    
    #unit-length {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .unit-preview {
        font-size: 0.8rem;
        padding: 8px;
    }
}


/* hide <input type="radio" id="custom-length" name="unit-type" value="custom" checked=""> and full text radio button */
.unit-option input[type="radio"]#custom-length,
.unit-option input[type="radio"]#full-text {
    display: none;
}


/* ===== BIZTONSÁGI ÉS ANIMÁCIÓS STÍLUSOK ===== */

.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 400px;
    word-wrap: break-word;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Input limit indikátor */
.input-limit {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: right;
    margin-top: 5px;
}

.input-limit.warning {
    color: #dc3545;
}

/* Word bubble biztonsági stílusok */
.word-bubble {
    display: inline-block;
    margin: 5px;
    padding: 10px 15px;
    border-radius: 25px;
    background-color: #e9ecef;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    max-width: 200px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.word-bubble.revealed {
    box-shadow: 0 0 0 3px #28a745;
    cursor: default;
    background-color: #d4edda;
}

.word-bubble:hover:not(.revealed) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Modal biztonsági overlay */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Sötétebb overlay */
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    text-align: center;
    border: 2px solid #4e7ae6;
}

/* Responsive improvements for security */
@media (max-width: 480px) {
    .word-bubble {
        max-width: 150px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .error-toast {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
}


/* Javított CSS a word-bubble-okhoz */

.word-bubble {
    display: inline-block;
    margin: 2px 4px;
    padding: 8px 12px;
    border-radius: 20px;
    background-color: #f0f4ff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(78, 122, 230, 0.2);
    transition: all 0.3s;
    max-width: none;
    white-space: nowrap;
    border: 1px solid #cfe2ff;
}

.word-bubble.revealed {
    background-color: #d4edda;
    border-color: #28a745;
    box-shadow: 0 0 0 2px #28a745;
    cursor: default;
}

.word-bubble:hover:not(.revealed) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 122, 230, 0.3);
    background-color: #e0e7ff;
}

/* Mássalhangzók és magánhangzó helyettesítők */
.consonant {
    color: #333;
    font-weight: 600;
}

.vowel-placeholder {
    color: #ff6b6b;
    font-weight: 600;
}

/* Első betűs szavak */
.first-letter .other-letters {
    display: none;
}

.first-letter.revealed .other-letters {
    display: inline;
}

/* Word options */
.word-options {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 120px;
    max-width: 200px;
}

.word-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #eee;
}

.word-option:last-child {
    border-bottom: none;
}

.word-option:hover {
    background-color: #f0f4ff;
}

.word-option:active {
    background-color: #e0e7ff;
}

/* Tudás előhívás és megszilárdítás (15–21) */
.consolidation-hint {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 12px;
    line-height: 1.5;
}

.consolidation-help {
    font-size: 0.9rem;
    color: #777;
    margin-top: 8px;
}

.consolidation-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.consolidation-word-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 18px;
}

.consolidation-duration-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.consolidation-duration-input {
    width: 88px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.consolidation-recall-display {
    min-height: 120px;
    font-size: 18px;
    line-height: 1.85;
}

.recall-frame {
    display: inline-block;
    margin: 2px 1px;
    padding: 4px 8px;
    border: 2px solid #4e7ae6;
    border-radius: 6px;
    background: #f0f4ff;
    min-width: 0.5ch;
    vertical-align: baseline;
}

.recall-frame:not(.recall-frame--revealed) {
    cursor: pointer;
}

.recall-frame--missed {
    border-color: #c0392b;
    background: #fdecea;
    cursor: default;
}

.recall-frame--active {
    box-shadow: 0 0 0 3px rgba(78, 122, 230, 0.45);
    border-color: #7c4ee6;
}

.recall-frame--revealed {
    border-color: #28a745;
    background: #e8f5e9;
    cursor: default;
}

.recall-waiting {
    color: #bbb;
    font-weight: bold;
}

.recall-slot-empty {
    color: #aaa;
    letter-spacing: 1px;
}

.consolidation-summary-text {
    margin-bottom: 16px;
    font-size: 1rem;
    color: #444;
}

.consolidation-summary-unit {
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafbff;
    line-height: 1.85;
    font-size: 18px;
}