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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 20px;
}

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

.header {
    background: transparent;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo {
    height: 120px;
    width: auto;
    object-fit: contain;
}

.header h1 {
    color: #1e3c72;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

/* Upload Section */
.upload-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.upload-zone {
    border: 3px dashed #2a5298;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover {
    border-color: #1e3c72;
    background: #f0f4ff;
}

.upload-zone.dragover {
    background: #e3ecff;
    border-color: #1e3c72;
}

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

.upload-icon-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin: 0 auto 15px auto;
    display: block;
    background: #FFFFFF;
    border-radius: 10px;
    padding: 10px;
    transition: transform 0.3s;
}

.upload-zone:hover .upload-icon-img {
    transform: translateY(-5px);
}

.upload-status {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.upload-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Steps Container */
.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.step-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
}

.step-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.step-title {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.step-description {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.5;
}

.step-status {
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-bottom: 15px;
    display: none;
}

.step-status.active {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.step-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.step-status.warning {
    display: block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.step-button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.step-button:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(30, 60, 114, 0.4);
}

/* CRITICAL: Disabled state must override all other styles */
.step-button:disabled,
.step-button[disabled] {
    background: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.step-button.success:not(:disabled) {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 1350px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    color: #1e3c72;
    font-size: 1.6em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    line-height: 1;
}

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

.mapping-item {
    background: #f8f9ff;
    border: 1px solid #e0e5ff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.client-info {
    flex: 1;
}

.client-name {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.client-details {
    color: #666;
    font-size: 0.85em;
}

.excel-location {
    background: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin: 8px 0;
    font-size: 0.9em;
}

.excel-location strong {
    color: #1e3c72;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.pagination button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #1e3c72;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #2a5298;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pagination-info {
    color: #666;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
}

.modal-button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-button.primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
}

.modal-button.primary:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(30, 60, 114, 0.4);
}

.modal-button.secondary {
    background: #f0f0f0;
    color: #666;
}

.modal-button.secondary:hover {
    background: #e0e0e0;
}

/* Search Box for Localities */
.locality-search {
    width: 100%;
    padding: 12px 10px;
    border: 2px solid #e0e5ff;
    border-radius: 6px;
    font-size: 0.85em;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.locality-search:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.locality-select {
    max-height: 80px;
    overflow-y: auto;
    width: 100%;
    padding: 6px;
    border: 2px solid #e0e5ff;
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.locality-select:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* Highlight selected option */
.locality-select option:checked {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: bold;
}

.locality-select option {
    padding: 6px;
    margin: 1px 0;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.locality-select option:hover {
    background: #f0f0ff;
}

/* Visual feedback when locality is selected */
.locality-select.has-selection {
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.search-info {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 6px;
    font-style: italic;
}

.select-label {
    font-size: 0.85em;
    color: #333;
    font-weight: 600;
    margin-bottom: 5px;
    margin-top: 5px;
    display: block;
}

/* Results Section */
.results {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.results h2 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.log-container {
    background: #f8f9ff;
    border: 1px solid #e0e5ff;
    border-radius: 10px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.log-entry {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    line-height: 1.5;
}

.log-entry.info {
    background: #d1ecf1;
    color: #0c5460;
}

.log-entry.success {
    background: #d4edda;
    color: #155724;
}

.log-entry.error {
    background: #f8d7da;
    color: #721c24;
}

.log-entry.warning {
    background: #fff3cd;
    color: #856404;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .steps-container {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
    }
}
