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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Login */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

.login-container h1 {
    font-size: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.btn-google {
    background: #4285f4;
    color: white;
    font-size: 16px;
    padding: 12px 32px;
}

.btn-google:hover {
    background: #3367d6;
}

.btn-sm {
    padding: 6px 14px;
    background: #e0e0e0;
    color: #333;
    font-size: 13px;
}

.btn-sm:hover {
    background: #ccc;
}

.btn-save {
    background: #2e7d32;
    color: white;
    padding: 8px 24px;
    font-size: 14px;
    transition: background 0.3s ease;
}

.btn-save:hover:not(:disabled) {
    background: #1b5e20;
}

.btn-save.disabled,
.btn-save:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-save.has-changes {
    background: #2e7d32;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        background: #2e7d32;
    }
    50% {
        background: #43a047;
    }
}

.btn-load-more {
    background: #4285f4;
    color: white;
    padding: 10px 30px;
    font-size: 14px;
    width: 100%;
}

.btn-load-more:hover {
    background: #3367d6;
}

.btn-load-more:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.load-more-container {
    padding: 16px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.header-left h1 {
    font-size: 1.2rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 14px;
    color: #666;
}

/* Main */
main {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

/* Customer select */
.customer-select {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.customer-select label {
    font-weight: 600;
    white-space: nowrap;
}

.customer-select select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
}

/* Mapping area */
.mapping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    background: white;
    padding: 12px 16px 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tabs {
    display: flex;
    gap: 4px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #e8e8e8;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: background 0.15s;
}

.tab-btn:hover {
    background: #ddd;
}

.tab-btn.active {
    background: #4285f4;
    color: white;
}

/* Tab panels */
.tab-panel {
    display: none;
}

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

/* Table */
.table-container {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
    padding: 0;
}

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

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

th {
    background: #fafafa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    border-bottom: 2px solid #ddd;
}

tr:hover {
    background: #f8f9ff;
}

/* Mapping select in table */
.mapping-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    min-width: 180px;
}

/* Null checkbox */
.null-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.null-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.null-cell label {
    font-size: 13px;
    color: #666;
    cursor: default;
}

.mapping-select:disabled {
    background: #f0f0f0;
    color: #999;
}

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

#mapping-area {
    min-height: 200px;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
}

.loading-indicator p {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.spinner-large {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading spinner */
.loading-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4285f4;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner-text {
    color: #666;
    font-size: 14px;
}

#tab-content {
    position: relative;
    min-height: 200px;
}

#tab-content.loading {
    opacity: 0.5;
    pointer-events: none;
}
/* Warning banner */
.warning-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff6b6b;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
    transition: top 0.3s ease;
    min-width: 400px;
    max-width: 600px;
}

.warning-banner.show {
    top: 20px;
}

.warning-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.warning-banner-content span {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.btn-close-banner {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-close-banner:hover {
    opacity: 1;
}
/* Save Banner */
.save-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #2e7d32;
    color: white;
    padding: 12px 24px;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.save-banner.show {
    transform: translateY(0);
}

.save-banner.error {
    background: #d32f2f;
}

.save-banner.success {
    background: #2e7d32;
}

.save-banner-content {
    max-width: 1200px;
    margin: 0 auto;
}

#save-banner-text {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Searchable Dropdown */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-wrapper input.searchable-select-input {
    width: 100%;
    padding: 6px 30px 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.searchable-select-wrapper input.searchable-select-input:focus {
    outline: none;
    border-color: #4285f4;
}

.searchable-select-wrapper input.searchable-select-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.searchable-select-wrapper .dropdown-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
    font-size: 12px;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.searchable-select-dropdown.show {
    display: block;
}

.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.searchable-select-option:hover {
    background: #f5f5f5;
}

.searchable-select-option.selected {
    background: #e3f2fd;
    font-weight: 500;
}

.searchable-select-option.hidden {
    display: none;
}

.searchable-select-option.no-results {
    color: #999;
    cursor: default;
    font-style: italic;
}

.searchable-select-option.no-results:hover {
    background: white;
}
