* {
    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: #f1f1f1;
    line-height: 1.6;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h4 {
    margin-bottom: 15px;
    color: #4CAF50;
    font-size: 16px;
}

.linked-items-list {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

.linked-items-list:empty::after {
    content: 'No items linked';
    color: #888;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 20px;
}

.linked-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #333;
    border-radius: 4px;
    margin-bottom: 8px;
}

.linked-item:last-child {
    margin-bottom: 0;
}

.linked-item-info {
    flex: 1;
}

.linked-item-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.linked-item-details {
    font-size: 12px;
    color: #aaa;
}

.search-container {
    position: relative;
}

.add-image-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.linked-item-actions {
    display: flex;
    gap: 8px;
}

.search-results .search-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #444;
    color: #f1f1f1;
    transition: background-color 0.2s;
    background: #333;
}

.search-results .search-result-item:hover {
    background: #3a3a3a;
}

.search-results .search-result-item.already-linked {
    opacity: 0.6;
    cursor: not-allowed;
    background: #2a2a2a;
}

.search-results .search-result-item.already-linked:hover {
    background: #2a2a2a;
}

.search-results-modal {
    max-height: 200px;
    overflow-y: auto;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    margin-top: 8px;
    display: none;
}

.search-results-modal .search-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #444;
    color: #f1f1f1;
    transition: background-color 0.2s;
}

.search-results-modal .search-result-item:hover {
    background: #333;
}

.search-results-modal .search-result-item:last-child {
    border-bottom: none;
}

.search-results-modal .search-result-item.already-linked {
    opacity: 0.6;
    cursor: not-allowed;
    background: #3a3a3a;
}

.search-results-modal .search-result-item.already-linked:hover {
    background: #3a3a3a;
}

.selected-songs-list {
    max-height: 150px;
    overflow-y: auto;
    background: #383838;
    border: 1px solid #555;
    border-radius: 4px;
    margin: 12px 0;
    padding: 8px;
}

.selected-song-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #2a2a2a;
    border-radius: 4px;
    border: 1px solid #555;
}

.selected-song-item:last-child {
    margin-bottom: 0;
}

.selected-song-item span {
    flex: 1;
    color: #f1f1f1;
    font-size: 13px;
}

.checkbox-section {
    margin: 12px 0;
    padding: 12px;
    background: #383838;
    border-radius: 4px;
    border: 1px solid #555;
}

.checkbox-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f1f1f1;
    cursor: pointer;
    margin: 0;
}

.checkbox-section input[type="checkbox"] {
    accent-color: #66b2ff;
}

.issue-meta {
    font-size: 11px;
    color: #aaa;
    background: #444;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #2c2c2c;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

h1 {
    color: #ffffff;
    margin-bottom: 20px;
    font-weight: 600;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #444;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #aaa;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #66b2ff;
    background: #292929;
}

.tab-button.active {
    color: #66b2ff;
    border-bottom-color: #66b2ff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.bulk-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #383838;
    border: 1px solid #555;
    border-radius: 6px;
    margin-bottom: 16px;
}

.song-checkbox-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.song-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #66b2ff;
}

.song-card {
    position: relative;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    background: #2a2a2a;
    transition: all 0.2s;
}

.song-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.song-card.selected {
    border-color: #66b2ff;
    background: #334155;
}

.song-card.changed {
    border-left: 4px solid #6fcf97;
}

.song-card.missing-tokens {
    border-left: 4px solid #ff9500;
    background: #2d2400;
}

.no-token-badge {
    background: #ff9500;
    color: #1e1e1e;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: auto;
    animation: pulse-warning 2s ease-in-out infinite;
}

.primary-badge {
    background: #4CAF50;
    color: #1e1e1e;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.quality-section {
    margin-top: 20px;
}

.quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.quality-card {
    background: #383838;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quality-card:hover {
    border-color: #66b2ff;
    box-shadow: 0 4px 8px rgba(102, 178, 255, 0.2);
    transform: translateY(-2px);
}

.quality-card h4 {
    color: #f1f1f1;
    margin-bottom: 12px;
    font-size: 16px;
}

.quality-count {
    font-size: 32px;
    font-weight: bold;
    color: #f87171;
    margin-bottom: 8px;
}

.quality-count.zero {
    color: #6fcf97;
}

.quality-card p {
    color: #aaa;
    font-size: 14px;
    margin: 0;
}

.quality-card.warning-card {
    background: #3d2800;
    border-color: #ff9500;
    animation: pulse-warning 2s ease-in-out infinite;
}

.quality-card.warning-card:hover {
    border-color: #ffaa00;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.quality-card.warning-card .quality-count {
    color: #ff9500;
    font-weight: 900;
}

.quality-card.warning-card h4 {
    color: #ffaa00;
}

.quality-card.error-card {
    background: #3d0000;
    border-color: #ff3333;
    animation: pulse-error 2s ease-in-out infinite;
}

.quality-card.error-card:hover {
    border-color: #ff4444;
    box-shadow: 0 4px 12px rgba(255, 51, 51, 0.3);
}

.quality-card.error-card .quality-count {
    color: #ff3333;
    font-weight: 900;
}

.quality-card.error-card h4 {
    color: #ff4444;
}

@keyframes pulse-warning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes pulse-error {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.issues-container {
    border-top: 1px solid #555;
    padding-top: 20px;
}

.bulk-actions {
    background: #383838;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid #555;
    display: none;
}

.bulk-actions.visible {
    display: block;
}

.bulk-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.selection-info {
    font-weight: 500;
    color: #f1f1f1;
}

.bulk-buttons {
    display: flex;
    gap: 8px;
}

.btn {
    background: #66b2ff;
    color: #1e1e1e;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn:hover {
    background: #3399ff;
}

.btn:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
}

.btn-secondary {
    background: #888;
    color: #1e1e1e;
}

.btn-secondary:hover {
    background: #999;
}

.btn-primary {
    background: #66b2ff;
    color: #1e1e1e;
}

.btn-success {
    background: #6fcf97;
    color: #1e1e1e;
}

.btn-success:hover {
    background: #5bbf88;
}

.btn-danger {
    background: #f87171;
    color: #1e1e1e;
}

.btn-danger:hover {
    background: #e25656;
}

.btn-warning {
    background: #ff9500;
    color: #1e1e1e;
    font-weight: 600;
}

.btn-warning:hover {
    background: #ffaa00;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.issue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #555;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #2a2a2a;
    transition: background-color 0.2s;
}

.issue-item:hover {
    background: #333;
}

.issue-item.selected {
    background: #334155;
    border-color: #66b2ff;
}

.issue-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.issue-checkbox {
    margin: 0;
    cursor: pointer;
    accent-color: #66b2ff;
}

.issue-title {
    font-weight: 500;
    color: #f1f1f1;
}

.issue-id {
    font-size: 12px;
    color: #aaa;
    background: #444;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 12px;
}

.issue-actions {
    display: flex;
    gap: 8px;
}

.select-all-container {
    background: #444;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-all-container label {
    font-weight: 500;
    color: #f1f1f1;
    margin: 0;
    cursor: pointer;
}

.bulk-items-list {
    max-height: 200px;
    overflow-y: auto;
    background: #383838;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px;
    margin: 12px 0;
}

.bulk-item {
    padding: 4px 8px;
    font-size: 13px;
    color: #f1f1f1;
}

.stats-section {
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #66b2ff, #3399ff);
    color: #1e1e1e;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(102, 178, 255, 0.3);
}

.stat-card h4 {
    margin-bottom: 12px;
    font-size: 14px;
    opacity: 0.9;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 8px;
}

.refresh-stats {
    text-align: center;
}

.search-section {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.search-section .btn {
    white-space: nowrap;
}

.search-bar {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #555;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: #2a2a2a;
    color: #f1f1f1;
}

.search-bar:focus {
    outline: none;
    border-color: #66b2ff;
}

.song-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.song-title {
    font-size: 20px;
    font-weight: 600;
    color: #f1f1f1;
}

.song-id {
    font-size: 14px;
    color: #aaa;
    background: #444;
    padding: 4px 8px;
    border-radius: 4px;
}

.metadata-section {
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.metadata-section h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #f1f1f1;
    font-size: 16px;
}

.metadata-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 16px;
}

.metadata-label {
    font-weight: 500;
    color: #f1f1f1;
    min-width: 100px;
    margin-top: 8px;
}

.metadata-value {
    flex: 1;
}

.editable-field {
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.2s;
    background: #2a2a2a;
    color: #f1f1f1;
}

.editable-field:focus {
    outline: none;
    border-color: #66b2ff;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 40px;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2a2a2a;
}

.tag {
    background: #66b2ff;
    color: #1e1e1e;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s;
}

.tag-remove {
    cursor: pointer;
    background: rgba(30, 30, 30, 0.3);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background-color 0.2s;
}

.tag-remove:hover {
    background: rgba(30, 30, 30, 0.5);
}

.add-tag-input {
    border: none;
    outline: none;
    padding: 6px;
    font-size: 13px;
    min-width: 120px;
    background: transparent;
    color: #f1f1f1;
}

.add-tag-input::placeholder {
    color: #aaa;
}

.actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #555;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-unverified { background: #e0a800; }
.status-verified { background: #6fcf97; }
.status-pending { background: #ffa94d; }

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2c2c2c;
    padding: 24px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-height: 90vh;
    overflow-y: auto;
    color: #f1f1f1;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #aaa;
}

.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    text-align: center;
    z-index: 999;
    color: #f1f1f1;
}

.spinner {
    border: 3px solid #444;
    border-top: 3px solid #66b2ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.relations-section {
    margin-top: 16px;
    padding: 12px;
    background: #383838;
    border-radius: 6px;
}

.relations-title {
    font-weight: 500;
    color: #f1f1f1;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.relations-title.missing-relation {
    color: #ff9500;
}

.missing-relation-warning {
    background: #3d2800;
    border: 2px solid #ff9500;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    color: #ffaa00;
    font-size: 13px;
    animation: pulse-warning 2s ease-in-out infinite;
}

.missing-relation-warning strong {
    color: #ff9500;
    font-weight: 700;
}

.bulk-token-list {
    background: #383838;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

.bulk-token-list h4 {
    color: #f1f1f1;
    margin-bottom: 8px;
    font-size: 14px;
}

.token-names-list {
    max-height: 150px;
    overflow-y: auto;
    background: #2a2a2a;
    border-radius: 4px;
    padding: 8px;
}

.token-name-item {
    padding: 6px 12px;
    margin-bottom: 4px;
    background: #66b2ff;
    color: #1e1e1e;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.token-name-item:last-child {
    margin-bottom: 0;
}

.bulk-edit-note {
    background: #3d2800;
    border: 1px solid #ff9500;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 12px 0;
    color: #ffaa00;
    font-size: 13px;
    font-style: italic;
}

.relation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #555;
    background: #2a2a2a;
    border-radius: 4px;
    margin-bottom: 4px;
}

.relation-item:last-child {
    border-bottom: none;
}

.relation-info {
    flex: 1;
}

.relation-type {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
}

.relation-name {
    font-size: 13px;
    color: #f1f1f1;
    word-break: break-all;
}

.relation-meta {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

.relation-actions {
    display: flex;
    gap: 4px;
}

.id-field {
    width: 150px;
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.add-form {
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 12px;
    margin-top: 8px;
    display: none;
}

.add-form.active {
    display: block;
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.form-row input, .form-row select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    background: #333;
    color: #f1f1f1;
}

.search-dropdown {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #555;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #444;
    color: #f1f1f1;
}

.search-result-item:hover {
    background: #333;
}

.search-result-item:last-child {
    border-bottom: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.success-message {
    background: #264d3b;
    color: #a4f5c1;
    border: 1px solid #3b7052;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.error-message {
    background: #5a1f1f;
    color: #f5bfbf;
    border: 1px solid #a83e3e;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 16px;
    }
    
    .search-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .metadata-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .metadata-label {
        min-width: auto;
        margin-top: 0;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        min-width: 100px;
    }
    
    .quality-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .issue-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .issue-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .bulk-edit-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .song-checkbox-container {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 10px;
    }
    
    .two-column {
        grid-template-columns: 1fr;
    }
    
    .relation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .relation-actions {
        width: 100%;
        justify-content: flex-end;
    }
}