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

:root {
    --primary: #3A8AC3;
    --primary-dark: #2d6fa0;
    --primary-light: #e8f4fc;
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
    --text: #333;
    --text-light: #666;
    --bg: #f5f7fa;
    --card-bg: #fff;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

/* Tab Container */
.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border);
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Converter Panel */
.converter-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.converter-panel h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 12px;
    margin-top: 20px;
}

.converter-panel h4:first-child {
    margin-top: 0;
}

/* Upload Zone / Dropzone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-content {
    pointer-events: none;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.dropzone-text {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 8px;
}

.dropzone-hint {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Selected File */
.selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: 8px;
    margin-top: 12px;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-icon {
    color: var(--success);
    font-weight: bold;
    margin-right: 8px;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.remove-btn:hover {
    color: var(--error);
}

/* Radio Options */
.target-options,
.source-options,
.format-options,
.em-import-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: var(--primary);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.radio-option input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Portal Credentials */
.portal-credentials {
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group:last-of-type {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* EM Options */
.em-options {
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
}

.em-options > label {
    display: block;
    font-weight: 500;
    margin-bottom: 12px;
}

.em-template-upload {
    margin-top: 12px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 2px dashed var(--border);
}

.em-template-upload input[type="file"] {
    width: 100%;
    padding: 8px;
    border: none;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 8px;
}

/* Action Buttons */
.action-buttons {
    margin-top: 24px;
}

.convert-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.convert-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.convert-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    color: var(--error);
    border: 2px solid var(--error);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 16px;
}

.btn-cancel:hover {
    background: var(--error);
    color: white;
}

/* Progress Section */
.progress-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-top: 20px;
}

.progress-section h4 {
    margin-bottom: 16px;
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-top: 20px;
}

.results-section.success {
    border-left: 4px solid var(--success);
}

.results-section h4 {
    margin-bottom: 20px;
    color: var(--success);
}

.success-icon {
    color: var(--success);
    font-weight: bold;
    margin-right: 8px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 24px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

/* Error Section */
.error-section {
    margin-top: 20px;
}

.error-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--error);
}

.error-card h4 {
    color: var(--error);
    margin-bottom: 12px;
}

.error-icon {
    font-weight: bold;
    margin-right: 8px;
}

.error-card p {
    margin-bottom: 16px;
    color: var(--text);
}

.retry-btn {
    padding: 10px 24px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover {
    background: #c82333;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.health-status {
    margin-top: 8px;
}

.health-status.online {
    color: var(--success);
}

.health-status.offline {
    color: var(--error);
}

/* Responsive */
@media (max-width: 600px) {
    .tab-container {
        flex-direction: column;
    }

    .result-stats {
        flex-direction: column;
        gap: 20px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .radio-option {
        padding: 10px 12px;
    }
}
