/* ============================================
   MedEvidence v2.0 - Stylesheet
   ============================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: #1e293b;
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-badge {
    background: #f59e0b;
    color: #1e293b;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.lang-select {
    padding: 8px 12px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #334155;
    color: white;
    cursor: pointer;
}

#userMenu {
    display: flex;
    align-items: center;
    gap: 12px;
}

#userName {
    color: #cbd5e1;
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

.btn-icon-only {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.7;
}

.btn-icon-only:hover {
    opacity: 1;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: #16a34a;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-success:hover {
    background: #15803d;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 80px 24px;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 36px;
    margin-bottom: 16px;
    font-weight: 700;
}

.hero p {
    font-size: 18px;
    color: #cbd5e1;
    margin-bottom: 32px;
}

/* About Section */
.about-section {
    padding: 60px 24px;
    background: white;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

.about-section h2 {
    font-size: 28px;
    color: #1e293b;
    margin-bottom: 16px;
    text-align: center;
}

.about-section > .container > p {
    text-align: center;
    color: #64748b;
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.feature-card h3 {
    color: #1e293b;
    font-size: 16px;
    margin-bottom: 8px;
}

.feature-card p {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* Comparison Section */
.comparison-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.comparison-section h3 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.comparison-section > p {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
}

.comparison-table {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.comparison-table th {
    background: #f8fafc;
    font-weight: 600;
}

.comparison-table .check {
    color: #16a34a;
    font-weight: bold;
}

.comparison-table .cross {
    color: #dc2626;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 24px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Search Section */
.search-section {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.search-header {
    text-align: center;
    margin-bottom: 32px;
}

.search-header h1 {
    font-size: 26px;
    margin-bottom: 8px;
}

.search-header p {
    color: #64748b;
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-box input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
}

.search-box input:focus {
    outline: none;
    border-color: #2563eb;
}

.search-options {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: #64748b;
    font-size: 14px;
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-options select {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.results-header h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.results-header p {
    color: #64748b;
    font-size: 14px;
}

/* AI Controls */
.ai-controls {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 24px;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ai-header h3 {
    font-size: 16px;
}

.summary-lang-select {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.ai-hint {
    margin-top: 12px;
    color: #64748b;
    font-size: 13px;
}

/* AI Summary Box */
.ai-summary-box {
    background: #f8fafc;
    border: 1px solid #2563eb;
    border-radius: 6px;
    margin-bottom: 24px;
}

.summary-header {
    background: #1e293b;
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-header .btn-icon-only {
    color: white;
}

.summary-content {
    padding: 24px;
    line-height: 1.7;
    font-size: 14px;
}

.summary-content h1, .summary-content h2, .summary-content h3 {
    margin: 20px 0 10px;
}

.summary-content p {
    margin-bottom: 12px;
}

.summary-content ul, .summary-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 18px;
    transition: all 0.2s;
}

.article-card:hover {
    border-color: #94a3b8;
}

.article-card.excluded {
    opacity: 0.5;
    background: #fef2f2;
    border-color: #fca5a5;
}

.article-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.article-header .article-number {
    background: #e2e8f0;
    color: #475569;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-exclude {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-exclude:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-exclude.excluded {
    background: #dcfce7;
    border-color: #86efac;
    color: #16a34a;
}

.article-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.article-title a {
    color: #1e293b;
    text-decoration: none;
}

.article-title a:hover {
    color: #2563eb;
}

.exclude-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.exclude-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.exclude-btn.excluded {
    background: #dcfce7;
    border-color: #86efac;
    color: #16a34a;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
}

.article-meta a {
    color: #2563eb;
    text-decoration: none;
}

.article-abstract {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-abstract.expanded {
    -webkit-line-clamp: unset;
}

.expand-btn {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    padding: 0;
}

/* Save Controls */
.save-controls {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.save-controls input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 600px;
}

.modal-header {
    background: #1e293b;
    color: white;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-content form {
    padding: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
}

.modal-footer {
    text-align: center;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    font-size: 14px;
}

.modal-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.modal-note {
    padding: 14px 24px;
    background: #f0f9ff;
    color: #0369a1;
    font-size: 13px;
    text-align: center;
}

/* Disclaimer */
.disclaimer-content {
    padding: 24px;
}

.disclaimer-content h3 {
    font-size: 16px;
    margin: 20px 0 10px;
    color: #1e293b;
}

.disclaimer-content h3:first-child {
    margin-top: 0;
}

.disclaimer-content p {
    color: #475569;
    line-height: 1.7;
    font-size: 14px;
    margin-bottom: 12px;
}

.warning-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 16px;
    margin: 20px 0;
}

.warning-box p {
    color: #92400e;
    font-weight: 500;
    margin: 0;
}

.disclaimer-actions {
    margin-top: 24px;
    text-align: center;
}

/* Pending Content */
.pending-content {
    padding: 40px 24px;
    text-align: center;
}

.pending-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.pending-content p {
    color: #475569;
    line-height: 1.7;
    margin-bottom: 12px;
}

/* Settings */
.settings-section {
    padding: 24px;
}

.settings-section h3 {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.settings-note {
    margin: 12px 0 20px;
    font-size: 13px;
    color: #64748b;
}

/* Admin Styles */
.admin-login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 24px;
}

.admin-login-box {
    background: white;
    border-radius: 8px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.admin-login-box h2 {
    text-align: center;
    margin-bottom: 24px;
}

.admin-header {
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.admin-header p {
    color: #64748b;
}

.admin-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-card h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

/* Toggle Switch */
.settings-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-label span {
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2563eb;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.setting-description {
    font-size: 13px;
    color: #64748b;
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.admin-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.admin-tab:hover {
    color: #2563eb;
}

.admin-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.badge {
    background: #dc2626;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
}

.admin-table tr:hover {
    background: #f8fafc;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-approved {
    background: #dcfce7;
    color: #166534;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-unverified {
    background: #fee2e2;
    color: #991b1b;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 20px 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
}

.footer-disclaimer {
    font-size: 12px;
    line-height: 1.6;
}

.footer-disclaimer a {
    color: #60a5fa;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: white;
    padding: 14px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    font-size: 14px;
}

.toast.success {
    background: #16a34a;
}

.toast.error {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero {
        padding: 50px 24px;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-options {
        flex-direction: column;
        gap: 12px;
    }
    
    .ai-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .save-controls {
        flex-direction: column;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
}
