/* CSS Variables for theming */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* 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, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

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

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

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

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

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

/* Input section */
.input-section {
    margin-bottom: 2rem;
}

.input-container {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.input-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.input-container textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 200px;
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-container textarea::placeholder {
    color: var(--text-secondary);
}

.input-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Button styles */
.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-icon {
    font-size: 1.1rem;
}

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

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--card-background);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

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

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

.results-section.hidden {
    display: none;
}

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

.results-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.results-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Confidence score circle */
.confidence-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

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

.circular-chart {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}

.circle.low {
    stroke: var(--danger-color);
}

.circle.medium {
    stroke: var(--warning-color);
}

.circle.high {
    stroke: var(--success-color);
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Results grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Result cards */
.result-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1rem 1.25rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    padding: 1.25rem;
}

/* Analysis items */
.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

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

.analysis-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Issue items */
.issue-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

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

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

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

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

.issue-icon.info {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.issue-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Verification links */
.verification-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.verification-link:last-child {
    margin-bottom: 0;
}

.verification-link:hover {
    background: var(--border-color);
}

.verification-link .link-icon {
    font-size: 1.25rem;
}

.verification-link .link-text {
    flex: 1;
}

.verification-link .link-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.verification-link .link-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.verification-link .arrow {
    color: var(--text-secondary);
}

/* No issues message */
.no-issues {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-color);
    font-weight: 500;
}

/* Highlighted text section */
.highlighted-text-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.highlighted-text-section h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.highlight-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.highlight {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.highlight.sensational {
    background: rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.highlight.unverified {
    background: rgba(245, 158, 11, 0.3);
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.highlight.emotional {
    background: rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.5);
}

.highlight.vague {
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.highlighted-text {
    line-height: 1.8;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.highlighted-text mark {
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    font-weight: 500;
}

.highlighted-text mark.sensational {
    background: rgba(239, 68, 68, 0.25);
    border-bottom: 2px solid var(--danger-color);
}

.highlighted-text mark.unverified {
    background: rgba(245, 158, 11, 0.25);
    border-bottom: 2px solid var(--warning-color);
}

.highlighted-text mark.emotional {
    background: rgba(168, 85, 247, 0.25);
    border-bottom: 2px solid #a855f7;
}

.highlighted-text mark.vague {
    background: rgba(59, 130, 246, 0.25);
    border-bottom: 2px solid #3b82f6;
}

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

.footer p {
    font-size: 0.875rem;
}

.footer a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

/* Loading state */
.btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

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

    .logo-img {
        width: 40px;
        height: 40px;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .main-content {
        padding: 1rem;
    }

    .input-container {
        padding: 1rem;
    }

    .input-container textarea {
        min-height: 150px;
    }

    .input-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .highlight-legend {
        flex-direction: column;
        gap: 0.5rem;
    }

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

    .score-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .results-header {
        gap: 1rem;
    }

    .card-header,
    .card-content {
        padding: 1rem;
    }

    .highlighted-text-section {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .input-section,
    .footer {
        display: none;
    }

    .result-card {
        break-inside: avoid;
    }
}
