* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1e1e1e;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
}

header {
    margin-bottom: 20px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.status {
    font-size: 14px;
    color: #888;
}

.status.ready {
    color: #4caf50;
}

.status.error {
    color: #f44336;
}

main {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #252525;
    border-radius: 8px;
    padding: 20px;
}

.editor-section label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #b0b0b0;
}

#prompt-input {
    flex: 1;
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

#prompt-input:focus {
    border-color: #6366f1;
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-secondary {
    background: #404040;
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: #505050;
}

.btn:active {
    transform: scale(0.98);
}

.tag-count {
    margin-left: auto;
    font-size: 13px;
    color: #888;
}

.info-panel {
    width: 280px;
    background: #252525;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
}

.info-panel h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #ffffff;
}

.info-panel ul {
    list-style: none;
}

.info-panel li {
    font-size: 13px;
    line-height: 1.8;
    color: #b0b0b0;
    margin-bottom: 8px;
}

.info-panel kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #3a3a3a;
    border: 1px solid #505050;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
    color: #e0e0e0;
}

/* Autocomplete Styles */
#autocomplete-root {
    position: absolute;
    z-index: 10000;
    background: #2d2d2d;
    border: 1px solid #505050;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    min-width: 300px;
}

#autocomplete-list {
    max-height: 400px;
    overflow-y: auto;
}

.autocomplete-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr) auto;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #353535;
    align-items: center;
    transition: background 0.1s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #353535;
}

.autocomplete-item.selected {
    background: #3a3f5c;
}

.autocomplete-tag-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-alias {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-tag-count {
    font-size: 11px;
    color: #6366f1;
    font-weight: 600;
    white-space: nowrap;
}

.autocomplete-already-exists {
    opacity: 0.4;
}

/* Tag category colors (Danbooru style) */
.autocomplete-item[data-tag-category="general"] .autocomplete-tag-name {
    color: #a0a0ff;
}

.autocomplete-item[data-tag-category="artist"] .autocomplete-tag-name {
    color: #ffa0a0;
}

.autocomplete-item[data-tag-category="copyright"] .autocomplete-tag-name {
    color: #ffa0ff;
}

.autocomplete-item[data-tag-category="character"] .autocomplete-tag-name {
    color: #a0ffa0;
}

.autocomplete-item[data-tag-category="meta"] .autocomplete-tag-name {
    color: #ffff80;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #505050;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #606060;
}

/* Related Tags Styles */
#related-tags-root {
    position: absolute;
    z-index: 9999;
    background: #2d2d2d;
    border: 1px solid #505050;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    width: 300px;
    max-height: 500px;
    display: none;
}

#related-tags-header {
    padding: 10px 12px;
    background: #353535;
    border-bottom: 1px solid #505050;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    color: #e0e0e0;
}

#related-tags-list {
    overflow-y: auto;
    max-height: 400px;
}

.related-tag-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #353535;
    align-items: center;
    transition: background 0.1s;
}

.related-tag-item:last-child {
    border-bottom: none;
}

.related-tag-item:hover {
    background: #353535;
}

.related-tag-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-tag-similarity {
    font-size: 11px;
    color: #7dd3fc;
    font-weight: 600;
    white-space: nowrap;
}

.related-tag-count {
    font-size: 11px;
    color: #a0a0ff;
    font-weight: 600;
    white-space: nowrap;
}

.related-tag-already-exists {
    opacity: 0.4;
}

.related-tags-message {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* Tag category colors for related tags */
.related-tag-item[data-tag-category="general"] .related-tag-name {
    color: #a0a0ff;
}

.related-tag-item[data-tag-category="artist"] .related-tag-name {
    color: #ffa0a0;
}

.related-tag-item[data-tag-category="copyright"] .related-tag-name {
    color: #ffa0ff;
}

.related-tag-item[data-tag-category="character"] .related-tag-name {
    color: #a0ffa0;
}

.related-tag-item[data-tag-category="meta"] .related-tag-name {
    color: #ffff80;
}