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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --similar-color: #86efac;
    --unique-1-color: #fcd34d;
    --unique-2-color: #93c5fd;
    --background: #f9fafb;
    --surface: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main content */
main {
    flex: 1;
}

/* Input Section */
.input-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.url-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.input-group input[type="text"],
.input-group textarea {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input[type="text"]:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Options */
.options {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.option-group select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--surface);
    cursor: pointer;
}

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

input[type="range"] {
    width: 120px;
    cursor: pointer;
}

#threshold-value {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
}

/* Buttons */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}

.secondary-btn {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.secondary-btn:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* Results Section */
.results-section {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Summary Card */
.summary-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.summary-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.summary-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    min-width: 140px;
}

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.summary-text {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Legend */
.legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.similar {
    background: var(--similar-color);
}

.legend-color.unique-1 {
    background: var(--unique-1-color);
}

.legend-color.unique-2 {
    background: var(--unique-2-color);
}

/* Comparison View */
.comparison-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.content-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.content-panel h3 {
    padding: 1rem 1.5rem;
    background: var(--background);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.content-display {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Highlighted content */
.similar-text {
    background: var(--similar-color);
    padding: 2px 4px;
    border-radius: 3px;
}

.unique-text-1 {
    background: var(--unique-1-color);
    padding: 2px 4px;
    border-radius: 3px;
}

.unique-text-2 {
    background: var(--unique-2-color);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Differences Section */
.differences-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.differences-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.differences-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.difference-item {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--warning-color);
}

.difference-item.added {
    border-left-color: var(--success-color);
}

.difference-item.removed {
    border-left-color: var(--error-color);
}

.difference-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.difference-content {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Error Section */
.error-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    text-align: center;
    border-top: 4px solid var(--error-color);
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

#error-message {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Scrollbar */
.content-display::-webkit-scrollbar {
    width: 8px;
}

.content-display::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.content-display::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.content-display::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .url-inputs {
        grid-template-columns: 1fr;
    }

    .comparison-view {
        grid-template-columns: 1fr;
    }

    .options {
        flex-direction: column;
        gap: 1rem;
    }

    .option-group {
        flex-wrap: wrap;
    }

    .summary-stats {
        justify-content: center;
    }

    .stat {
        min-width: 120px;
        padding: 0.75rem 1rem;
    }

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

    .input-section {
        padding: 1.5rem;
    }

    .summary-card,
    .differences-section {
        padding: 1.5rem;
    }

    .legend {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .summary-stats {
        gap: 1rem;
    }

    .stat {
        flex: 1;
        min-width: 90px;
    }
}

/* Loading state */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}
