/**
 * Build Library Manager Styles
 * Dark theme with gold accents matching Jotunheim Magic design
 */

/* ==================== Container & Layout ==================== */
.build-library-wrapper {
    max-width: none;
    margin: 0 auto;
    padding: 20px;
    background: rgba(20, 20, 25, 0.95);
    border-radius: 12px;
    border: 2px solid #8b7355;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f5f5dc;
}

/* ==================== Header ==================== */
.build-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.3) 0%, rgba(20, 20, 25, 0.9) 100%);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #8b7355;
}

.build-library-header h1 {
    margin: 0;
    color: #ffd700;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.header-info {
    display: flex;
    gap: 15px;
}

.era-badge, .user-badge {
    background: rgba(139, 115, 85, 0.5);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid #8b7355;
}

/* ==================== Tabs ==================== */
.build-library-tabs {
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 24px;
    background: rgba(139, 115, 85, 0.3);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(139, 115, 85, 0.5);
}

.tab-button.active {
    background: linear-gradient(135deg, #8b7355 0%, #d4af37 100%);
    color: #1a1a1a;
    font-weight: bold;
}

/* ==================== Tab Content ==================== */
.tab-content {
    display: none;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(139, 115, 85, 0.3);
}

.tab-content.active {
    display: block;
}

.tab-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.5);
}

.tab-header h2 {
    margin: 0 0 10px 0;
    color: #ffd700;
}

.tab-header p {
    margin: 0;
    color: #a0a0a0;
}

/* ==================== Upload Zone ==================== */
.upload-zone {
    border: 3px dashed #8b7355;
    border-radius: 12px;
    padding: 50px;
    text-align: center;
    background: rgba(139, 115, 85, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 20px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.upload-zone h3 {
    margin: 0 0 10px 0;
    color: #ffd700;
}

.upload-zone p {
    margin: 0 0 20px 0;
    color: #a0a0a0;
}

/* ==================== Upload Progress ==================== */
.upload-progress-container {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.progress-bar {
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #8b7355;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b7355 0%, #ffd700 100%);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: #a0a0a0;
}

/* ==================== Upload Results ==================== */
.upload-results {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid #8b7355;
}

.upload-results h4 {
    margin: 0 0 15px 0;
    color: #ffd700;
}

.upload-result-item {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-result-item.success {
    background: rgba(40, 167, 69, 0.2);
    border-left: 4px solid #28a745;
}

.upload-result-item.error {
    background: rgba(220, 53, 69, 0.2);
    border-left: 4px solid #dc3545;
}

.upload-result-item.duplicate {
    background: rgba(255, 193, 7, 0.2);
    border-left: 4px solid #ffc107;
}

/* ==================== Section Headers ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px 0;
}

.section-header h3 {
    margin: 0;
    color: #ffd700;
}

.dump-chest-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.dump-chest-search-input {
    padding: 14px 16px !important;
    font-size: 16px !important;
    text-align: center;
    min-width: 400px !important;
    max-width: 600px;
}

.search-input {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 14px;
    min-width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: rgba(139, 115, 85, 0.8);
    background: rgba(0, 0, 0, 0.5);
}

.search-input::placeholder {
    color: #888;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #8b7355 0%, #d4af37 100%);
    color: #1a1a1a;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a08866 0%, #e5c048 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: rgba(139, 115, 85, 0.5);
    color: #f5f5dc;
    border: 1px solid #8b7355;
}

.btn-secondary:hover {
    background: rgba(139, 115, 85, 0.7);
}

.btn-danger {
    background: rgba(220, 53, 69, 0.8);
    color: #fff;
}

.btn-danger:hover {
    background: rgba(220, 53, 69, 1);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* ==================== Filter Bar ==================== */
/* ==================== Filter Bar (moved to end, see line ~2671) ==================== */

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    padding: 0;
    margin: 0 10px 0 0;
}

.filter-group label {
    font-size: 0.85em;
    color: #a0a0a0;
    background: transparent;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    background: rgba(30, 30, 35, 0.9);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 0.95em;
    height: 38px; /* Ensure consistent height */
    line-height: 1.5;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #ffd700;
}

/* ==================== TEMP Toggle ==================== */
.temp-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

/* Filter toggle (in Build Library tab header) */
.temp-filter-toggle-switch {
    width: 60px;
    height: 30px;
    background: #555;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.temp-filter-toggle-switch.active {
    background: #ffd700;
}

.temp-filter-toggle-switch.active .temp-toggle-slider {
    transform: translateX(30px);
}

/* Edit modal toggle */
.temp-toggle {
    width: 60px;
    height: 30px;
    background: #555;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.temp-toggle.active {
    background: #ffd700;
}

.temp-toggle-slider {
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.temp-toggle.active .temp-toggle-slider {
    transform: translateX(30px);
}

.temp-toggle-label {
    font-size: 0.9em;
    color: #f5f5dc;
    font-weight: 500;
}

/* ==================== Tag Filter ====================  */
.tag-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.tag-filter-item {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    background: transparent;
}

.tag-filter-item input {
    display: none;
}

.tag-filter-item .tag-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    color: #fff;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.tag-filter-item input:checked + .tag-badge {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
}

.no-tags {
    color: #666;
    font-style: italic;
}

/* ==================== Builds Table ==================== */
.builds-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(139, 115, 85, 0.3);
}

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

.builds-table th,
.builds-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.builds-table th {
    background: rgba(139, 115, 85, 0.3);
    color: #ffd700;
    font-weight: 600;
    white-space: nowrap;
}

.builds-table tr:hover {
    background: rgba(139, 115, 85, 0.15);
}

.builds-table .loading {
    text-align: center;
    color: #a0a0a0;
    padding: 30px;
}

/* Checkbox column */
.checkbox-header,
.checkbox-cell {
    width: 40px;
    text-align: center;
}

.checkbox-cell input[type="checkbox"],
.checkbox-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ==================== Tag Badge ==================== */
.tag-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    color: #fff;
    margin: 2px;
}

.tags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ==================== Status Badge ==================== */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-badge.unorganized {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
    border: 1px solid #ffc107;
}

.status-badge.organized {
    background: rgba(40, 167, 69, 0.3);
    color: #28a745;
    border: 1px solid #28a745;
}

.status-badge.archived {
    background: rgba(108, 117, 125, 0.3);
    color: #6c757d;
    border: 1px solid #6c757d;
}

/* ==================== Actions ==================== */
.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ==================== Builds List (Cards) ==================== */
.builds-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.build-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.build-card:hover {
    border-color: #ffd700;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.1);
}

.build-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.build-card-title {
    font-weight: 600;
    color: #ffd700;
    font-size: 1.1em;
    word-break: break-word;
}

.build-card-meta {
    font-size: 0.85em;
    color: #a0a0a0;
    margin-bottom: 10px;
}

.build-card-tags {
    margin-bottom: 10px;
}

.build-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== Pagination ==================== */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 14px;
    background: rgba(139, 115, 85, 0.3);
    border: 1px solid #8b7355;
    border-radius: 4px;
    color: #f5f5dc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    background: rgba(139, 115, 85, 0.5);
}

.pagination-btn.active {
    background: #ffd700;
    color: #1a1a1a;
    font-weight: bold;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Preset Creator ==================== */
.preset-creator {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.preset-creator h3 {
    margin: 0 0 20px 0;
    color: #ffd700;
}

/* ==================== Form Elements ==================== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #a0a0a0;
    font-size: 0.9em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 0.95em;
    height: 42px; /* Ensure consistent height for inputs and selects */
    line-height: 1.5;
}

.form-group input[type="color"] {
    width: 60px;
    height: 42px;
    padding: 4px;
    cursor: pointer;
    border: 2px solid #8b7355;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
}

/* Prevent color picker's form-group from expanding */
.form-group:has(input[type="color"]) {
    flex: 0 0 auto;
    min-width: auto;
}

.form-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.form-group input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ffd700;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    height: auto; /* Allow textarea to be taller */
}

/* ==================== PB Options ==================== */
.pb-options {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.pb-options h4 {
    margin: 0 0 15px 0;
    color: #d4af37;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: rgba(139, 115, 85, 0.3);
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ffd700;
}

.option-item span {
    font-family: monospace;
    font-size: 0.9em;
}

/* ==================== Command Preview ==================== */
.command-preview {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #8b7355;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.command-preview label {
    display: block;
    margin-bottom: 8px;
    color: #a0a0a0;
}

.command-output {
    background: #1a1a1a;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.command-output code {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #00ff00;
    font-size: 1.1em;
    white-space: nowrap;
}

/* ==================== Saved Presets ==================== */
.saved-presets {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
}

.saved-presets h3 {
    margin: 0 0 20px 0;
    color: #ffd700;
}

.presets-list {
    display: grid;
    gap: 15px;
}

.preset-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-card:hover {
    border-color: #8b7355;
}

.preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preset-header h4 {
    margin: 0;
    color: #f5f5dc;
}

.preset-info h4 {
    margin: 0 0 5px 0;
    color: #f5f5dc;
}

.preset-info p {
    margin: 0;
    font-size: 0.85em;
    color: #a0a0a0;
}

.preset-command {
    font-family: monospace;
    font-size: 1em;
    color: #00ff00;
    background: #0a0a0a;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.preset-command:hover {
    background: #1a1a1a;
    border-color: #00ff00;
}

.preset-command:active {
    background: #2a2a2a;
}

.preset-command code {
    flex: 1;
    word-break: break-all;
}

.preset-command .copy-hint {
    color: #888;
    font-size: 0.85em;
    margin-left: 15px;
    white-space: nowrap;
}

.preset-command:hover .copy-hint {
    color: #00ff00;
}

.preset-actions {
    display: flex;
    gap: 8px;
}

.presets-help {
    color: #a0a0a0;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* ==================== Config Section ==================== */
.config-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.config-section h3 {
    margin: 0 0 20px 0;
    color: #ffd700;
}

.tag-creator {
    margin-bottom: 30px;
}

.existing-tags h4 {
    margin: 0 0 15px 0;
    color: #d4af37;
}

.tags-list {
    display: grid;
    gap: 10px;
}

.tag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.tag-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.tag-item-actions {
    display: flex;
    gap: 8px;
}

/* ==================== Danger Zone ==================== */
.danger-zone {
    background: rgba(220, 53, 69, 0.1) !important;
    border-color: rgba(220, 53, 69, 0.5) !important;
    margin-top: 40px;
}

/* API Access Section */
.api-access-section {
    margin-top: 40px;
}

.api-access-section h3 {
    color: #4a90e2;
}

.api-access-section p {
    color: #a0a0a0;
    margin-bottom: 15px;
}

.api-access-controls {
    display: flex;
    gap: 10px;
}

.danger-zone h3 {
    color: #dc3545 !important;
}

.danger-warning {
    color: #ff6b6b;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
}

.danger-info h4 {
    margin: 0 0 5px 0;
    color: #f5f5dc;
}

.danger-info p {
    margin: 0;
    color: #a0a0a0;
    font-size: 0.9em;
}

.danger-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.danger-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f5f5dc;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
}

.danger-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.danger-checkbox span {
    cursor: pointer;
}

#remove-all-data:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #666 !important;
    border-color: #555 !important;
}

#remove-all-data:disabled:hover {
    background: #666 !important;
    border-color: #555 !important;
}


/* ==================== Modal ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a2e;
    border: 2px solid #8b7355;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(139, 115, 85, 0.3);
    border-bottom: 1px solid #8b7355;
}

.modal-header h3 {
    margin: 0;
    color: #ffd700;
}

.modal-close {
    background: none;
    border: none;
    color: #f5f5dc;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #ffd700;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ==================== Toast Notifications ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    border-radius: 8px;
    color: #fff;
    min-width: 250px;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.closing {
    animation: slideOut 0.3s ease forwards;
}

.toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #1a1a1a;
}

.toast.info {
    background: linear-gradient(135deg, #17a2b8 0%, #6c757d 100%);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

/* ==================== Loading States ==================== */
.loading {
    color: #a0a0a0;
    font-style: italic;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #a0a0a0;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #f5f5dc;
}

.empty-state p {
    margin: 0;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .build-library-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-info {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .preset-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .builds-list {
        grid-template-columns: 1fr;
    }
}

/* ==================== Duplicate Dialog ==================== */
.duplicate-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.duplicate-dialog {
    background: rgba(30, 30, 35, 0.98);
    border: 2px solid #8b7355;
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.duplicate-dialog h3 {
    margin: 0 0 15px 0;
    color: #ffc107;
    font-size: 1.4em;
}

.duplicate-dialog p {
    color: #a0a0a0;
    margin-bottom: 15px;
}

.duplicate-list {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.duplicate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.duplicate-item:last-child {
    border-bottom: none;
}

.duplicate-name {
    color: #ffc107;
    font-weight: 500;
}

.duplicate-exists {
    color: #888;
    font-size: 0.85em;
}

.duplicate-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.duplicate-actions .btn {
    width: 100%;
    justify-content: center;
}

/* ==================== Reprocess Section ==================== */
.reprocess-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.reprocess-section h3 {
    margin: 0 0 15px 0;
    color: #ffd700;
}

.reprocess-section p {
    color: #a0a0a0;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.reprocess-options {
    margin-bottom: 20px;
}

.reprocess-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
}

.reprocess-option:hover {
    background: rgba(139, 115, 85, 0.2);
}

.reprocess-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.reprocess-option label {
    color: #f5f5dc;
    cursor: pointer;
}

.reprocess-option .option-desc {
    color: #888;
    font-size: 0.85em;
    margin-left: 28px;
}

.reprocess-results {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    display: none;
}

.reprocess-results.visible {
    display: block;
}

.reprocess-results h4 {
    margin: 0 0 10px 0;
    color: #28a745;
}

.reprocess-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85em;
    color: #a0a0a0;
}

.reprocess-log .log-item {
    padding: 4px 0;
    border-bottom: 1px solid rgba(139, 115, 85, 0.1);
}

.reprocess-log .log-item.success {
    color: #28a745;
}

.reprocess-log .log-item.warning {
    color: #ffc107;
}

.reprocess-log .log-item.error {
    color: #dc3545;
}


/* ==================== Tag Selection Modal ==================== */
.tag-select-modal h4 {
    margin: 0 0 15px 0;
    color: #ffd700;
}

.tag-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tag-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-checkbox-item:hover {
    background: rgba(139, 115, 85, 0.3);
}

.tag-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.tag-select-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tag search input - taller, wider, centered */
.tag-search-input {
    width: 80% !important;
    max-width: 600px;
    margin: 0 auto;
    display: block;
    padding: 14px 16px !important;
    font-size: 16px !important;
    text-align: center;
}

/* ==================== Assign Parent Modal ==================== */
.assign-parent-modal h4 {
    margin: 0 0 15px 0;
    color: #ffd700;
}

.assign-parent-modal .form-group {
    margin-bottom: 20px;
}

.assign-parent-modal label {
    display: block;
    margin-bottom: 6px;
    color: #f5f5dc;
    font-weight: 600;
}

.assign-parent-modal input[type="text"] {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 14px;
}

/* Parent search input - taller, wider, centered */
.parent-search-input {
    padding: 14px 16px !important;
    font-size: 16px !important;
    text-align: center;
    width: 100% !important;
}

.parent-search-container {
    width: 80%;
    max-width: 600px;
    margin: 0 auto;
}

.assign-parent-modal small {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.85em;
}

.assign-parent-status {
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: 600;
}

#assign-parent-options {
    margin-top: 20px;
    padding: 20px;
    background: rgba(139, 115, 85, 0.1);
    border: 2px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
}

.assign-parent-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ==================== Edit Build Form ==================== */
.edit-build-form .form-group {
    margin-bottom: 20px;
}

.edit-build-form label {
    display: block;
    margin-bottom: 6px;
    color: #a0a0a0;
    font-size: 0.9em;
}

.edit-build-form input[type="text"],
.edit-build-form select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 0.95em;
    height: 42px; /* Ensure consistent height */
    line-height: 1.5;
}

.edit-build-form input[type="text"]:focus,
.edit-build-form select:focus {
    outline: none;
    border-color: #ffd700;
}

.versions-list {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.version-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.version-item:last-child {
    border-bottom: none;
}

.version-build-name {
    color: #ffd700;
    font-weight: 500;
    min-width: 150px;
    flex-shrink: 0;
}

.version-number {
    font-weight: 600;
    color: #ffd700;
    min-width: 80px;
}

.version-date {
    color: #888;
    font-size: 0.85em;
}

.version-size {
    color: #888;
    font-size: 0.85em;
}

.current-badge {
    background: rgba(40, 167, 69, 0.3);
    color: #28a745;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.edit-build-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(139, 115, 85, 0.3);
}

/* ==================== Toggle Switches ==================== */
.options-help {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 15px;
}

.options-help code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffd700;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0; /* Remove gap, use specific margins instead */
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    margin-bottom: 12px; /* Add margin between toggles */
}

.toggle-item:hover {
    background: rgba(139, 115, 85, 0.3);
}

.toggle-label {
    color: #f5f5dc;
    font-size: 0.95em;
    min-width: 120px; /* Reduced from 150px for tighter layout */
    max-width: 180px; /* Set reasonable max width */
    word-wrap: break-word;
    line-height: 1.4;
    margin-right: 4px; /* Add small margin to separate from switch */
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
    margin: 0 4px; /* 4px on both sides for consistent spacing */
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(108, 117, 125, 0.5);
    border: 1px solid #6c757d;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #f5f5dc;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(40, 167, 69, 0.5);
    border-color: #28a745;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background-color: #28a745;
}

.toggle-value {
    min-width: 50px;
    text-align: center;
    font-family: monospace;
    font-size: 0.9em;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
    margin-right: 10px; /* Add right margin to create space after value */
}

.toggle-value.true {
    color: #28a745;
}

.toggle-value.false {
    color: #dc3545;
}

.rotation-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.rotation-group label {
    margin: 0;
    color: #f5f5dc;
}

.rotation-group input {
    width: 100px;
}

.rotation-hint {
    color: #888;
    font-size: 0.85em;
}

/* ==================== Version Accordion (Build Library) ==================== */
.expand-header {
    width: 40px;
    min-width: 40px;
}

.expand-cell {
    width: 40px;
    text-align: center;
}

.btn-expand {
    background: rgba(139, 115, 85, 0.3);
    border: 1px solid #8b7355;
    border-radius: 4px;
    color: #ffd700;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-expand:hover {
    background: rgba(139, 115, 85, 0.5);
}

.expand-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 10px;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.version-label {
    font-size: 0.8em;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    white-space: nowrap;
    display: inline-block;
}

.versions-row {
    background: rgba(0, 0, 0, 0.2);
}

.versions-container {
    padding: 0 !important;
}

.versions-loading {
    padding: 20px;
    text-align: center;
    color: #a0a0a0;
}

.versions-content {
    padding: 0;
}

.version-accordion-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    margin: 0;
}

.version-header-row {
    display: flex;
    padding: 10px 15px;
    background: rgba(139, 115, 85, 0.2);
    font-weight: 600;
    color: #d4af37;
    font-size: 0.85em;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.version-accordion-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.15);
    align-items: center;
    transition: background 0.2s ease;
}

.version-accordion-item:hover {
    background: rgba(139, 115, 85, 0.15);
}

.version-accordion-item.current {
    background: rgba(40, 167, 69, 0.1);
    border-left: 3px solid #28a745;
}

.version-accordion-item:last-child {
    border-bottom: none;
}

.version-col {
    flex: 1;
    font-size: 0.9em;
}

.version-col.version-number-col {
    flex: 0.8;
}

.version-col.version-actions {
    flex: 1.2;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.version-badge {
    background: rgba(139, 115, 85, 0.4);
    color: #ffd700;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
}

.current-version-badge {
    background: rgba(40, 167, 69, 0.3);
    color: #28a745;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.85em;
}

.duplicate-badge {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.85em;
}

.no-versions {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

.error-message {
    padding: 20px;
    text-align: center;
    color: #dc3545;
}

/* ==================== Build Editor Tab ==================== */
.editor-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.editor-section h3 {
    color: #d4af37;
    margin: 0 0 15px 0;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    padding-bottom: 10px;
}

.editor-section h4 {
    color: #c0a060;
    margin: 15px 0 10px 0;
    font-size: 1em;
}

.section-help {
    color: #a0a0a0;
    font-size: 0.9em;
    margin: -10px 0 15px 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: rgba(139, 115, 85, 0.15);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #a0a0a0;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: #ffd700;
    font-size: 1.5em;
    font-weight: 600;
}

.stat-value.warning {
    color: #ffc107;
}

.stat-value.danger {
    color: #dc3545;
}

/* Position Editor */
.position-editor .form-row {
    margin-bottom: 15px;
}

.position-editor input[type="number"] {
    width: 100%;
}

/* Prefab Table */
.prefab-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
}

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

.prefab-table th,
.prefab-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.prefab-table th {
    background: #2a2a3a;
    color: #d4af37;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.prefab-table tbody tr:hover {
    background: rgba(139, 115, 85, 0.15);
}

.prefab-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.prefab-name {
    font-family: monospace;
    color: #ffd700;
}

.prefab-count {
    color: #a0a0a0;
}

.prefab-count.high {
    color: #ffc107;
    font-weight: 600;
}

/* Duplicates Result */
.duplicates-result {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 15px;
}

.duplicates-list {
    max-height: 300px;
    overflow-y: auto;
}

.duplicate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.duplicate-item:last-child {
    border-bottom: none;
}

.duplicate-info {
    flex: 1;
}

.duplicate-prefab {
    color: #ffd700;
    font-family: monospace;
}

.duplicate-pos {
    color: #888;
    font-size: 0.85em;
}

.duplicate-count {
    color: #dc3545;
    font-weight: 600;
    margin-left: 15px;
}

/* Signs List */
.signs-list {
    max-height: 300px;
    overflow-y: auto;
}

.sign-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.sign-item:last-child {
    margin-bottom: 0;
}

.sign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sign-position {
    color: #888;
    font-size: 0.85em;
    font-family: monospace;
}

.sign-text-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 4px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-size: 0.95em;
}

.sign-text-input:focus {
    outline: none;
    border-color: #d4af37;
}

.no-signs {
    color: #888;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Save Section */
.save-section {
    background: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.3);
}

.save-section h3 {
    color: #28a745;
    border-bottom-color: rgba(40, 167, 69, 0.3);
}

.btn-large {
    padding: 12px 24px;
    font-size: 1.1em;
}

/* No Build Selected */
.no-build-selected {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-build-selected .empty-state-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.no-build-selected h4 {
    color: #a0a0a0;
    margin-bottom: 10px;
}

/* Editor Loading State */
.editor-loading {
    text-align: center;
    padding: 40px;
    color: #a0a0a0;
}

.editor-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 115, 85, 0.3);
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* ==================== Compass Rose Picker ==================== */
.compass-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.compass-picker-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    border: 2px solid #d4af37;
    width: 500px;  /* Further reduced for perfect fit on all browsers */
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.compass-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.compass-picker-header h3 {
    margin: 0;
    color: #d4af37;
    font-size: 1.2em;
}

.compass-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.compass-close:hover {
    color: #ff4444;
}

.compass-picker-body {
    padding: 15px;
}

.compass-container {
    position: relative;
    width: 280px;  /* Further reduced for perfect fit */
    height: 280px;
    margin: 0 auto 15px auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.compass-rose-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none; /* Prevent image from being draggable */
    user-drag: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.compass-pointer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.compass-pointer-svg {
    width: 100%;
    height: 100%;
}

.compass-handle {
    position: absolute;
    width: 24px;  /* Slightly larger for easier grabbing */
    height: 24px;
    background: #ff4444;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: grab;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
    /* Position will be set dynamically by JavaScript */
}

.compass-handle:active {
    cursor: grabbing;
}

.compass-value-display {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 15px;
}

.compass-angle {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
    color: #d4af37;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.compass-direction {
    display: block;
    color: #a0a0a0;
    font-size: 1em;
    margin-top: 5px;
}

.compass-presets {
    margin-bottom: 15px;
}

.compass-presets h4 {
    font-size: 0.9em;
    color: #888;
    margin: 0 0 10px 0;
    text-align: center;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.compass-preset {
    background: rgba(139, 115, 85, 0.2);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 6px;
    padding: 8px 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.7em;
    text-align: center;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.compass-preset:hover {
    background: rgba(212, 175, 55, 0.3);
    border-color: #d4af37;
}

.compass-preset.active {
    background: #d4af37;
    color: #1a1a2e;
    font-weight: bold;
}

.compass-options {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
}

.snap-option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a0a0a0;
    font-size: 0.9em;
    cursor: pointer;
    margin-bottom: 5px;
}

.snap-option:last-child {
    margin-bottom: 0;
}

.snap-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #d4af37;
}

.compass-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid rgba(139, 115, 85, 0.3);
}

.btn-icon {
    padding: 8px 12px;
    font-size: 1.2em;
    min-width: auto;
}

.compass-btn {
    margin-left: 5px;
}

/* Rotation group adjustment for compass button */
.rotation-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rotation-group label {
    flex-shrink: 0;
}

.rotation-group input[type="number"] {
    width: 100px;
}

.rotation-group .rotation-hint {
    color: #888;
    font-size: 0.85em;
}

/* ==================== ABOUT TAB STYLES ==================== */

.about-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(139, 115, 85, 0.3);
}

.about-section h3 {
    color: #d4af37;
    margin: 0 0 15px 0;
    font-size: 1.2em;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    padding-bottom: 10px;
}

.about-section p {
    color: #c0c0c0;
    margin-bottom: 15px;
}

.about-section ul {
    color: #c0c0c0;
    margin: 10px 0;
    padding-left: 20px;
}

.about-section li {
    margin-bottom: 8px;
}

.api-endpoint {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.api-method {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85em;
    text-transform: uppercase;
}

.api-method.get {
    background: #28a745;
    color: #fff;
}

.api-method.post {
    background: #007bff;
    color: #fff;
}

.api-method.put {
    background: #ffc107;
    color: #000;
}

.api-method.delete {
    background: #dc3545;
    color: #fff;
}

.api-url {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #98c379;
    word-break: break-all;
}

.copy-api-url {
    flex-shrink: 0;
}

.api-params {
    margin-bottom: 15px;
}

.api-params h4 {
    color: #f5f5dc;
    font-size: 1em;
    margin: 0 0 10px 0;
}

.api-params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.api-params-table th,
.api-params-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.api-params-table th {
    background: rgba(0, 0, 0, 0.3);
    color: #d4af37;
    font-weight: 600;
}

.api-params-table td {
    color: #c0c0c0;
}

.api-params-table code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 3px;
    color: #e06c75;
    font-size: 0.9em;
}

.api-response {
    margin-bottom: 15px;
}

.api-response h4 {
    color: #f5f5dc;
    font-size: 1em;
    margin: 0 0 10px 0;
}

.api-example {
    margin-top: 15px;
}

.api-example h4 {
    color: #f5f5dc;
    font-size: 1em;
    margin: 0 0 10px 0;
}

.api-example pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0;
}

.api-example code {
    color: #98c379;
    font-family: monospace;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-all;
}

#about-eras-list,
#about-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#about-eras-list .era-item,
#about-tags-list .tag-item {
    background: rgba(139, 115, 85, 0.2);
    border: 1px solid rgba(139, 115, 85, 0.4);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9em;
}

#about-eras-list .era-item {
    color: #d4af37;
}

.loading {
    color: #888;
    font-style: italic;
}

/* ==================== API Keys Management ==================== */
.api-keys-section {
    border: 2px solid #8b7355;
    padding: 20px;
    border-radius: 8px;
    background: rgba(20, 20, 25, 0.6);
    margin-bottom: 30px;
}

.api-keys-settings {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.api-key-toggle {
    margin-bottom: 10px;
}

.api-key-creator {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.api-key-creator h4 {
    color: #ffd700;
    margin: 0 0 15px 0;
}

.api-keys-table {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
}

.api-keys-table thead {
    background: rgba(139, 115, 85, 0.3);
}

.api-keys-table th {
    padding: 12px;
    text-align: left;
    color: #ffd700;
    font-weight: 600;
    border-bottom: 2px solid #8b7355;
}

.api-keys-table td {
    padding: 12px;
    color: #f5f5dc;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.api-keys-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.api-keys-table tbody tr.api-key-row {
    transition: background-color 0.2s;
}

.api-keys-table tbody tr.api-key-row:hover {
    background: rgba(76, 175, 80, 0.1);
}

.api-key-actions {
    text-align: right;
    white-space: nowrap;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.status-badge.inactive {
    background: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.api-key-reveal {
    padding: 20px;
}

.warning-banner {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    color: #ffc107;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

.api-key-display {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.api-key-display code {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 6px;
    color: #ffd700;
    font-family: monospace;
    font-size: 0.9em;
    word-break: break-all;
}

.api-key-usage {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.api-key-usage h4 {
    color: #ffd700;
    margin: 0 0 10px 0;
}

.api-key-usage pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
}

.api-key-usage pre code {
    color: #98c379;
    font-family: monospace;
    font-size: 0.85em;
}

/* Parent Build Selector */
.parent-build-selector {
    position: relative;
}

.parent-build-selector .parent-status {
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.parent-build-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(26, 26, 26, 0.98);
    border: 1px solid #8b7355;
    border-radius: 6px;
    margin-top: 2px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.parent-result-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
    transition: background 0.2s;
}

.parent-result-item:hover {
    background: rgba(139, 115, 85, 0.3);
}

.parent-result-item.selected {
    background: rgba(139, 115, 85, 0.5);
    border-left: 3px solid #ffd700;
}

.parent-result-item strong {
    display: block;
    color: #f5f5dc;
    margin-bottom: 2px;
}

.parent-result-item .version-count {
    font-size: 0.85em;
    color: #aaa;
    margin-left: 8px;
}

.no-results {
    padding: 12px;
    text-align: center;
    color: #888;
    font-style: italic;
}

#link-to-parent-btn {
    margin-top: 8px;
}

/* ==================== NEW: Tag Filter Row & Search ==================== */

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    justify-content: flex-start; /* Explicitly left-align */
}

.tag-filter-row {
    border-top: 1px solid rgba(139, 115, 85, 0.3);
    padding-top: 10px;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start; /* Explicitly left-align */
}

.tag-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0; /* Prevent search input from shrinking */
}

.tag-filter-group label {
    font-size: 0.85em;
    color: #a0a0a0;
}

.tag-search-input {
    width: 200px;
    padding: 8px 12px;
    background: rgba(30, 30, 35, 0.9);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 0.95em;
}

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

.tag-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0;
    align-items: center; /* Align tags with search input */
    flex: 1; /* Take remaining space */
}

/* ==================== NEW: Build Search Autocomplete ==================== */

.build-search-group {
    position: relative;
}

.build-search-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(30, 30, 35, 0.9);
    border: 1px solid #8b7355;
    border-radius: 6px;
    color: #f5f5dc;
    font-size: 0.95em;
}

.build-search-input:focus {
    outline: none;
    border-color: #ffd700;
}

.build-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid #8b7355;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.build-autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
    transition: background 0.2s ease;
}

.build-autocomplete-item:hover {
    background: rgba(139, 115, 85, 0.3);
}

.build-autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-name {
    color: #f5f5dc;
    font-size: 0.95em;
}

.autocomplete-version {
    color: #aaa;
    font-size: 0.85em;
}

/* ==================== PB Options Management ==================== */
.pb-options-creator {
    background: rgba(30, 30, 35, 0.6);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(139, 115, 85, 0.3);
    margin-bottom: 20px;
}

.pb-options-creator h4 {
    color: #ffd700;
    margin-top: 0;
    margin-bottom: 15px;
}

.pb-options-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 30, 35, 0.6);
    border-radius: 8px;
    overflow: hidden;
}

.pb-options-table th,
.pb-options-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.pb-options-table th {
    background: rgba(139, 115, 85, 0.3);
    color: #ffd700;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
}

.pb-options-table tbody tr:hover {
    background: rgba(139, 115, 85, 0.15);
}

.pb-options-table .loading,
.pb-options-table .no-data {
    text-align: center;
    color: #aaa;
    padding: 30px;
}

.pb-options-table .move-up,
.pb-options-table .move-down {
    padding: 4px 8px;
    margin-right: 5px;
    font-size: 0.9em;
}

.pb-options-table .move-up:disabled,
.pb-options-table .move-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.existing-pb-options {
    margin-top: 20px;
}

.existing-pb-options h4 {
    color: #ffd700;
    margin-bottom: 15px;
}

.input-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Special styling for rotationY input with compass button */
.input-item.rotation-input {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.input-item.rotation-input .input-label {
    flex-shrink: 0;
    margin-bottom: 0;
}

.input-item.rotation-input .pb-option-input {
    width: 100px;
    flex-shrink: 0;
}

.input-label {
    font-size: 0.85em;
    color: #aaa;
}

.pb-option-input {
    padding: 8px 12px;
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(139, 115, 85, 0.3);
    border-radius: 4px;
    color: #f5f5dc;
    font-size: 0.95em;
}

.pb-option-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1);
}

/* Compass button styling - square shape */
.compass-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}

.rotation-hint {
    color: #888;
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==================== Parent Assignment Options ==================== */

#parent-assignment-options {
    margin-top: 20px;
    padding: 20px;
    background: rgba(139, 115, 85, 0.1);
    border: 2px solid rgba(139, 115, 85, 0.3);
    border-radius: 8px;
}

#parent-assignment-options .form-group {
    margin-bottom: 15px;
}

#parent-assignment-options label {
    color: #ffd700;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.parent-name-toggle,
.parent-temp-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: rgba(108, 117, 125, 0.5);
    border: 1px solid #6c757d;
    border-radius: 26px;
    cursor: pointer;
    transition: 0.3s;
}

.parent-name-toggle.active,
.parent-temp-toggle.active {
    background-color: rgba(40, 167, 69, 0.5);
    border-color: #28a745;
}

.parent-name-toggle .toggle-slider,
.parent-temp-toggle .toggle-slider {
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: #f5f5dc;
    transition: 0.3s;
    border-radius: 50%;
}

.parent-name-toggle.active .toggle-slider,
.parent-temp-toggle.active .toggle-slider {
    transform: translateX(24px);
    background-color: #28a745;
}

.toggle-container .toggle-label {
    color: #f5f5dc;
    font-size: 0.95em;
    user-select: none;
}

.parent-status {
    color: #28a745;
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 8px;
}
