/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark Mode Variables */
:root.dark-mode {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #f472b6;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-light: #9ca3af;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --border-color: #374151;
    --border-light: #4b5563;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Dark Mode Toggle Icon Change */
:root.dark-mode .dark-mode-toggle i:before {
    content: "\f185"; /* fa-sun */
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0.1;
    animation: float 15s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 10%;
    animation-delay: -5s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 70%;
    right: 10%;
    animation-delay: -10s;
    animation-duration: 20s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    top: 30%;
    right: 30%;
    animation-delay: -15s;
    animation-duration: 18s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 20%;
    animation-delay: -7s;
    animation-duration: 22s;
}

.shape-5 {
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    animation-delay: -12s;
    animation-duration: 16s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(120deg);
    }
    66% {
        transform: translateY(20px) rotate(240deg);
    }
}

/* Header */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: var(--transition-normal);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.5rem;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition-normal);
}

.nav-link:hover::after {
    width: 100%;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    margin-left: 1rem;
    font-size: 1rem;
}

.dark-mode-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Main Content */
.main {
    padding-top: 80px;
}

/* Hero Section */
.hero {
    padding: 4rem 0 6rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease;
}

.highlight {
    position: relative;
    /* Override the parent's text transparency for the animated text */
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--success-color), var(--warning-color)) !important;
    background-size: 400% 400% !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    animation: gradientShift 3s ease-in-out infinite !important;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    animation: expandWidth 1s ease 0.5s both;
}

/* Animated Text Cycling - Typewriter Effect */
.animated-text {
    display: inline-block;
    min-width: 200px;
    text-align: left;
    position: relative;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Upload Section */
.upload-section {
    padding: 4rem 0;
    background: var(--bg-secondary);
}

.upload-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.8s ease;
}

.upload-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    background: var(--bg-secondary);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.browse-text {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.upload-area small {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* File Info */
.file-info {
    margin-top: 1rem;
    animation: slideInUp 0.3s ease;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.file-preview i {
    font-size: 2rem;
    color: var(--error-color);
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-light);
}

.remove-file {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.remove-file:hover {
    background: var(--bg-tertiary);
    color: var(--error-color);
}

/* Text Input Area */
.text-input-area {
    position: relative;
}

.text-input-area textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition-fast);
    background: var(--bg-secondary);
}

.text-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.char-counter {
    text-align: right;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Analyze Button */
.analyze-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

.analyze-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-light);
    cursor: not-allowed;
}

.analyze-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.analyze-btn:not(:disabled):active {
    transform: translateY(0);
}

/* AI Analyze Button */
.ai-analyze-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.ai-analyze-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-light);
    cursor: not-allowed;
}

.ai-analyze-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(147, 51, 234, 0.3);
}

.ai-analyze-btn:not(:disabled):active {
    transform: translateY(0);
}

.ai-analyze-btn .fas {
    margin-right: 0.5rem;
}

.btn-text,
.btn-loader {
    transition: var(--transition-fast);
}

/* API Status Indicator - Enhanced for web compatibility with fallbacks */
.api-status {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    color: #1f2937 !important; /* fallback */
    color: var(--text-primary) !important;
    margin-top: 8px !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    background: #ffffff !important; /* fallback */
    background: var(--bg-primary) !important;
    border: 1px solid #e5e7eb !important; /* fallback */
    border: 1px solid var(--border-color) !important;
    box-sizing: border-box !important;
}

.api-status i {
    margin-right: 6px !important;
    font-size: 10px !important;
}

.api-status.healthy {
    color: #27ae60 !important;
    border-color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.1) !important;
}

.api-status.unhealthy {
    color: #e74c3c !important;
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
}

.api-status.checking {
    color: #f39c12 !important;
    border-color: #f39c12 !important;
    background: rgba(243, 156, 18, 0.1) !important;
}

.api-status.unknown {
    color: #95a5a6 !important;
    border-color: #95a5a6 !important;
    background: rgba(149, 165, 166, 0.1) !important;
}

.api-status.checking i {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Dark mode adjustments for API status */
[data-theme="dark"] .api-status.healthy {
    background: rgba(39, 174, 96, 0.2);
}

[data-theme="dark"] .api-status.unhealthy {
    background: rgba(231, 76, 60, 0.2);
}

[data-theme="dark"] .api-status.checking {
    background: rgba(243, 156, 18, 0.2);
}

[data-theme="dark"] .api-status.unknown {
    background: rgba(149, 165, 166, 0.2);
}

/* Rate Limit Notice */
.rate-limit-notice {
    display: flex;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    line-height: 1.4;
}

.rate-limit-notice i {
    margin-right: 6px;
    margin-top: 2px;
    font-size: 10px;
    color: #3498db;
    flex-shrink: 0;
}

[data-theme="dark"] .rate-limit-notice {
    background: rgba(52, 152, 219, 0.2);
}

/* Results Section */
.results-section {
    padding: 4rem 0;
    animation: fadeInUp 0.8s ease;
}

.results-container {
    max-width: 1000px;
    margin: 0 auto;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.results-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.new-analysis-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.new-analysis-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 2rem;
}

/* Score Card */
.score-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-light);
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.score-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.score-tooltip {
    position: relative;
    cursor: help;
    color: var(--text-light);
}

.score-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
    z-index: 1000;
    max-width: 200px;
    white-space: normal;
}

.score-tooltip:hover::before {
    opacity: 1;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.score-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 1s ease-in-out;
}

.score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.score-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Suggestions Card */
.suggestions-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.suggestions-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.suggestions-card h3 i {
    color: var(--warning-color);
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid transparent;
    transition: var(--transition-fast);
}

.suggestion-item:hover {
    background: var(--bg-tertiary);
}

.suggestion-item.high {
    border-left-color: var(--error-color);
}

.suggestion-item.medium {
    border-left-color: var(--warning-color);
}

.suggestion-item.low {
    border-left-color: var(--success-color);
}

.suggestion-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
}

.suggestion-item.high .suggestion-icon {
    background: var(--error-color);
}

.suggestion-item.medium .suggestion-icon {
    background: var(--warning-color);
}

.suggestion-item.low .suggestion-icon {
    background: var(--success-color);
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.suggestion-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Highlights Card */
.highlights-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    grid-column: 1 / -1;
}

.highlights-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.highlights-card h3 i {
    color: var(--secondary-color);
}

.highlighted-text {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-primary);
    max-height: 300px;
    overflow-y: auto;
}

.highlight-issue {
    background: rgba(239, 68, 68, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    position: relative;
    cursor: help;
}

.highlight-issue::after {
    content: attr(data-issue);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
    z-index: 1000;
}

.highlight-issue:hover::after {
    opacity: 1;
}

/* AI Results Section */
.ai-results-section {
    display: none;
    padding: 4rem 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    animation: fadeInUp 0.8s ease;
}

.ai-results-section h2 {
    color: #9333ea;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
}

.ai-results-section h2 i {
    margin-right: 0.5rem;
    color: #9333ea;
}

.ai-analysis-content {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
}

.ai-score-display {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
}

.ai-score-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    color: white;
    font-weight: bold;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.3);
}

.ai-score-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.ai-score-max {
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0.8;
    margin-left: 2px;
}

.ai-score-label {
    font-size: 1.1rem;
    color: #9333ea;
    font-weight: 600;
    margin: 0;
}

.ai-analysis-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.ai-analysis-text p {
    margin-bottom: 1.5rem;
}

.ai-analysis-text p:last-child {
    margin-bottom: 0;
}

.ai-analysis-text h1,
.ai-analysis-text h2,
.ai-analysis-text h3,
.ai-analysis-text h4,
.ai-analysis-text h5,
.ai-analysis-text h6 {
    color: #9333ea;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.ai-analysis-text h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid #9333ea;
    padding-bottom: 0.5rem;
}

.ai-analysis-text h2 {
    font-size: 1.5rem;
}

.ai-analysis-text h3 {
    font-size: 1.3rem;
}

.ai-analysis-text h4 {
    font-size: 1.2rem;
}

.ai-analysis-text h5 {
    font-size: 1.1rem;
}

.ai-analysis-text h6 {
    font-size: 1rem;
    font-weight: 600;
}

.ai-analysis-text code {
    background: #f1f5f9;
    color: #9333ea;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.ai-analysis-text ul {
    margin: 1rem 0;
    padding-left: 0;
}

.ai-analysis-text li {
    list-style: none;
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ai-analysis-text li:before {
    content: "•";
    color: #9333ea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.ai-analysis-text strong {
    color: #9333ea;
    font-weight: 600;
}

.ai-analysis-text em {
    color: #7c3aed;
    font-style: italic;
}

/* Features Section */
.features {
    padding: 6rem 0;
    background: var(--bg-secondary);
    text-align: center;
}

.features h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    border: 1px solid var(--border-light);
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.feature h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.feature p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* How It Works */
.how-it-works {
    padding: 6rem 0;
    text-align: center;
}

.how-it-works h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4rem;
}

.steps {
    display: flex;
    justify-content: center;
    gap: 3rem;
    max-width: 900px;
    margin: 0 auto;
}

.step {
    flex: 1;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 30px;
    right: -1.5rem;
    width: 3rem;
    height: 2px;
    background: var(--border-color);
}

.step-number {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.step h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.step p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Examples Section */
.examples {
    padding: 6rem 0;
    background: var(--bg-primary);
    text-align: center;
}

.examples h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.examples-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 4rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.example-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-light);
    transition: var(--transition-normal);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.example-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--error-color);
}

.example-card.medium-score::before {
    background: var(--warning-color);
}

.example-card.high-score::before {
    background: var(--success-color);
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.example-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.score-badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.score-badge.low {
    background: var(--error-color);
}

.score-badge.medium {
    background: var(--warning-color);
}

.score-badge.high {
    background: var(--success-color);
}

.example-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    margin-right: 1rem;
}

.difficulty {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.example-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--border-color);
}

.preview-text {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-primary);
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.preview-text::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--bg-secondary);
    padding-left: 1rem;
}

.example-issues,
.example-strengths {
    margin-bottom: 2rem;
}

.example-issues h4,
.example-strengths h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.example-issues h4::before {
    content: '⚠️';
    font-size: 1rem;
}

.example-strengths h4::before {
    content: '✅';
    font-size: 1rem;
}

.example-issues ul,
.example-strengths ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.example-issues li,
.example-strengths li {
    padding: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1rem;
}

.example-issues li::before {
    content: '•';
    color: var(--error-color);
    position: absolute;
    left: 0;
}

.example-strengths li::before {
    content: '•';
    color: var(--success-color);
    position: absolute;
    left: 0;
}

.example-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.example-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.example-btn:active {
    transform: translateY(0);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: var(--transition-normal);
}

.modal.active .modal-content {
    transform: scale(1);
}

.loading-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.loading-content p {
    color: var(--text-secondary);
}

.loading-animation {
    margin-bottom: 2rem;
}

.loading-dots {
    display: inline-block;
    position: relative;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

.loading-dots .dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
}

.loading-dots .dot:nth-child(1) {
    top: 4px;
    left: 16px;
}

.loading-dots .dot:nth-child(2) {
    top: 16px;
    right: 4px;
}

.loading-dots .dot:nth-child(3) {
    bottom: 4px;
    left: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-content .error-icon {
    font-size: 3rem;
    color: var(--error-color);
    margin-bottom: 1rem;
}

.error-content h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-btn:hover {
    background: var(--primary-dark);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header .container {
        padding: 0.75rem 1rem;
    }

    .nav {
        display: none;
    }

    .hero {
        padding: 2rem 0 3rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .upload-container {
        margin: 0 1rem;
        padding: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps {
        flex-direction: column;
        gap: 2rem;
    }

    .step:not(:last-child)::after {
        display: none;
    }

    .features h2,
    .how-it-works h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .upload-tabs {
        flex-direction: column;
    }

    .tab-btn {
        justify-content: flex-start;
    }

    .score-circle {
        width: 100px;
        height: 100px;
    }

    .score-number {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .background-animation,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .floating-shapes {
        display: none;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
textarea:focus,
.upload-area:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --text-primary: #000000;
        --text-secondary: #333333;
        --bg-primary: #ffffff;
        --border-color: #000000;
    }
}

/* Dark Mode Specific Styles */
:root.dark-mode .header {
    background: rgba(31, 41, 55, 0.95) !important;
    border-bottom-color: var(--border-color);
}

:root.dark-mode .logo {
    color: var(--text-primary);
}

:root.dark-mode .nav-link {
    color: var(--text-secondary);
}

:root.dark-mode .nav-link:hover {
    color: var(--primary-color);
}

:root.dark-mode .dark-mode-toggle {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

:root.dark-mode .dark-mode-toggle:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
}

/* Dark mode styles for footer */
:root.dark-mode .footer {
    background: #1f2937 !important;
    color: var(--text-primary);
}

:root.dark-mode .upload-area {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

:root.dark-mode .upload-area:hover {
    background: #4b5563;
    border-color: var(--primary-color);
}

:root.dark-mode .feature {
    background: var(--bg-secondary);
}

:root.dark-mode .step {
    background: #111827;
}

:root.dark-mode .example-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

:root.dark-mode .example-card:hover {
    background: var(--bg-tertiary);
}

:root.dark-mode .score-badge {
    color: white;
}

:root.dark-mode .ai-analysis-content {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

:root.dark-mode .ai-analysis-text code {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

:root.dark-mode input,
:root.dark-mode textarea {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

:root.dark-mode input:focus,
:root.dark-mode textarea:focus {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

:root.dark-mode .tab-btn.active {
    background: var(--primary-color);
    color: white;
}

:root.dark-mode .loading-modal,
:root.dark-mode .error-modal {
    background: rgba(0, 0, 0, 0.8);
}

:root.dark-mode .loading-content,
:root.dark-mode .error-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Smooth transition for dark mode */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
