* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

h2 {
    color: #444;
    margin-bottom: 15px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    gap: 10px;
}

#uploadForm .form-group:last-child {
    margin-top: 5px;
}

input[type="text"],
input[type="file"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
}

button {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0056b3;
}

.preview-container {
    position: relative;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
    overflow: hidden;
}

.preview {
    width: 100%;
    min-height: 300px;
    height: 300px;
    padding: 15px;
    border: none;
    background-color: transparent;
    white-space: pre-wrap;
    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 20px;
    resize: vertical;
    outline: none;
    z-index: 1;
    color: transparent;
    caret-color: #000;
    overflow-y: auto;
    box-sizing: border-box;
    position: relative;
    letter-spacing: normal;
}

.highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 15px;
    white-space: pre-wrap;
    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 20px;
    pointer-events: none;
    z-index: 0;
    color: #000;
    overflow-y: hidden;
    box-sizing: border-box;
    letter-spacing: normal;
}

/* Style the resize handle */
.preview::-webkit-resizer {
    background-color: #ddd;
    border: 1px solid #ccc;
}

/* Add a subtle transition for smooth resizing */
.preview-container, .preview, .highlight-layer {
    transition: height 0.05s ease-out;
}

.search-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    background-color: #f1f3f4;
    padding: 10px;
    border-radius: 4px;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    background: #fff;
    border-radius: 4px;
    padding: 5px 10px;
    border: 1px solid #ddd;
}

.search-input-group input {
    flex: 1;
    padding: 8px;
    border: none;
    outline: none;
    font-size: 14px;
}

#searchCount {
    color: #666;
    min-width: 60px;
    font-size: 13px;
}

#clearSearch {
    padding: 8px 12px;
    font-size: 13px;
    background-color: #fff;
    border: 1px solid #ddd;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
}

#clearSearch:hover {
    background-color: #f8f9fa;
    border-color: #bbb;
}

.action-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    padding: 10px 0;
}

.action-buttons button {
    padding: 10px 20px;
}

.highlight {
    background-color: rgba(255, 235, 59, 0.3);
    border-radius: 2px;
    padding: 2px 4px;
    margin: -2px -4px;
    display: inline-block;
}

.format-toolbar {
    display: none;
    position: absolute;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    gap: 5px;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
}

.format-toolbar button {
    min-width: 30px;
    height: 30px;
    padding: 5px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
}

.format-toolbar button:hover {
    background: #f1f1f1;
}

.format-toolbar button.active {
    background: #e3e3e3;
    border-color: #999;
}

.color-picker {
    position: relative;
    display: inline-block;
}

.color-indicator {
    width: 15px;
    height: 15px;
    border: 1px solid #ddd;
    display: inline-block;
    background: #000;
}

.color-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 150px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.color-grid button {
    width: 100%;
    text-align: left;
    padding: 5px;
}

#customColor {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

#wordBankList {
    margin-top: 15px;
}

.word-pair {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.word-pair:last-child {
    border-bottom: none;
}

.word-content {
    flex: 1;
    margin-right: 10px;
}

.word-actions {
    display: flex;
    gap: 5px;
}

.word-edit-form {
    display: flex;
    gap: 5px;
    align-items: center;
}

.edit-non-humanize,
.edit-humanize {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.edit-btn,
.delete-btn,
.save-edit,
.cancel-edit {
    padding: 4px 8px;
    font-size: 0.9em;
}

.edit-btn {
    background-color: #28a745;
}

.delete-btn {
    background-color: #dc3545;
}

.save-edit {
    background-color: #007bff;
}

.cancel-edit {
    background-color: #6c757d;
}
