/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors - more subtle */
    --bg-primary: #fefefe;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #334155;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: #e0e7ff;
    --success: #059669;
    --success-light: #d1fae5;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 8px 12px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark theme colors - more subtle */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-hover: #475569;
    --accent-primary: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: #312e81;
    --success: #10b981;
    --success-light: #064e3b;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 12px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: filter 0.3s ease;
}

.container.loading-blur {
    filter: blur(2px);
    pointer-events: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease-out;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    max-width: 420px;
    width: 90%;
    position: relative;
    backdrop-filter: blur(10px);
}

/* Spinner Section */
.loading-spinner-section {
    margin-bottom: 2rem;
}

.spinner-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.spinner-ring {
    width: 100px;
    height: 100px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    position: relative;
}

.spinner-ring::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 50%;
    animation: spin 1.8s linear infinite reverse;
}

.spinner-ring::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border: 1px solid transparent;
    border-top: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 50%;
    animation: spin 2.5s linear infinite;
}

.spinner-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6, #06b6d4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
}

.spinner-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Loading Title */
.loading-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2rem 0;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.url-highlight {
    display: inline-block;
    color: #6366f1;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.4rem 0.8rem;
    border-radius: 0.6rem;
    background-color: rgba(99, 102, 241, 0.15);
    border: 2px solid rgba(99, 102, 241, 0.3);
    margin: 0 0.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.url-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

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

/* Loading Messages */
.loading-messages {
    position: relative;
    height: 1.75rem;
    overflow: hidden;
}

.loading-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.6s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.loading-message.active {
    opacity: 1;
    transform: translateY(0);
}

.loading-message.fade-out {
    opacity: 0;
    transform: translateY(-12px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
}

/* Header Styles */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* Fixed Theme Toggle Button */
.theme-toggle-fixed {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.theme-toggle-fixed:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: var(--accent-primary);
}

.theme-toggle-fixed .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle-fixed .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle-fixed .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle-fixed {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.main {
    flex: 1;
    padding: 3rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-weight: 400;
}

/* Search Form */
.search-form {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.search-container {
    position: relative;
    flex: 1;
}

.url-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

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

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

.analyze-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    justify-content: center;
    font-family: inherit;
}

.analyze-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--card-shadow-hover);
}

.analyze-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.analyze-btn.loading .btn-text {
    display: none;
}

.analyze-btn.loading .loading-spinner {
    display: block;
}

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

.input-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* Search History Dropdown */
.search-history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: var(--card-shadow-hover);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.search-history-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.history-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-history-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-history-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--bg-secondary);
}

.history-item-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.history-item-url {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-all;
}

.history-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.history-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Not Found Message */
.not-found-message {
    text-align: center;
    padding: 1.5rem 0;
    margin: 1rem 0;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.not-found-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.not-found-message p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    max-width: 280px;
    margin: 0 auto;
}

/* Results Section */
.results {
    margin-top: 4rem;
}

.results-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.025em;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Metric Cards */
.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--success));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--border-hover);
}

.metric-card:hover::before {
    transform: scaleX(1);
}

.metric-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent-primary);
}

.metric-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.metric-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 1rem 0;
    line-height: 1;
}

.metric-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.metric-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--success-light);
    color: var(--success);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-status.up {
    background: var(--success-light);
    color: var(--success);
}

.metric-status.down {
    background: #fef2f2;
    color: #dc2626;
}

[data-theme="dark"] .metric-status.down {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Purpose Section */
.purpose-section {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border-left: 4px solid var(--accent-primary);
}

.purpose-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.purpose-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Companies Section */
.companies-section {
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.companies-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.companies-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.company-tag {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.company-tag:hover {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.company-tag.highlighted {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
}

.company-tag.highlighted:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.company-rank {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.7rem;
    min-width: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.company-tag.highlighted .company-rank {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.company-name {
    font-weight: 600;
    flex: 1;
}

.highlight-indicator {
    color: #ffd700;
    font-size: 0.8rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.no-companies {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Enhanced metric value styling */
.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-value::before {
    content: '';
    width: 4px;
    height: 2rem;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.3;
}

/* Comparison Section */
.comparison-section {
    grid-column: 1 / -1;
    margin-top: 3rem;
    padding: 0;
    background: transparent;
    border: none;
}

.comparison-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.025em;
    position: relative;
}

.comparison-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--success));
    border-radius: 2px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.comparison-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.comparison-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--model-color, var(--accent-primary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--model-color, var(--accent-primary));
}

.comparison-card:hover::before {
    transform: scaleX(1);
}

.comparison-card.excellent {
    border-color: #10b981;
}

.comparison-card.good {
    border-color: #f59e0b;
}

.comparison-card.average {
    border-color: #f59e0b;
}

.comparison-card.poor {
    border-color: #ef4444;
}

.comparison-card.not-found-card {
    border-color: #6b7280;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.comparison-card.not-found-card::before {
    background: #6b7280;
}

.comparison-card.not-found-card:hover {
    border-color: #6b7280;
    transform: translateY(-2px);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-tertiary);
}

.model-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.model-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.model-details {
    flex: 1;
}

.comparison-model {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.performance-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.performance-badge.excellent {
    background: #d1fae5;
    color: #065f46;
}

.performance-badge.good {
    background: #fef3c7;
    color: #92400e;
}

.performance-badge.average {
    background: #fef3c7;
    color: #92400e;
}

.performance-badge.poor {
    background: #fee2e2;
    color: #991b1b;
}

.performance-badge.not-found-badge {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.rank-display {
    text-align: right;
}

.rank-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--model-color, var(--accent-primary));
    line-height: 1;
    margin-bottom: 0.25rem;
}

.rank-number.not-found {
    font-size: 1.75rem;
    color: #6b7280;
    font-weight: 600;
}

.rank-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-stats {
    margin-bottom: 1.5rem;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 1.25rem;
    opacity: 0.7;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--model-color, var(--accent-primary));
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-companies {
    margin-bottom: 1.5rem;
}

.companies-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.comparison-company-tag {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    max-width: 100%;
    min-width: 0;
}

.comparison-company-tag:hover {
    background: var(--model-color, var(--accent-primary));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.comparison-company-tag.highlighted {
    background: linear-gradient(135deg, var(--model-color, var(--accent-primary)), var(--accent-hover));
    color: white;
    border-color: var(--model-color, var(--accent-primary));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
}

.comparison-company-tag.highlighted:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.comparison-company-tag .company-rank {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.7rem;
    min-width: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.comparison-company-tag.highlighted .company-rank {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.comparison-company-tag .company-name {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comparison-company-tag .highlight-indicator {
    color: #ffd700;
    font-size: 0.8rem;
    animation: pulse 2s infinite;
}

.more-companies {
    text-align: center;
    padding: 0.5rem;
}

.more-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.purpose-preview {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border-left: 4px solid var(--model-color, var(--accent-primary));
}

.purpose-text {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    font-style: italic;
}

.no-comparison-container {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-secondary);
    border-radius: 1rem;
    border: 2px dashed var(--border-color);
}

.no-comparison-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-comparison-container h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.no-comparison-container p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* View More Button */
.view-more-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-more-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

.view-more-btn.expanded {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Additional Companies */
.additional-companies {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
    margin-bottom: 0.75rem;
}

.additional-companies .companies-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.additional-companies .comparison-company-tag {
    margin-bottom: 0;
}

/* Companies Modal */
.companies-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    animation: slideInUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.all-companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.company-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.company-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.company-item.highlighted {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.company-item .company-rank {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    min-width: 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.company-item.highlighted .company-rank {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.company-item .company-name {
    font-weight: 600;
    flex: 1;
}

.highlight-star {
    color: #ffd700;
    font-size: 1rem;
    animation: pulse 2s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.metric-card {
    animation: slideInUp 0.6s ease-out;
}

.metric-card:nth-child(1) {
    animation-delay: 0.1s;
}

.metric-card:nth-child(2) {
    animation-delay: 0.2s;
}

.metric-card:nth-child(3) {
    animation-delay: 0.3s;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header {
        padding: 1.5rem 0;
    }
    
    .theme-toggle-fixed {
        top: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .analyze-btn {
        width: 100%;
        min-width: unset;
        padding: 1rem 1.5rem;
    }
    
    .search-container {
        width: 100%;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .metric-card {
        padding: 1.5rem;
    }
    
    .metric-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.875rem;
    }
    
    .metric-card {
        padding: 1.25rem;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
}

/* Error States */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

[data-theme="dark"] .error-message {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
    height: 1rem;
    margin: 0.5rem 0;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
