* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 12px;
}

.tag-selector-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.tag-selector-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-selector-content {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 700px;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.tag-selector-header {
    padding: 15px 20px;
    background: linear-gradient(to bottom, #f5f5f5, #e8e8e8);
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px 4px 0 0;
}

.tag-selector-header h2 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.tag-selector-body {
    padding: 15px 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tag-search {
    margin-bottom: 15px;
}

.tag-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
}

.tag-search input:focus {
    outline: none;
    border-color: #4A90E2;
}

.tag-categories {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.category-btn:hover {
    background-color: #e0e0e0;
}

.category-btn.active {
    background-color: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

.tag-list-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.tag-table {
    width: 100%;
    border-collapse: collapse;
}

.tag-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    z-index: 10;
}

.tag-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #333;
    border-bottom: 2px solid #ccc;
}

.tag-table tbody tr {
    cursor: pointer;
    transition: background-color 0.1s;
}

.tag-table tbody tr:hover {
    background-color: #f0f8ff;
}

.tag-table tbody tr.selected {
    background-color: #4A90E2;
    color: white;
}

.tag-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
}

.tag-table td:first-child {
    font-family: 'Courier New', monospace;
    color: #0066cc;
    font-weight: 600;
}

.tag-table tbody tr.selected td:first-child {
    color: white;
}

.tag-selector-footer {
    padding: 15px 20px;
    background-color: #f5f5f5;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 4px 4px;
}

.btn-cancel,
.btn-insert {
    padding: 8px 20px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.btn-cancel {
    background-color: white;
    color: #333;
}

.btn-cancel:hover {
    background-color: #f0f0f0;
}

.btn-insert {
    background-color: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

.btn-insert:hover {
    background-color: #357ABD;
}

.btn-insert:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* Scrollbar styling */
.tag-list-container::-webkit-scrollbar {
    width: 10px;
}

.tag-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tag-list-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.tag-list-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Drag and Drop Styles */
.draggable-tag {
    cursor: grab;
}

.draggable-tag.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.drag-handle {
    color: #999;
    margin-right: 8px;
    font-size: 14px;
    user-select: none;
}

.draggable-tag:hover .drag-handle {
    color: #666;
}

/* Drop Zone Styles */
.drop-zone {
    position: relative;
}

.drop-zone.drag-over {
    outline: 2px dashed #4A90E2;
    outline-offset: -2px;
    background-color: rgba(74, 144, 226, 0.05);
}

.drop-zone.drag-over::after {
    content: 'Drop tag here';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 1000;
}
