@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #10b981;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #f87171;
    --neutral-bg: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --glass: rgba(255, 255, 255, 0.7);
    --sidebar-bg: #0f172a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background-color: #f1f5f9;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 32px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    color: #60a5fa;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-links li a {
    color: #94a3b8;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-links li a:hover,
.nav-links li.active a {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-links li.active a {
    border-left: 4px solid #3b82f6;
}

.user-profile {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #ffffff;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.header-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Common Components */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: none;
    font-size: 14px;
}

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

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

.btn-secondary {
    background-color: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background-color: #fca5a5;
}

/* Dashboard Specific Grid */
.dashboard-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.card {
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    padding: 24px;
    margin-bottom: 24px;
}

/* Upload Area */
.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background-color: #f8fafc;
}

.upload-icon {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table th {
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

table tr:hover td {
    background-color: #f8fafc;
}

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

.status-completed {
    background-color: #d1fae5;
    color: #065f46;
}

.status-processing {
    background-color: #dbeafe;
    color: #1e40af;
    animation: pulse 2s infinite;
}

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

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

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: #ffffff;
    border-radius: 16px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
}

/* Dual Pane Review Page Layout */
.dual-pane-container {
    height: calc(100vh - 60px); /* Explicitly restrict container height to viewport minus header */
    display: flex;
    overflow: hidden;
}

/* Left Pane: original document content */
.left-pane {
    width: 50%;
    height: 100%;
    background-color: #ffffff;
    border-right: 1px solid var(--border);
    padding: 30px; /* Comfortable reading margins */
    overflow-y: auto;
}

.document-view {
    max-width: 650px;
    margin: 0 auto;
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    line-height: 1.6;
    color: #111827;
}

.doc-paragraph {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.doc-paragraph:hover {
    background-color: #f8fafc;
    border-left-color: #cbd5e1;
}

.doc-paragraph.active {
    background-color: #eff6ff;
    border-left-color: var(--primary);
}

/* Right Pane: AI findings cards */
.right-pane {
    width: 50%;
    height: 100%;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-tabs {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* Prevent tabs from shrinking */
}

.pane-tab {
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.pane-tab.active {
    background-color: var(--primary);
    color: #ffffff;
}

.findings-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Recommendation Card */
.finding-card {
    background-color: #ffffff;
    border-radius: 8px;
    border-left: 4px solid var(--border);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0; /* CRITICAL: Prevent cards from shrinking, forcing scrollbar on parent findings-list */
}

.finding-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.finding-card.active {
    border-color: var(--primary) !important;
    outline: 1px solid rgba(37, 99, 235, 0.2);
}

.finding-card.status-red {
    border-left-color: var(--danger);
}
.finding-card.status-red .card-header-status {
    background-color: #fee2e2;
    color: var(--danger);
}

.finding-card.status-green {
    border-left-color: var(--success);
}
.finding-card.status-green .card-header-status {
    background-color: #d1fae5;
    color: #065f46;
}

.card-header-top {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.card-index {
    font-weight: 600;
    font-size: 13px;
}

.card-header-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.card-body-content {
    padding: 16px;
}

.card-sec-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.card-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.card-references {
    background-color: var(--neutral-bg);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--border);
}

.ref-item {
    font-size: 13px;
    margin-bottom: 8px;
}

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

.ref-title {
    font-weight: 600;
    color: var(--primary);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}
