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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1a4a4a, #2d6666);
    color: #ffffff;
    min-height: 100vh;
    transition: background 0.5s ease;
}

/* Red theme for sources tab */
body.red-theme {
    background: linear-gradient(135deg, #4a1a1a, #662d2d);
}

body.red-theme header h1 {
    color: #cc0000;
    text-shadow: 0 0 10px rgba(204, 0, 0, 0.5);
}

body.red-theme .tab-btn:hover {
    border-color: #cc0000;
    color: #ffffff;
}

body.red-theme .tab-btn.active {
    background: linear-gradient(45deg, #aa0000, #cc0000);
    border-color: #ee0000;
    color: white;
    font-weight: bold;
}

body.red-theme .upload-btn, body.red-theme .download-btn {
    background: linear-gradient(45deg, #aa0000, #cc0000);
    box-shadow: 0 4px 15px rgba(170, 0, 0, 0.3);
}

body.red-theme .upload-btn:hover, body.red-theme .download-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #cc0000, #ee0000);
    box-shadow: 0 6px 20px rgba(170, 0, 0, 0.4);
}

body.red-theme .macro-list-panel, body.red-theme .edit-panel, body.red-theme .source-list-panel {
    border: 1px solid rgba(204, 0, 0, 0.3);
}

body.red-theme .macro-list-panel h3, body.red-theme .edit-panel h3, body.red-theme .source-list-panel h3 {
    color: #cc0000;
    border-bottom: none;
}

body.red-theme .macro-item, body.red-theme .source-item {
    background: rgba(74, 26, 26, 0.6);
}

body.red-theme .macro-item:hover, body.red-theme .source-item:hover {
    background: rgba(204, 0, 0, 0.2);
    border-color: #cc0000;
}

body.red-theme .macro-item.active, body.red-theme .source-item.active {
    background: linear-gradient(45deg, #aa0000, #cc0000);
    border-color: #ee0000;
}

body.red-theme .macro-item.has-data, body.red-theme .source-item.has-data {
    border-color: #cc0000;
}

body.red-theme .field-group label {
    color: #cc0000;
}

body.red-theme .field-group input:focus {
    border-color: #cc0000;
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.3);
}

body.red-theme .section-divider {
    border-top: 1px solid rgba(204, 0, 0, 0.3);
}

body.red-theme .global-replace-section h4 {
    color: #cc0000;
}

body.red-theme .replace-input-group label {
    color: #cc0000;
}

body.red-theme .replace-input-group input:focus {
    border-color: #cc0000;
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.3);
}

body.red-theme .match-count {
    color: #cc0000;
}

body.red-theme .macro-link {
    color: #ee0000;
}

body.red-theme .macro-link:hover {
    background: rgba(238, 0, 0, 0.2);
    text-shadow: 0 0 5px rgba(238, 0, 0, 0.8);
}

body.red-theme .macro-list::-webkit-scrollbar-thumb, body.red-theme .source-list::-webkit-scrollbar-thumb {
    background: rgba(204, 0, 0, 0.5);
}

body.red-theme .macro-list::-webkit-scrollbar-thumb:hover, body.red-theme .source-list::-webkit-scrollbar-thumb:hover {
    background: rgba(204, 0, 0, 0.7);
}

body.red-theme .modal-content {
    background: linear-gradient(135deg, #4a1a1a, #662d2d);
    border: 3px solid #cc0000;
}

body.red-theme .modal h3 {
    color: #cc0000;
}

body.red-theme .modal-btn {
    background: linear-gradient(45deg, #aa0000, #cc0000);
    box-shadow: 0 4px 15px rgba(170, 0, 0, 0.3);
}

body.red-theme .modal-btn:hover {
    background: linear-gradient(45deg, #cc0000, #ee0000);
    box-shadow: 0 6px 20px rgba(170, 0, 0, 0.4);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #00cccc;
    text-shadow: 0 0 10px rgba(0, 204, 204, 0.5);
}

/* Tab Styles */
.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #666666;
    border-radius: 8px;
    color: #cccccc;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    border-color: #00cccc;
    color: #ffffff;
}

.tab-btn.active {
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    border-color: #00eeee;
    color: white;
    font-weight: bold;
}

.tab-content {
    display: none;
}

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

.upload-section {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

#folderUpload, #sourceUpload {
    display: none;
}

.upload-btn, .download-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 170, 170, 0.3);
}

.upload-btn:hover, .download-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #00cccc, #00eeee);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 170, 170, 0.4);
}

.download-btn:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
}

/* Tab-specific download button styling */
body.red-theme .download-btn {
    background: linear-gradient(45deg, #aa0000, #cc0000) !important;
    box-shadow: 0 4px 15px rgba(170, 0, 0, 0.3) !important;
}

body.red-theme .download-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #cc0000, #ee0000) !important;
    box-shadow: 0 6px 20px rgba(170, 0, 0, 0.4) !important;
}

.main-content {
    display: grid;
    grid-template-columns: 1.5fr 2fr;
    gap: 30px;
    margin-top: 30px;
}

.macro-list-panel, .edit-panel, .source-list-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(0, 204, 204, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Reduce edit panel height */
.edit-panel {
    max-height: 250px;
}

/* List Headers */
.list-headers {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 204, 204, 0.2);
}

.header-item {
    font-size: 12px;
    font-weight: bold;
    color: #00cccc;
    text-align: center;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-number {
    width: 52px;
    text-align: center;
}

.header-oled {
    width: 120px;
    text-align: center;
}

.header-panel {
    width: 45px;
    text-align: center;
}

.header-comment {
    flex: 0.9;
    text-align: center;
}

/* Red theme for headers */
body.red-theme .list-headers {
    border: 1px solid rgba(204, 0, 0, 0.2);
}

body.red-theme .header-item {
    color: #cc0000;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(0, 204, 204, 0.3);
    padding-bottom: 10px;
}

.panel-header h3 {
    color: #00cccc;
    margin: 0;
    font-size: 1.3em;
    border-bottom: none;
    padding-bottom: 0;
}

.goto-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goto-section label {
    font-size: 14px;
    color: #00cccc;
}

.goto-input {
    width: 60px;
    padding: 6px 8px;
    background: #000;
    border: 1px solid #666;
    border-radius: 4px;
    color: white;
    text-align: center;
}

body.red-theme .panel-header {
    border-bottom-color: rgba(204, 0, 0, 0.3);
}

body.red-theme .panel-header h3,
body.red-theme .goto-section label {
    color: #cc0000;
}

.global-macro-panel .panel-header h3,
.global-macro-panel .goto-section label {
    color: #00cccc;
}

.global-source-panel .panel-header h3,
.global-source-panel .goto-section label {
    color: #cc0000;
}

.macro-list-panel h3, .edit-panel h3, .source-list-panel h3 {
    color: #00cccc;
    margin-bottom: 0;
    font-size: 1.3em;
    border-bottom: none;
    padding-bottom: 0;
}

.macro-list, .source-list {
    height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
}

.macro-item, .source-item {
    background: rgba(26, 74, 74, 0.6);
    border: 1px solid #666666;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.macro-item:hover, .source-item:hover {
    background: rgba(0, 204, 204, 0.2);
    border-color: #00cccc;
}

.macro-item.active, .source-item.active {
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    border-color: #00eeee;
    color: white;
    font-weight: bold;
}

.macro-item.has-data, .source-item.has-data {
    border-color: #00cccc;
}

.macro-number {
    background: #000000;
    border: 1px solid #666666;
    border-radius: 4px;
    padding: 4px 6px;
    min-width: 40px;
    max-width: 40px;
    height: calc(100% - 4px);
    margin: 2px 0;
    font-weight: bold;
    text-align: center;
    color: #ffffff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.macro-oled-box {
    background: #000000;
    border: 1px solid #666666;
    border-radius: 4px;
    padding: 4px 8px;
    min-width: 120px;
    max-width: 120px;
    height: calc(100% - 4px);
    margin: 2px 0;
    overflow: hidden;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    cursor: pointer;
    transition: background-color 0.2s;
}

.macro-oled-box:empty::before {
    content: "    ";
    color: transparent;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.macro-panel {
    background: #000000;
    border: 1px solid #666666;
    border-radius: 4px;
    padding: 4px 6px;
    min-width: 50px;
    max-width: 50px;
    height: calc(100% - 4px);
    margin: 2px 0;
    font-weight: bold;
    text-align: center;
    color: #ffffff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s;
}

.macro-panel:empty::before {
    content: "    ";
    color: transparent;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.macro-comment {
    background: #000000;
    border: 1px solid #666666;
    border-radius: 4px;
    padding: 4px 8px;
    flex: 1;
    height: calc(100% - 4px);
    margin: 2px 0;
    font-size: 13px;
    line-height: 1.2;
    color: #cccccc;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    cursor: pointer;
    transition: background-color 0.2s;
}

.macro-comment:empty::before {
    content: "    ";
    color: transparent;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.edit-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-group label {
    color: #00cccc;
    font-weight: bold;
    font-size: 14px;
}

.field-group input {
    padding: 12px;
    background: #000000;
    border: 1px solid #666666;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
}

.field-group input:focus {
    outline: none;
    border-color: #00cccc;
    box-shadow: 0 0 10px rgba(0, 204, 204, 0.3);
}

.field-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.char-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.char-count.warning {
    color: #ffaa00;
}

.char-count.error {
    color: #ff4444;
}

.save-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #00aa00, #00cc00);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.save-btn:hover {
    background: linear-gradient(45deg, #00cc00, #00ee00);
    transform: translateY(-2px);
}

/* Search Replace Section - New Layout */
.search-replace-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.search-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #b0b0b0;
}

.expanded-search-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    transition: border-color 0.3s ease;
}

.expanded-search-input:focus {
    outline: none;
    border-color: #008080;
}

.red-theme .expanded-search-input:focus {
    border-color: #dc3545;
}

.global-theme .expanded-search-input:focus {
    border-color: #ffc107;
}

.match-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.match-count {
    font-size: 14px;
    color: #b0b0b0;
}

.execute-btn {
    padding: 12px 24px;
    background: #008080;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
    margin-bottom: 15px;
}

.execute-btn:hover:not(:disabled) {
    background: #006666;
    transform: translateY(-1px);
}

.execute-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

.execute-btn.success {
    background: #28a745;
}

.red-theme .execute-btn {
    background: #dc3545;
}

.red-theme .execute-btn:hover:not(:disabled) {
    background: #c82333;
}

.global-theme .execute-btn {
    background: #ffc107;
    color: #000;
}

.global-theme .execute-btn:hover:not(:disabled) {
    background: #e0a800;
}

/* Search Results Styling */
.search-results {
    flex: 1;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.search-results.has-results {
    overflow-y: auto;
    padding: 10px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border-left: 3px solid #008080;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.red-theme .search-result-item {
    border-left-color: #dc3545;
}

.global-theme .search-result-item {
    border-left-color: #ffc107;
}

.search-result-number {
    font-weight: bold;
    margin-right: 10px;
    cursor: pointer;
    color: #008080;
    transition: color 0.2s ease;
    flex-shrink: 0;
    min-width: 40px;
}

.search-result-number:hover {
    color: #00a0a0;
    text-decoration: underline;
}

.search-result-number.macro-type {
    color: #008080;
}

.search-result-number.source-type {
    color: #dc3545;
}

.search-result-content {
    flex: 1;
    line-height: 1.4;
}

.search-result-field {
    cursor: pointer;
    padding: 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    display: inline-block;
    min-width: 20px;
    min-height: 30px;
    vertical-align: middle;
}

.search-result-field:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-result-field.empty-field:hover {
    min-width: 80px;
}


.search-result-field.editing {
    background: rgba(255, 255, 255, 0.2);
}

.search-result-edit-input {
    background: transparent !important;
    border: 1px solid #008080 !important;
    border-radius: 3px !important;
    padding: 2px 4px !important;
    color: inherit !important;
    font: inherit !important;
}

.red-theme .search-result-edit-input {
    border-color: #dc3545 !important;
}

.global-theme .search-result-edit-input {
    border-color: #ffc107 !important;
}

/* Custom scrollbar for search results */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Global Replace Section */
.section-divider {
    border: none;
    border-top: 1px solid rgba(0, 204, 204, 0.3);
    margin: 5px 0 3px 0;
}

.global-replace-section {
    margin-top: 0px;
}

.global-replace-section h4 {
    color: #00cccc;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.replace-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

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

.replace-input-group label {
    color: #00cccc;
    font-weight: bold;
    font-size: 14px;
}

.replace-input-group input {
    padding: 12px;
    background: #000000;
    border: 1px solid #666666;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
}

.replace-input-group input:focus {
    outline: none;
    border-color: #00cccc;
    box-shadow: 0 0 10px rgba(0, 204, 204, 0.3);
}

.replace-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.match-count {
    font-size: 12px;
    color: #00cccc;
    font-weight: bold;
    margin-top: 5px;
    grid-column: 1 / -1;
    word-wrap: break-word;
    line-height: 1.4;
}

.macro-link {
    color: #00eeee;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 1px 2px;
    border-radius: 2px;
}

.macro-link:hover {
    background: rgba(0, 238, 238, 0.2);
    color: #ffffff;
    text-shadow: 0 0 5px rgba(0, 238, 238, 0.8);
}

.execute-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #cc6600, #ff8800);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(204, 102, 0, 0.3);
}

.execute-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff8800, #ffaa00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(204, 102, 0, 0.4);
}

.execute-btn:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
}

.execute-btn.success {
    background: linear-gradient(45deg, #00aa00, #00cc00) !important;
    box-shadow: 0 4px 15px rgba(0, 170, 0, 0.3) !important;
}

.execute-btn.success:hover {
    background: linear-gradient(45deg, #00cc00, #00ee00) !important;
    box-shadow: 0 6px 20px rgba(0, 170, 0, 0.4) !important;
}

.execute-btn.success::before {
    content: "✓ ";
    font-weight: bold;
}

/* Scrollbar styling */
.macro-list::-webkit-scrollbar, .source-list::-webkit-scrollbar {
    width: 8px;
}

.macro-list::-webkit-scrollbar-track, .source-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.macro-list::-webkit-scrollbar-thumb, .source-list::-webkit-scrollbar-thumb {
    background: rgba(0, 204, 204, 0.5);
    border-radius: 4px;
}

.macro-list::-webkit-scrollbar-thumb:hover, .source-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 204, 204, 0.7);
}

/* Download Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: linear-gradient(135deg, #1a4a4a, #2d6666);
    margin: 15% auto;
    padding: 30px;
    border: 3px solid #00cccc;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    color: #00cccc;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.modal-btn {
    padding: 15px 20px;
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 170, 170, 0.3);
}

.modal-btn:hover {
    background: linear-gradient(45deg, #00cccc, #00eeee);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 170, 170, 0.4);
}

.modal-btn.cancel {
    background: linear-gradient(45deg, #666666, #888888);
    box-shadow: 0 4px 15px rgba(102, 102, 102, 0.3);
}

.modal-btn.cancel:hover {
    background: linear-gradient(45deg, #888888, #aaaaaa);
    box-shadow: 0 6px 20px rgba(102, 102, 102, 0.4);
}

/* Modal button theming based on current tab */
.modal-btn.macro-themed {
    background: linear-gradient(45deg, #00aaaa, #00cccc) !important;
    box-shadow: 0 4px 15px rgba(0, 170, 170, 0.3) !important;
}

.modal-btn.macro-themed:hover {
    background: linear-gradient(45deg, #00cccc, #00eeee) !important;
    box-shadow: 0 6px 20px rgba(0, 170, 170, 0.4) !important;
}

.modal-btn.source-themed {
    background: linear-gradient(45deg, #aa0000, #cc0000) !important;
    box-shadow: 0 4px 15px rgba(170, 0, 0, 0.3) !important;
}

.modal-btn.source-themed:hover {
    background: linear-gradient(45deg, #cc0000, #ee0000) !important;
    box-shadow: 0 6px 20px rgba(170, 0, 0, 0.4) !important;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    font-size: 12px;
    color: #888888;
    margin: 0;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .upload-section {
        flex-direction: column;
    }
}

/* Global Word Replace Theme */
.global-theme h4 {
    color: #b3a577 !important;
}

.global-theme .replace-input-group label {
    color: #b3a577 !important;
}

.global-theme .replace-input-group input:focus {
    border-color: #b3a577 !important;
    box-shadow: 0 0 10px rgba(179, 165, 119, 0.3) !important;
}

.global-theme .match-count {
    color: #b3a577 !important;
}

.global-btn {
    background: linear-gradient(45deg, #9d8f5f, #b3a577) !important;
    box-shadow: 0 4px 15px rgba(179, 165, 119, 0.3) !important;
}

.global-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #b3a577, #c9b88f) !important;
    box-shadow: 0 6px 20px rgba(179, 165, 119, 0.4) !important;
}

/* Global match count styling for mixed results */
.global-match-macro {
    color: #00eeee !important;
}

.global-match-source {
    color: #ee0000 !important;
}

/* Global Search Section - Outside of edit panels */
.global-search-section {
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(179, 165, 119, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.global-search-section .global-replace-section {
    margin: 0;
}

/* Red theme for global search section */
body.red-theme .global-search-section {
    border: 1px solid rgba(179, 165, 119, 0.3);
    background: rgba(0, 0, 0, 0.2);
}

/* Global theme for modal */
body.global-theme .modal-content {
    background: linear-gradient(135deg, #4a3d1a, #665a2d);
    border: 3px solid #b3a577;
}

body.global-theme .modal h3 {
    color: #b3a577;
}

body.global-theme .modal-btn {
    background: linear-gradient(45deg, #9d8f5f, #b3a577);
    box-shadow: 0 4px 15px rgba(179, 165, 119, 0.3);
}

body.global-theme .modal-btn:hover {
    background: linear-gradient(45deg, #b3a577, #c9b88f);
    box-shadow: 0 6px 20px rgba(179, 165, 119, 0.4);
}

/* Download Entire Show button should always be gold */
.modal-btn:first-child {
    background: linear-gradient(45deg, #9d8f5f, #b3a577) !important;
    box-shadow: 0 4px 15px rgba(179, 165, 119, 0.3) !important;
}

.modal-btn:first-child:hover {
    background: linear-gradient(45deg, #b3a577, #c9b88f) !important;
    box-shadow: 0 6px 20px rgba(179, 165, 119, 0.4) !important;
}

/* Global Tab Styling */
body.global-theme {
    background: linear-gradient(135deg, #4a3d1a, #665a2d);
}

body.global-theme header h1 {
    color: #b3a577;
    text-shadow: 0 0 10px rgba(179, 165, 119, 0.5);
}

body.global-theme .tab-btn:hover {
    border-color: #b3a577;
    color: #ffffff;
}

body.global-theme .tab-btn.active {
    background: linear-gradient(45deg, #9d8f5f, #b3a577);
    border-color: #c9b88f;
    color: white;
    font-weight: bold;
}

body.global-theme .upload-btn, body.global-theme .download-btn {
    background: linear-gradient(45deg, #9d8f5f, #b3a577);
    box-shadow: 0 4px 15px rgba(179, 165, 119, 0.3);
}

body.global-theme .upload-btn:hover, body.global-theme .download-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #b3a577, #c9b88f);
    box-shadow: 0 6px 20px rgba(179, 165, 119, 0.4);
}

/* Global Lists Container */
.global-lists-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.global-macro-panel, .global-source-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.global-macro-panel {
    border: 1px solid rgba(0, 204, 204, 0.3);
}

.global-macro-panel .panel-header {
    border-bottom-color: rgba(0, 204, 204, 0.3);
}

.global-source-panel {
    border: 1px solid rgba(204, 0, 0, 0.3);
}

.global-source-panel .panel-header {
    border-bottom-color: rgba(204, 0, 0, 0.3);
}

.global-macro-panel .list-headers {
    border: 1px solid rgba(0, 204, 204, 0.2);
}

.global-macro-panel .header-item {
    color: #00cccc;
}

.global-source-panel .list-headers {
    border: 1px solid rgba(204, 0, 0, 0.2);
}

.global-source-panel .header-item {
    color: #cc0000;
}

.global-macro-panel .macro-item {
    background: rgba(26, 74, 74, 0.6);
}

.global-macro-panel .macro-item:hover {
    background: rgba(0, 204, 204, 0.2);
    border-color: #00cccc;
}

.global-macro-panel .macro-item.active {
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    border-color: #00eeee;
}

.global-macro-panel .macro-item.has-data {
    border-color: #00cccc;
}

.global-source-panel .source-item {
    background: rgba(74, 26, 26, 0.6);
}

.global-source-panel .source-item:hover {
    background: rgba(204, 0, 0, 0.2);
    border-color: #cc0000;
}

.global-source-panel .source-item.active {
    background: linear-gradient(45deg, #aa0000, #cc0000);
    border-color: #ee0000;
}

.global-source-panel .source-item.has-data {
    border-color: #cc0000;
}

.global-macro-panel .macro-list::-webkit-scrollbar-thumb {
    background: rgba(0, 204, 204, 0.5);
}

.global-macro-panel .macro-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 204, 204, 0.7);
}

.global-source-panel .source-list::-webkit-scrollbar-thumb {
    background: rgba(204, 0, 0, 0.5);
}

.global-source-panel .source-list::-webkit-scrollbar-thumb:hover {
    background: rgba(204, 0, 0, 0.7);
}

/* Progress/Version Area - Fixed Height */
.progress-version-area {
    height: 60px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disclaimer {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* Progress Bar Styles */
.progress-container {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(0, 204, 204, 0.3);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #00aaaa, #00cccc);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    font-size: 12px;
    color: #00cccc;
    font-weight: bold;
}

/* Version Display Styles */
.version-display {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 204, 204, 0.2);
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #00cccc;
}

.search-toggles {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    width: 50px;
    height: 26px;
    background: #333;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-label::after {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.toggle-input:checked + .toggle-label {
    background: #00cccc;
}

.toggle-input:checked + .toggle-label::after {
    left: 26px;
}

/* Red theme for progress and version */
body.red-theme .progress-container {
    border: 1px solid rgba(204, 0, 0, 0.3);
}

body.red-theme .progress-fill {
    background: linear-gradient(45deg, #aa0000, #cc0000);
}

body.red-theme .progress-text {
    color: #cc0000;
}

body.red-theme .version-display {
    border: 1px solid rgba(204, 0, 0, 0.2);
    color: #cc0000;
}

/* Global theme for progress and version */
body.global-theme .progress-container {
    border: 1px solid rgba(179, 165, 119, 0.3);
}

body.global-theme .progress-fill {
    background: linear-gradient(45deg, #9d8f5f, #b3a577);
}

body.global-theme .progress-text {
    color: #b3a577;
}

body.global-theme .version-display {
    border: 1px solid rgba(179, 165, 119, 0.2);
    color: #b3a577;
}

/* Expanded Search Input Styling */
.expanded-search-input {
    min-height: 45px !important;
    font-size: 18px !important;
    padding: 15px !important;
}

/* Search Results List Styling */
.search-results-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 10px 0;
    border: 1px solid rgba(0, 204, 204, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

.search-results-list.has-results {
    display: block;
}

.search-result-item {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 204, 204, 0.1);
    font-size: 14px;
    line-height: 1.4;
    transition: background 0.2s ease;
}

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

.search-result-item:hover {
    background: rgba(0, 204, 204, 0.1);
}

.search-result-number {
    color: #00eeee;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    margin-right: 8px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.search-result-number:hover {
    background: rgba(0, 238, 238, 0.2);
    text-shadow: 0 0 5px rgba(0, 238, 238, 0.8);
}

.search-result-content {
    display: inline;
}

.search-result-field {
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 2px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.search-result-field:hover {
    background: rgba(0, 204, 204, 0.2);
    border-color: rgba(0, 204, 204, 0.5);
}

.search-result-field.editing {
    background: rgba(0, 204, 204, 0.3);
    border-color: #00cccc;
}

.search-result-field input {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0;
    margin: 0;
    outline: none;
    width: 100%;
    min-width: 50px;
}

/* Red theme for search results */
body.red-theme .search-results-list {
    border: 1px solid rgba(204, 0, 0, 0.3);
}

body.red-theme .search-result-item {
    border-bottom: 1px solid rgba(204, 0, 0, 0.1);
}

body.red-theme .search-result-item:hover {
    background: rgba(204, 0, 0, 0.1);
}

body.red-theme .search-result-number {
    color: #ee0000;
}

body.red-theme .search-result-number:hover {
    background: rgba(238, 0, 0, 0.2);
    text-shadow: 0 0 5px rgba(238, 0, 0, 0.8);
}

body.red-theme .search-result-field:hover {
    background: rgba(204, 0, 0, 0.2);
    border-color: rgba(204, 0, 0, 0.5);
}

body.red-theme .search-result-field.editing {
    background: rgba(204, 0, 0, 0.3);
    border-color: #cc0000;
}

/* Global theme for search results */
body.global-theme .search-results-list {
    border: 1px solid rgba(179, 165, 119, 0.3);
}

body.global-theme .search-result-item {
    border-bottom: 1px solid rgba(179, 165, 119, 0.1);
}

body.global-theme .search-result-item:hover {
    background: rgba(179, 165, 119, 0.1);
}

body.global-theme .search-result-field:hover {
    background: rgba(179, 165, 119, 0.2);
    border-color: rgba(179, 165, 119, 0.5);
}

body.global-theme .search-result-field.editing {
    background: rgba(179, 165, 119, 0.3);
    border-color: #b3a577;
}

/* Mixed results styling for global search */
.search-result-number.macro-type {
    color: #00eeee;
}

.search-result-number.source-type {
    color: #ee0000;
}

.search-result-number.macro-type:hover {
    background: rgba(0, 238, 238, 0.2);
    text-shadow: 0 0 5px rgba(0, 238, 238, 0.8);
}

.search-result-number.source-type:hover {
    background: rgba(238, 0, 0, 0.2);
    text-shadow: 0 0 5px rgba(238, 0, 0, 0.8);
}

/* Scrollbar for search results */
.search-results-list::-webkit-scrollbar {
    width: 6px;
}

.search-results-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.search-results-list::-webkit-scrollbar-thumb {
    background: rgba(0, 204, 204, 0.5);
    border-radius: 3px;
}

.search-results-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 204, 204, 0.7);
}

/* Red theme scrollbar */
body.red-theme .search-results-list::-webkit-scrollbar-thumb {
    background: rgba(204, 0, 0, 0.5);
}

body.red-theme .search-results-list::-webkit-scrollbar-thumb:hover {
    background: rgba(204, 0, 0, 0.7);
}

/* Global theme scrollbar */
body.global-theme .search-results-list::-webkit-scrollbar-thumb {
    background: rgba(179, 165, 119, 0.5);
}

body.global-theme .search-results-list::-webkit-scrollbar-thumb:hover {
    background: rgba(179, 165, 119, 0.7);
}
