/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --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;
}

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-color: var(--background-color);
    min-height: 100vh;
    position: relative;
}

/* Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    opacity: 0.05;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -150px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 10%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(30px) rotate(240deg); }
}

/* Header */
.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.mode-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 1rem;
}

.genai-mode {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.ai-mode {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.lite-mode {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* Input Method Selection */
.input-method-section {
    margin-bottom: 1rem;
}

.input-method-tabs {
    display: flex;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
    gap: 0.25rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Upload Section */
.upload-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

/* Input Tabs */
.input-tab {
    display: none;
}

.input-tab.active {
    display: block;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* File Upload */
.file-upload-wrapper {
    position: relative;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2rem;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

.upload-icon {
    width: 3rem;
    height: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.file-types {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

#file {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: var(--radius-md);
    color: #065f46;
    font-size: 0.875rem;
}

/* Text Input */
.text-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.text-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.text-input-label:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

.text-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.text-input-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.text-input-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

#textInput {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#textInput::placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.text-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.char-count, .word-count {
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* Settings Section */
.settings-section {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.settings-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

input[type="number"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Submit Button */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Loader */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem;
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result Section */
.result-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.result-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--success-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.download-icon {
    width: 1rem;
    height: 1rem;
}

.summary-content {
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.summary-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    font-family: 'Inter', system-ui, sans-serif;
}

/* Enhanced formatting for summary content */
.summary-text h1, .summary-text h2, .summary-text h3 {
    color: var(--primary-color);
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.summary-text h1 {
    font-size: 1.5rem;
    text-align: center;
    color: var(--primary-color);
}

.summary-text h2 {
    font-size: 1.25rem;
    color: var(--success-color);
}

.summary-text h3 {
    font-size: 1.125rem;
    color: var(--secondary-color);
}

.summary-text .section-header {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    display: block;
}

.summary-text .numbered-point {
    background: #f1f5f9;
    border-left: 4px solid var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.summary-text .key-terms {
    background: #ecfdf5;
    border: 1px solid var(--success-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #065f46;
}

.summary-text .disclaimer {
    background: #fef3cd;
    border: 1px solid var(--warning-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    color: #92400e;
}

.summary-text .separator {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 1.5rem 0;
}

/* GenAI-specific formatting */
.summary-text .genai-section-header {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.summary-text .bullet-point {
    background: #f8fafc;
    border-left: 3px solid var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.6;
    position: relative;
}

.summary-text .bullet-point::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2em;
    position: absolute;
    left: 0.5rem;
    top: 0.75rem;
}

.summary-text .bullet-point {
    padding-left: 2rem; /* Make room for the bullet */
}

.summary-text .risk-indicator {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    font-weight: 500;
}

.summary-text .risk-indicator.risk-🚨 {
    background: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.summary-text .risk-indicator.risk-⚠️ {
    background: #fef3cd;
    border-left-color: #f59e0b;
    color: #92400e;
}

.summary-text .risk-indicator.risk-ℹ️ {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.summary-text .risk-emoji {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Enhanced markdown support */
.summary-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-text em {
    font-style: italic;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-text h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.summary-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 1rem 0 0.5rem 0;
}

/* Q&A Section */
.qa-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.qa-header {
    text-align: center;
    margin-bottom: 2rem;
}

.qa-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.qa-description {
    color: var(--text-secondary);
    font-size: 1rem;
}

.qa-form {
    margin-bottom: 2rem;
}

.question-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.question-input {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

.question-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ask-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.ask-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.ask-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.qa-history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qa-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #f8fafc;
}

.qa-question {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    font-weight: 500;
}

.qa-answer {
    padding: 1rem;
    background: white;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.qa-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #f1f5f9;
    color: var(--text-secondary);
    font-style: italic;
}

.qa-loading .spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #e2e8f0;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Feedback Section */
.feedback-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feedback-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.textarea-wrapper {
    display: flex;
    flex-direction: column;
}

.textarea-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.feedback-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: var(--primary-hover);
}

.feedback-status {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.feedback-status.success {
    color: var(--success-color);
    background: #ecfdf5;
}

.feedback-status.error {
    color: var(--error-color);
    background: #fef2f2;
}

/* Footer */
.footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .upload-section,
    .result-section,
    .qa-section,
    .feedback-section {
        padding: 1.5rem;
    }
    
    .file-upload-label {
        min-height: 150px;
        padding: 1.5rem;
    }
    
    .upload-icon {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .input-group {
        grid-template-columns: 1fr;
    }
    
    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .download-btn {
        justify-content: center;
    }
    
    .question-input-wrapper {
        gap: 0.75rem;
    }
    
    .ask-btn {
        align-self: stretch;
        justify-content: center;
    }
    
    .input-method-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 1rem;
        font-size: 1rem;
    }
    
    #textInput {
        min-height: 250px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .upload-section,
    .result-section,
    .qa-section,
    .feedback-section {
        padding: 1rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
}
