/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --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;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

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

.logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.upload-area.drag-over {
    transform: scale(1.01);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* File Info */
.file-info {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.file-icon {
    color: var(--error-color);
    flex-shrink: 0;
}

.file-meta {
    flex: 1;
    min-width: 0;
}

.file-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

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

.btn-analyze {
    width: 100%;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 3rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

.loading-section p {
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    font-size: 1.25rem;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

/* Score Overview */
.score-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    align-items: center;
    justify-content: center;
}

.score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.score-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.score-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.score-progress {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

.score-progress.warning {
    stroke: var(--warning-color);
}

.score-progress.error {
    stroke: var(--error-color);
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-value span:first-child {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.score-summary {
    flex: 1;
    min-width: 200px;
}

.score-summary h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.score-summary p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.score-stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

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

.stat:first-child .stat-value {
    color: var(--success-color);
}

.stat:nth-child(2) .stat-value {
    color: var(--warning-color);
}

.stat:last-child .stat-value {
    color: var(--error-color);
}

/* Results Tabs */
.results-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
}

.tab-btn {
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease;
}

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

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Results Content */
.results-content {
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

/* Issue Cards */
.issue-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: box-shadow 0.2s ease;
}

.issue-card:hover {
    box-shadow: var(--shadow-sm);
}

.issue-card:last-child {
    margin-bottom: 0;
}

.issue-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.issue-icon.passed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.issue-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.issue-icon.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.issue-content {
    flex: 1;
    min-width: 0;
}

.issue-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.issue-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.issue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.issue-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.issue-tag.wcag {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Text Extraction Section */
.text-extraction-section {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.text-extraction-section h3 {
    margin-bottom: 1rem;
}

.text-content {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* No Issues State */
.no-issues {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.no-issues svg {
    color: var(--success-color);
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

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

    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .main-content {
        padding: 1rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-area h2 {
        font-size: 1.125rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
    }

    .results-actions .btn {
        flex: 1;
    }

    .score-overview {
        flex-direction: column;
        text-align: center;
    }

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

    .score-summary {
        min-width: auto;
    }

    .issue-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .issue-icon {
        align-self: flex-start;
    }
}

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

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .results-tabs {
        padding: 0;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-value span:first-child {
        font-size: 2rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Print Styles */
@media print {
    .header,
    .upload-section,
    .results-actions,
    .results-tabs,
    .footer {
        display: none;
    }

    .results-section {
        box-shadow: none;
    }

    .results-content {
        max-height: none;
        overflow: visible;
    }
}
