/* Phong cách tổng thể */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap'); /* Import Google Font */

body {
  font-family: 'Roboto', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start; /* Align items to the top */
  min-height: 100vh;
  background: linear-gradient(to bottom right, #83a4d4, #b6fbff);
  color: #333;
  padding-top: 30px; /* Add some padding at the top */
  padding-bottom: 30px; /* Add padding at the bottom */
}

.container {
  background: #ffffff;
  padding: 30px 40px; /* Adjust padding */
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  width: 90%; /* Use percentage for responsiveness */
  max-width: 900px; /* Max width */
  text-align: center;
  margin: auto;
}

h2 {
  color: #333;
  margin-top: 0; /* Remove default margin */
  margin-bottom: 20px;
}

/* Thẻ hiển thị từ vựng */
.word-card {
  font-size: 22px; /* Adjust font size */
  margin-bottom: 15px; /* Reduce margin */
  padding: 25px;
  border: 1px solid #ddd;
  border-radius: 8px; /* Slightly increase radius */
  cursor: pointer;
  min-height: 250px; /* Ensure minimum height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #fdfdfd;
  transition: box-shadow 0.3s ease;
}

.word-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.word-card b {
  display: block;
  font-size: 34px; /* Adjust font size */
  margin-bottom: 10px;
  color: #007bff;
}

.word-card img {
  max-width: 60%; /* Adjust image size */
  max-height: 150px; /* Limit image height */
  height: auto;
  margin-bottom: 15px;
  border-radius: 8px;
  object-fit: cover; /* Ensure image covers area nicely */
}

.word-card p {
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 1.1em; /* Slightly larger meaning text */
    color: #555;
}

/* Example sentence styling */
#exampleSentence {
    font-size: 0.95em;
    color: #444;
    font-style: italic;
    margin-top: 15px;
    line-height: 1.4;
}
#exampleSentence b {
    font-size: 0.9em; /* Smaller 'Ví dụ:' label */
    color: #333; /* Reset color for label */
    font-style: normal;
    margin-bottom: 0;
    display: inline; /* Make label inline */
}
#exampleSentence span { /* Style for highlighted word */
    color: #e74c3c; /* Red color for highlight */
    font-weight: bold;
}


/* Nút chức năng */
.button-container {
    display: flex;
    justify-content: center;
    gap: 15px; /* Space between buttons */
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    margin-top: 15px;
    margin-bottom: 15px;
}

.btn {
  background-color: #007bff;
  color: #fff;
  padding: 12px 25px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease;
  display: inline-flex; /* Align icon and text */
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background-color: #0056b3;
  transform: translateY(-1px); /* Slight lift effect */
}

.btn:active {
    transform: translateY(0px); /* Push down effect on click */
}

.btn i {
  margin-right: 8px;
}

/* Nút loại trừ đặc biệt */
#excludeCurrentWordButton,
#excludeWordButton {
    background-color: #ffc107;
    color: #333;
}
#excludeCurrentWordButton:hover,
#excludeWordButton:hover {
    background-color: #e0a800;
}

#excludeCurrentWordButton {
    padding: 8px 15px;
    font-size: 14px;
    margin-top: 5px;
}

/* ===== CSS CHO TABS ===== */
.tabs-container {
    width: 100%;
    margin-top: 30px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background-color: #e9ecef;
}

.tab-button {
    padding: 12px 15px; /* Adjust padding for smaller screens */
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 15px; /* Adjust font size */
    font-weight: 500;
    color: #495057;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    flex-grow: 1;
    text-align: center;
    border-bottom: 3px solid transparent;
    white-space: nowrap; /* Prevent wrapping */
}

.tab-button:hover {
    background-color: #dee2e6;
    color: #343a40;
}

.tab-button.active {
    background-color: #ffffff;
    color: #007bff;
    border-bottom: 3px solid #007bff;
}

.tab-content {
    padding: 25px;
    background-color: #ffffff;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.tab-panel.active {
    display: block;
}

/* Style chung cho các bảng trong tab */
.tab-panel h2, .tab-panel h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.tab-panel table {
    width: 100% !important;
    max-width: 100%;
    margin: 15px auto;
    border-collapse: collapse;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Lighter shadow for tables */
}

.tab-panel th,
.tab-panel td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

.tab-panel th {
    color: white;
    font-weight: 500;
}

/* Màu nền tiêu đề riêng cho từng bảng */
#historyTable th { background-color: #17a2b8; } /* Teal color for history */
#customWordsTable th { background-color: #007bff; } /* Blue for custom words */
#excludedWordsTable th { background-color: #6c757d; } /* Grey for excluded */

.tab-panel tbody tr:nth-child(even) {
  background-color: #f8f9fa; /* Consistent stripe color */
}

.tab-panel tbody tr:hover {
  background-color: #e9ecef; /* Consistent hover color */
}

/* Input group styling */
.tab-panel .input-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.tab-panel input[type="text"] {
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 15px;
  flex-grow: 1;
  min-width: 180px; /* Adjust min-width */
}

.tab-panel input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* Nút trong các tab */
#addWordButton {
    padding: 10px 20px;
    font-size: 15px;
}

/* Nút xóa/học lại */
.delete-btn, .remove-exclusion-btn {
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s ease;
}

.delete-btn {
  background-color: #e74c3c; /* Red */
}
.delete-btn:hover {
  background-color: #c0392b;
}

.remove-exclusion-btn {
  background-color: #28a745; /* Green */
}
.remove-exclusion-btn:hover {
  background-color: #218838;
}

/* Căn giữa nút trong ô cuối bảng */
.tab-panel td:last-child {
    text-align: center;
}

/* Animation cho tab panel */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ===== KẾT THÚC CSS CHO TABS ===== */


/* Phần chọn giọng đọc */
#voiceSelectionContainer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: center; /* Center align the voice selection */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#voiceSelectionContainer label {
  font-weight: bold;
  color: #555;
  margin-bottom: 0; /* Remove bottom margin if flex aligns */
}

#voiceSelect {
  padding: 8px 15px;
  font-size: 15px;
  min-width: 250px;
  max-width: 100%; /* Allow shrinking */
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f8f9fa;
  border-radius: 8px; /* Match button radius */
  /* Inherit some button styles if needed, or define explicitly */
   color: #333; /* Text color for select */
   box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }
    .word-card {
        padding: 20px;
        font-size: 20px;
    }
    .word-card b {
        font-size: 28px;
    }
    .word-card img {
        max-width: 70%;
        max-height: 120px;
    }
    .btn {
        padding: 10px 20px;
        font-size: 15px;
    }
    .tab-button {
        font-size: 14px;
        padding: 10px 12px;
    }
    .tab-content {
        padding: 15px;
    }
    .tab-panel .input-group {
        flex-direction: column; /* Stack inputs vertically */
        align-items: stretch; /* Make inputs full width */
    }
     .tab-panel input[type="text"],
     #addWordButton, #excludeWordButton {
        width: 100%; /* Make inputs/buttons full width in the group */
        box-sizing: border-box; /* Include padding/border in width */
     }
     #voiceSelectionContainer {
        flex-direction: column; /* Stack label and select */
        align-items: center;
     }
     #voiceSelect {
        width: 90%; /* Make select wider */
     }
}

@media (max-width: 480px) {
    .word-card b {
        font-size: 24px;
    }
     .word-card p {
        font-size: 1em;
     }
     #exampleSentence {
        font-size: 0.85em;
     }
    .tab-button {
        font-size: 13px;
        padding: 10px 8px;
    }
     .tab-panel th, .tab-panel td {
        padding: 8px;
     }
     .delete-btn, .remove-exclusion-btn {
        padding: 5px 8px;
        font-size: 12px;
     }
}