/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #a0a0a0;
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #a0a0a0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(100, 200, 255, 0.15);
    color: #64c8ff;
}

.tab-btn svg {
    flex-shrink: 0;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Paste Zone */
.paste-zone {
    border: 2px dashed rgba(100, 200, 255, 0.3);
    border-radius: 12px;
    background: rgba(100, 200, 255, 0.02);
    overflow: hidden;
}

.paste-zone textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: none;
    background: transparent;
    color: #e0e0e0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
}

.paste-zone textarea::placeholder {
    color: #666;
}

.paste-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.char-count {
    font-size: 0.8rem;
    color: #666;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.drop-zone {
    border: 2px dashed rgba(100, 200, 255, 0.3);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(100, 200, 255, 0.02);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #64c8ff;
    background: rgba(100, 200, 255, 0.08);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-icon {
    color: #64c8ff;
    margin-bottom: 1rem;
}

.or-text {
    color: #666;
    margin: 0.5rem 0;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(100, 200, 255, 0.1);
    border-radius: 8px;
}

.file-name {
    font-weight: 500;
    color: #64c8ff;
}

.btn-remove {
    background: rgba(255, 100, 100, 0.2);
    border: none;
    color: #ff6464;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: rgba(255, 100, 100, 0.4);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4a90d9;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3a7fc9;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #27ae60;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Supported Carriers */
.supported-carriers {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.supported-carriers h3 {
    color: #a0a0a0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.supported-carriers ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.supported-carriers li {
    background: rgba(100, 200, 255, 0.1);
    color: #64c8ff;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.results-section h2 {
    margin-bottom: 1.5rem;
    color: #fff;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(100, 200, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: #64c8ff;
}

.preview-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.preview-table th,
.preview-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.preview-table th {
    background: rgba(100, 200, 255, 0.1);
    color: #64c8ff;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.preview-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.more-row td {
    text-align: center;
    color: #a0a0a0;
    font-style: italic;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 0.9rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(100, 200, 255, 0.3);
    border-top-color: #64c8ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: #fff;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: #2ecc71;
    color: white;
}

.toast.error {
    background: #e74c3c;
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 16px;
    padding: 2rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.modal-header h2 {
    color: #fff;
    margin: 0;
}

.modal-close {
    background: rgba(255, 100, 100, 0.2);
    border: none;
    color: #ff6464;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 100, 100, 0.4);
}

.modal-subtitle {
    color: #a0a0a0;
    margin-bottom: 1.5rem;
}

/* Mapping Options */
.mapping-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(100, 200, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(100, 200, 255, 0.1);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.option-group label {
    font-size: 0.85rem;
    color: #a0a0a0;
}

.option-group input,
.option-group select {
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.option-group input:focus,
.option-group select:focus {
    outline: none;
    border-color: #64c8ff;
}

.option-hint {
    font-size: 0.75rem;
    color: #666;
}

/* Mapping Section */
.mapping-section {
    margin-bottom: 1.5rem;
}

.mapping-section h3 {
    color: #a0a0a0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.mapping-row label {
    min-width: 140px;
    font-size: 0.9rem;
    color: #e0e0e0;
}

.mapping-row label.required::after {
    content: ' *';
    color: #ff6464;
}

.mapping-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
}

.mapping-select:focus {
    outline: none;
    border-color: #64c8ff;
}

/* Mapping Preview */
.mapping-preview-section {
    margin-bottom: 1.5rem;
}

.mapping-preview-section h3 {
    color: #a0a0a0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.mapping-preview-table {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.mapping-preview-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.mapping-preview-table th,
.mapping-preview-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.mapping-preview-table th {
    background: rgba(100, 200, 255, 0.1);
    color: #64c8ff;
    font-weight: 600;
    position: sticky;
    top: 0;
}

/* Output Fields Section */
.output-fields-section {
    margin-bottom: 1.5rem;
}

.output-fields-section h3 {
    color: #a0a0a0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.section-hint {
    font-size: 0.75rem;
    color: #666;
    text-transform: none;
    letter-spacing: normal;
}

.output-fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
}

.output-field-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(100, 200, 255, 0.1);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 6px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
}

.output-field-item:hover {
    background: rgba(100, 200, 255, 0.2);
    border-color: rgba(100, 200, 255, 0.5);
}

.output-field-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.output-field-item.unchecked {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
    opacity: 0.6;
}

.output-field-item.unchecked .field-label {
    text-decoration: line-through;
    color: #666;
}

.output-field-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #64c8ff;
}

.output-field-item .field-label {
    font-size: 0.85rem;
    color: #e0e0e0;
}

.output-field-item .drag-handle {
    color: #666;
    font-size: 1rem;
    cursor: grab;
}

.output-field-item .drag-handle:hover {
    color: #64c8ff;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
