/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

h1, h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

h1 {
    font-weight: bold;
}

#logo {
    width: 200px;
    height: auto;
}

.input-area, #inputSection, #recognitionSection {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
}

textarea, #textInput {
    width: 100%;
    padding: 15px;
    border: 1px solid #dfe3e8;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 1em;
    line-height: 1.5;
    resize: vertical;
}

#textInput {
    resize: none;
    font-size: 20px;
    height: 150px;
}

.btn, .modal-button {
    display: inline-block;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.1s;
}

.primary-btn {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #2575fc, #6a11cb);
}

.tts-button, .playback-button, .record-button, .play-button {
    background-color: #2196F3;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}

.tts-button:hover, .playback-button:hover, .record-button:hover, .play-button:hover {
    background-color: #0b7dda;
}

.record-button.stop-recording {
    background-color: #f44336;
}

.record-button.stop-recording:hover {
    background-color: #d32f2f;
}

#textOverlay {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 20px;
    height: 300px;
    overflow-y: auto;
}

.wordBox, .word-box {
    display: inline-block;
    margin: 2px;
    font-size: 24px;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.wordBox.correct, .word-box.high {
    background-color: rgba(76, 175, 80, 0.3);  /* Light green */
}

.wordBox.incorrect, .word-box.low {
    background-color: rgba(244, 67, 54, 0.3);  /* Light red */
}

.wordBox.omitted, .word-box.medium {
    background-color: rgba(255, 235, 59, 0.3);  /* Light yellow */
}

.word-box:hover {
    text-decoration: underline;
}

.notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #323232;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
}

#dashboard {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dashboard-card, .result-box {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    text-align: center;
    width: 100%;
}

.dashboard-card h3, .result-box h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
}

.dashboard-value, .result-box p {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 10px;
}

.progress {
    height: 10px;
    border-radius: 5px;
    background-color: #e0e0e0;
    margin-top: 5px;
}

.progress-bar {
    background-color: #4CAF50;
    border-radius: 5px;
    height: 100%;
    transition: width 0.5s ease-in-out;
}


.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #f0f8ff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
    animation: slideIn 0.3s;
    position: relative;
}

.completion-modal {
    z-index: 1001;
}

.completion-modal .modal-content {
    background-color: #fff;
}

.completion-message {
    font-size: 36px;
    color: #4CAF50;
    margin-bottom: 20px;
    margin-top: 40px;
    font-weight: bold;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.modal-button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.retry-button {
    background-color: #4CAF50;
    color: white;
}

.retry-button:hover {
    background-color: #45a049;
}

.stats-button {
    background-color: #008CBA;
    color: white;
}

.stats-button:hover {
    background-color: #007B9A;
}

.modal-header {
    position: absolute;
    top: 0;
    right: 0;
    padding: 10px;
    background: transparent; /* Ensure the header has no background */
    border: none; /* Remove any border that might be causing the line */
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes slideIn {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

#statsModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#statsModal .modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
}

#statsContent {
    text-align: left;
}

#statsModal h3 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

#statsContent p {
    font-size: 18px;
    margin: 10px 0;
    color: #555;
}

#accuracyChart {
    margin: 20px auto;
    max-width: 100%;
    height: auto;
}

.sentenceBox, .sentence-list li {
    margin: 10px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sentenceFeedback {
    margin-top: 10px;
}

.sentence-content p {
    margin: 0;
    font-weight: 500;
}

.sentence-content button {
    margin-right: 10px;
    margin-top: 10px;
}

#wordDetails, .word-info-box {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.word-info-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
}

.word-info-box h3 {
    margin-top: 0;
}

.word-info-box p {
    font-size: 1em;
    margin: 10px 0;
    line-height: 1.5;
}

.word-info-box button {
    display: inline-block;
    margin-right: 10px;
    margin-top: 10px;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.word-info-box .tts-button {
    background-color: #4CAF50;
}

.word-info-box .tts-button:hover {
    background-color: #45a049;
}

.word-info-box .word-record-button {
    background-color: #f44336;
    color: white;
}

.word-info-box .word-record-button:hover {
    background-color: #d32f2f;
}

.word-info-box .close-button {
    background-color: #757575;
    color: white;
}

.word-info-box .close-button:hover {
    background-color: #616161;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1em;
    color: #555;
    display: flex;
    align-items: center;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    #dashboard {
        flex-direction: column;
    }
    
    .dashboard-card {
        margin-bottom: 15px;
    }
}

.sentence-item {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
}

.sentence-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.sentence-and-buttons {
    display: flex;
    flex-direction: column;
    width: 80%; /* Adjusted to allow more space for the results */
    margin-right: 10px; /* Increased margin between sentence and results */
}

.sentence-text {
    margin-bottom: 10px;
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end; /* Aligns the results to the right */
    width: 30%; /* Width adjusted to align results section */
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Ensure the label and bar align to the right */
}

.result-label {
    margin-right: 5px;
    font-weight: bold;
}

.score-bar {
    width: 80px;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    border-radius: 5px;
    text-align: center;
    font-size: 1.15em; /* Increased font size for numbers inside the gauge */
    color: #fff;
    line-height: 20px; /* Aligns the text vertically within the gauge */
}

.accuracy-fill {
    background-color: #4CAF50; /* Green color for accuracy */
}

.fluency-fill {
    background-color: #2196F3; /* Blue color for fluency */
}

.prosody-fill {
    background-color: #9C27B0; /* Purple color for prosody */
}

/*돌아가기버튼*/

#backButtonContainer {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

#backButton {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.back-icon {
    background-color: #3498db; /* Blue */
    color: white;
    border-radius: 50%;
    font-size: 24px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s;
}

.back-icon:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.back-text {
    font-size: 14px;
    color: #2c3e50;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-top: 5px;
    text-transform: uppercase;
    color: #34495e; /* Darker shade for better contrast */
}

#backButton:hover .back-text {
    color: #2980b9; /* Change text color on hover */
}


#backButton:focus {
    outline: none;
}


#backButton i {
    margin-right: 10px; /* Space between icon and text */
    font-size: 24px;
}


/*연습유형선택*/

#practiceTypeSelection {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 60px; /* Pushes the section down from the top */
}

#practiceTypeSelection h2 {
    margin-bottom: 30px; /* Space between the heading and buttons */
    font-size: 26px; /* Slightly larger font for the heading */
    color: #2c3e50;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 20px; /* Space between the buttons */
}

#practiceTypeSelection button {
    margin: 0; /* No margin needed, as we're using gap in the container */
    font-size: 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s;
}

#paragraphPractice {
    background-color: #34495e; /* Elegant dark blue-gray */
    color: white;
    width: 160px; /* Narrower width for the buttons */
    height: 180px;
}

#paragraphPractice:hover {
    background-color: #2c3e50; /* Slightly darker shade on hover */
    transform: scale(1.05);
}

#sentencePractice {
    background-color: #16a085; /* Sophisticated teal */
    color: white;
    width: 160px; /* Narrower width for the buttons */
    height: 180px;
}

#sentencePractice:hover {
    background-color: #149174; /* Slightly darker teal on hover */
    transform: scale(1.05);
}

#mobileParagraphPractice {
    background-color: #09B5FF; /* Elegant dark blue-gray */
    color: white;
    width: 160px; /* Narrower width for the buttons */
    height: 180px;
}

#mobileParagraphPractice:hover {
    background-color: #019DDF; /* Slightly darker shade on hover */
    transform: scale(1.05);
}

.button-main-text {
    font-size: 22px;
    font-weight: bold;
}

.button-description {
    font-size: 14px;
    margin-top: 5px;
    color: #ecf0f1; /* Light grey for the description text, to match the button text */
}

#editTextButtonContainer {
    display: flex;
    justify-content: left;
    margin-top: 20px;
}

.edit-text-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #34495e;
    transition: color 0.3s ease;
}

.edit-icon {
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    font-size: 24px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s;
}

.edit-text {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.edit-text-btn:hover {
    transform: scale(1.05);
}

.edit-text-btn:hover .edit-icon {
    transform: scale(1.05);
}

.edit-text-btn:focus {
    outline: none;
}

/*문장연습 대시보드*/

#sentencePracticeDashboard .dashboard-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
}

#sentencePracticeDashboard .dashboard-value {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
}

#spPracticeWords {
    font-size: 14px;
    color: #FF5252;
}

/*알림*/

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    transition: transform 0.3s ease-out;
    z-index: 1000;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

/*모바일*/


#mobileRecognitionSection {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 30px;
}

#errorTypeExplanation {
    font-size: 14px;
    margin-bottom: 15px;
}

#errorTypeExplanation div {
    margin-bottom: 5px;
}

.wordBox.correct {
    background-color: rgba(76, 175, 80, 0.3);
}

.wordBox.incorrect {
    background-color: rgba(244, 67, 54, 0.3);
}

.wordBox.omitted {
    background-color: rgba(255, 235, 59, 0.3);
}

.wordBox.insertion {
    background-color: rgba(156, 39, 176, 0.3);
}

.wordBox.unexpectedbreak {
    background-color: rgba(33, 150, 243, 0.3);
}

/* 모바일 환경을 위한 반응형 스타일 */
@media (max-width: 768px) {
    .container {
        max-width: 95% !important;
    }

    #mobileTextOverlay {
        font-size: 16px;
    }

    .btn-group .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-message {
    color: white;
    font-size: 24px;
    font-weight: bold;
}

.mobile-audio-control-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.btn-group {
    flex-shrink: 0;
}

#mobileAudioPlayer {
    flex-grow: 1;
    min-width: 0;
}

#mobileAudio {
    width: 100%;
}

.error-type-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.error-type-item {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .error-type-container {
        flex-direction: column;
        align-items: flex-start;
    }
}