@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #0078d4;
    --secondary-color: #1e40af;
    --accent-color: #0078d4;
    --accent-hover: #1e40af;
    --accent-secondary: #7c3aed;
    --success-color: #38a169;
    --warning-color: #f59e0b;
    --danger-color: #e53e3e;
    --background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0f1419 100%);
    --surface: rgba(20, 25, 35, 0.95);
    --surface-secondary: rgba(15, 15, 25, 0.9);
    --text-primary: #f0f4f8;
    --text-secondary: #e0e6ed;
    --text-muted: #d1d8e0;
    --border-color: rgba(0, 120, 212, 0.4);
    --border-color-subtle: rgba(0, 120, 212, 0.2);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 4px 16px rgba(0, 120, 212, 0.15), 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--background);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
}

.header {
    background: linear-gradient(120deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    padding: 40px 30px 30px 30px;
    border-bottom: 1px solid var(--border-color-subtle);
    position: relative;
    overflow: hidden;
}

.brand {
    margin-bottom: 20px;
}

.brand-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: lowercase;
    letter-spacing: 0.025em;
    transition: color 0.2s ease;
    opacity: 0.95;
}

.brand-link:hover {
    color: #ffffff;
    opacity: 1;
}

.tool-info {
    text-align: center;
}

.tool-info h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tool-info p {
    color: rgba(240, 249, 255, 0.95);
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.95;
}

.upload-section {
    padding: 40px;
    border-bottom: 1px solid var(--border-color-subtle);
    background: var(--surface);
}

.upload-area {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

.api-input-container {
    flex: 1;
    min-width: 300px;
    background: var(--surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.input-type-selector {
    display: flex;
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-color-subtle);
}

.input-type-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.input-type-btn.active {
    background: var(--accent-color);
    color: white;
}

.input-type-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--surface);
}

.input-content {
    position: relative;
}

.input-method {
    display: none;
}

.input-method.active {
    display: block;
}

.url-input-group {
    background: var(--surface-secondary);
    padding: 24px;
    transition: all 0.2s ease;
}

.url-input-group:hover {
    background: var(--surface);
}

.url-input-group h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 600;
}

.file-upload {
    border: 2px dashed var(--border-color-subtle);
    border-radius: 0;
    padding: 30px;
    text-align: center;
    background: var(--surface-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    margin: 0;
}

.file-upload:hover {
    border-color: var(--accent-color);
    background: var(--surface);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.file-upload.dragover {
    border-color: var(--success-color);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.file-upload h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.url-input-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color-subtle);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.url-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.url-fetch-btn {
    padding: 12px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.url-fetch-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.url-fetch-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.file-info {
    margin-top: 15px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.compare-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

.compare-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: var(--text-muted);
}

.results-section {
    padding: 40px;
    display: none;
    background: var(--surface);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-title {
    font-size: 1.8rem;
    color: var(--text-primary);
    font-weight: 700;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

.filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.export-controls {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.export-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.export-group-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.export-group .export-btn {
    min-width: 100px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color-subtle);
    background: var(--surface-secondary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.filter-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.export-btn {
    padding: 8px 16px;
    border: 1px solid var(--success-color);
    background: var(--surface-secondary);
    color: var(--success-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.export-btn:hover {
    background: var(--success-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.export-btn.compact {
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-size: 0.85rem;
    padding: 6px 14px;
}

.export-btn.compact:hover {
    background: var(--accent-color);
    color: white;
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-secondary), var(--warning-color));
}

.change-item {
    position: relative;
    margin-bottom: 20px;
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    transition: all 0.2s ease;
}

.change-item:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-lg);
}

.change-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 20px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--surface);
}

.change-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.change-type {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.change-path {
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

.change-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-added { background: #f0fff4; color: var(--success-color); }
.badge-removed { background: #fed7d7; color: var(--danger-color); }
.badge-modified { background: #fef5e7; color: var(--warning-color); }
.badge-breaking { background: #fed7d7; color: var(--danger-color); }

.change-details {
    margin-top: 15px;
}

.detail-section {
    margin-bottom: 15px;
}

.detail-title {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.detail-content {
    background: var(--surface-secondary);
    padding: 12px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.85rem;
    border-left: 3px solid var(--accent-color);
    color: var(--text-primary);
}

.diff-line {
    margin: 2px 0;
}

.diff-added { color: var(--success-color); }
.diff-removed { color: var(--danger-color); }

.stats-summary {
    background: linear-gradient(135deg, rgba(0, 120, 212, 0.06), rgba(124, 58, 237, 0.04));
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    border: 1px solid var(--border-color-subtle);
}

.stat-item {
    text-align: center;
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
    font-weight: 500;
}

.no-changes {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-changes-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--accent-color);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color-subtle);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.upload-loading {
    text-align: center;
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 8px;
    margin-top: 15px;
}

.upload-loading .loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.comparison-progress {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color-subtle);
    border-radius: 12px;
    padding: 25px;
    margin-top: 25px;
    backdrop-filter: blur(10px);
}

.progress-header {
    text-align: center;
    margin-bottom: 20px;
}

.progress-header h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-status {
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: 500;
}

.progress-bar-container {
    background: var(--surface);
    border-radius: 10px;
    height: 8px;
    margin: 20px 0;
    overflow: hidden;
    border: 1px solid var(--border-color-subtle);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.progress-step {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    text-align: center;
}

.progress-step.active {
    background: rgba(0, 120, 212, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.02);
}

.progress-step.completed {
    background: rgba(56, 161, 105, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

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

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .upload-section, .results-section {
        padding: 20px;
    }
    
    .api-input-container {
        min-width: 100%;
    }

    .file-upload {
        padding: 20px;
    }
    
    .url-input-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .url-fetch-btn {
        width: 100%;
    }
    
    .change-item {
        padding: 20px;
        margin-left: -10px;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls {
        align-items: stretch;
    }
    
    .filter-controls, .export-controls {
        justify-content: center;
    }
    
    .export-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .export-group {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .export-group-label {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }
    
    .comparison-progress {
        padding: 20px;
        margin-top: 20px;
    }
    
    .progress-steps {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .progress-step {
        font-size: 0.85rem;
        padding: 10px 12px;
    }
    
    .upload-loading {
        padding: 12px;
        margin-top: 10px;
    }
}

/* Footer */
.footer {
    padding: 20px 30px;
}

.version-info {
    text-align: center;
}

.version-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.3;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}
