/* ========================================================================
   REPORTS VIEW - REDESIGNED UI
   Matching charts-view design approach with frosted glass effects
   ======================================================================== */

/* CSS Variables - Matching design system */
:root {
	--reports-blue-600: #4285F4;
	--reports-blue-700: #1a73e8;
	--reports-gray-50: #f8fafc;
	--reports-gray-100: #f1f5f9;
	--reports-gray-200: #e2e8f0;
	--reports-gray-300: #cbd5e1;
	--reports-gray-500: #64748b;
	--reports-gray-600: #475569;
	--reports-gray-700: #334155;
	--reports-header-height: 48px;
	--reports-footer-height: 32px;
}

/* Main container with gradient background - fixed to viewport */
.reports-container {
	display: flex;
	flex-direction: column;
	height: calc(100vh - var(--reports-header-height) - var(--reports-footer-height));
	max-height: calc(100vh - var(--reports-header-height) - var(--reports-footer-height));
	padding: 20px 24px;
	background: linear-gradient(180deg, var(--reports-gray-100) 0%, #e8ecf3 100%);
	overflow: hidden;
}

/* Prevent body scroll when on reports page */
body:has(.reports-container) {
	overflow: hidden;
}

/* Frosted glass card effect */
.reports-card {
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border: 1px solid rgba(226, 232, 240, 0.8);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* Page Header - Frosted Glass Card */
.reports-header {
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	padding: 16px;
	margin-bottom: 20px;
	border-radius: 12px;
	border: 1px solid rgba(226, 232, 240, 0.8);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	display: flex;
	align-items: center;
	gap: 15px;
	flex-shrink: 0;
	animation: reportsSlideUp 0.4s ease forwards;
}

.reports-header h2 {
	margin: 0;
	font-size: 20px;
	color: var(--reports-gray-700);
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 12px;
}

.reports-header h2 i {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--reports-blue-600) 0%, var(--reports-blue-700) 100%);
	border-radius: 8px;
	color: white;
	font-size: 18px;
}

.reports-header p {
	margin: 0;
	color: var(--reports-gray-500);
	font-size: 14px;
}

/* Main Content Layout */
.reports-main-content {
	display: grid;
	grid-template-columns: 320px 1fr;
	gap: 20px;
	flex: 1;
	overflow: hidden;
	min-height: 0;
	animation: reportsSlideUp 0.5s ease forwards;
	animation-delay: 0.1s;
	opacity: 0;
}

/* Report Selector Sidebar - Frosted Glass */
.report-selector {
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	border: 1px solid rgba(226, 232, 240, 0.8);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
}

.report-selector-header {
	background: linear-gradient(135deg, var(--reports-gray-600) 0%, var(--reports-gray-700) 100%);
	padding: 16px 20px;
	color: white;
	font-size: 1.1em;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 10px;
	height: 60px;
	flex-shrink: 0;
}

.report-selector-header i {
	color: #fbbf24;
}

.report-selector-content {
	flex: 1;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.report-selector-section {
	display: flex;
	flex-direction: column;
	border-bottom: 1px solid var(--reports-gray-200);
	flex-shrink: 0;
}

.report-selector-section:last-child {
	border-bottom: none;
}

.report-selector-section.section-customization {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.report-selector-title {
	padding: 14px 20px;
	background: rgba(248, 250, 252, 0.8);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: all 0.2s ease;
	font-weight: 600;
	color: var(--reports-gray-600);
	font-size: 0.95em;
}

.report-selector-title:hover {
	background: rgba(226, 232, 240, 0.9);
}

.report-selector-title span i {
	color: var(--reports-blue-600);
	margin-right: 8px;
}

.report-selector-title .fa-chevron-right {
	transition: transform 0.3s ease;
	color: var(--reports-gray-500);
}

.report-selector-title.active .fa-chevron-right {
	transform: rotate(90deg);
}

/* Report Type Options */
.report-type-options {
	display: none;
	background: white;
}

.report-type-options.active {
	display: block;
}

.report-type-option {
	padding: 10px 28px;
	cursor: pointer;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
	color: var(--reports-gray-600);
	display: flex;
	align-items: center;
	gap: 10px;
	position: relative;
	font-size: 0.9em;
}

.report-type-option:hover {
	background: rgba(66, 133, 244, 0.05);
	border-left-color: var(--reports-blue-600);
	padding-left: 35px;
}

.report-type-option input[type="radio"] {
	cursor: pointer;
	margin: 0;
	accent-color: var(--reports-blue-600);
}

.report-type-option label {
	margin: 0;
	cursor: pointer;
	flex: 1;
	line-height: 1.3;
}

.report-type-option input[type="radio"]:checked + label {
	font-weight: 600;
	color: var(--reports-blue-600);
}

.report-type-option.selected {
	background: linear-gradient(90deg, rgba(66, 133, 244, 0.15) 0%, rgba(66, 133, 244, 0.05) 100%);
	border-left-color: var(--reports-blue-600);
	color: var(--reports-blue-600);
	font-weight: 600;
}

/* Section Customization */
.section-customization {
	border-top: 1px solid var(--reports-gray-200);
}

.section-options {
	display: none;
	background: white;
	flex: 1;
	overflow-y: auto;
	min-height: 0;
}

.section-options.active {
	display: block;
}

/* Custom scrollbar for section options */
.section-options::-webkit-scrollbar {
	width: 4px;
}

.section-options::-webkit-scrollbar-track {
	background: transparent;
}

.section-options::-webkit-scrollbar-thumb {
	background: var(--reports-gray-300);
	border-radius: 2px;
}

.section-option {
	padding: 10px 28px;
	cursor: pointer;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
	color: var(--reports-gray-600);
	display: flex;
	align-items: center;
	gap: 8px;
	position: relative;
	font-size: 0.9em;
}

.section-option:hover {
	background: rgba(66, 133, 244, 0.05);
	border-left-color: var(--reports-blue-600);
	padding-left: 35px;
}

.section-option input[type="checkbox"] {
	cursor: pointer;
	margin: 0;
	accent-color: var(--reports-blue-600);
}

.section-option label {
	cursor: pointer;
	margin: 0;
	flex: 1;
	line-height: 1.3;
}

.section-controls {
	display: flex;
	gap: 10px;
	padding: 14px 20px;
	background: rgba(248, 250, 252, 0.8);
	border-top: 1px solid var(--reports-gray-200);
	flex-shrink: 0;
}

.section-controls button {
	flex: 1;
	padding: 8px 16px;
	font-size: 0.9em;
	border: 1px solid var(--reports-gray-300);
	background: white;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-weight: 600;
	color: var(--reports-gray-600);
}

.section-controls button:hover {
	background: var(--reports-gray-100);
	border-color: var(--reports-blue-600);
	color: var(--reports-blue-600);
	transform: translateY(-1px);
}

/* Report Display Area - Frosted Glass */
.report-display {
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
	border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Report Toolbar - Brand Blue Gradient */
.report-toolbar {
	background: linear-gradient(135deg, var(--reports-blue-600) 0%, var(--reports-blue-700) 100%);
	padding: 16px 20px;
	color: white;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	height: 60px;
	flex-shrink: 0;
}

.report-toolbar-info {
	flex: 1;
	font-size: 1.1em;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 10px;
}

.report-toolbar-info i {
	color: #fbbf24;
}

.report-toolbar-buttons {
	display: flex;
	gap: 8px;
}

.report-toolbar button {
	background: rgba(255, 255, 255, 0.2);
	color: white;
	border: none;
	padding: 6px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	min-width: 32px;
	min-height: 32px;
}

.report-toolbar button:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Out-of-Date Warning Banner */
.report-out-of-date-warning {
	background: linear-gradient(135deg, #fff3cd 0%, #ffe9a0 100%);
	border-left: 4px solid #f59e0b;
	padding: 16px 20px;
	display: flex;
	align-items: flex-start;
	gap: 15px;
	flex-shrink: 0;
}

.report-out-of-date-content {
	display: flex;
	align-items: flex-start;
	gap: 15px;
	width: 100%;
}

.report-out-of-date-content i {
	color: #f59e0b;
	font-size: 20px;
	margin-top: 2px;
	flex-shrink: 0;
}

.report-out-of-date-text {
	flex: 1;
}

.report-out-of-date-text strong {
	color: #b45309;
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
}

.report-out-of-date-text p {
	margin: 0;
	color: var(--reports-gray-700);
	font-size: 13px;
	line-height: 1.5;
}

/* Report Content Area */
.report-content {
	flex: 1;
	overflow-y: auto;
	padding: 24px 30px;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	line-height: 1.6;
	color: var(--reports-gray-700);
	scroll-behavior: smooth;
	background: var(--reports-gray-50);
}

/* Custom scrollbar for report content */
.report-content::-webkit-scrollbar {
	width: 8px;
}

.report-content::-webkit-scrollbar-track {
	background: var(--reports-gray-100);
}

.report-content::-webkit-scrollbar-thumb {
	background: var(--reports-gray-300);
	border-radius: 4px;
}

.report-content::-webkit-scrollbar-thumb:hover {
	background: var(--reports-gray-500);
}

.report-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	flex-direction: column;
	gap: 15px;
	color: var(--reports-gray-500);
}

.report-loading-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--reports-gray-200);
	border-top: 4px solid var(--reports-blue-600);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Animations */
@keyframes reportsSlideUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Report Content Styling */
.report-cover-page {
	page-break-after: always;
	padding: 40px 0;
	text-align: center;
	border-bottom: 3px solid var(--reports-blue-600);
	margin-bottom: 40px;
}

.report-cover-title {
	font-size: 36px;
	font-weight: 700;
	color: var(--reports-gray-700);
	margin-bottom: 20px;
}

.report-cover-subtitle {
	font-size: 20px;
	color: var(--reports-gray-500);
	margin-bottom: 40px;
}

.report-cover-meta {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	max-width: 900px;
	margin: 0 auto;
	font-size: 14px;
	text-align: left;
}

.report-cover-meta div {
	padding: 10px 0;
	border-bottom: 1px solid var(--reports-gray-200);
}

.report-cover-image {
	margin: 30px auto;
	max-width: 900px;
	border: 2px solid var(--reports-gray-300);
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.report-cover-image img {
	width: 100%;
	height: auto;
	display: block;
}

.report-cover-meta strong {
	display: block;
	color: var(--reports-gray-500);
	font-size: 12px;
}

/* Table of Contents */
.report-toc {
	page-break-after: always;
	margin-bottom: 40px;
}

.report-toc h2 {
	font-size: 24px;
	font-weight: 700;
	color: var(--reports-gray-700);
	margin-bottom: 20px;
}

.report-toc-entry {
	display: flex;
	padding: 8px 0;
	font-size: 14px;
	border-bottom: 1px dotted var(--reports-gray-300);
}

.report-toc-link {
	display: flex;
	width: 100%;
	text-decoration: none;
	color: inherit;
	transition: all 0.3s ease;
	padding: 4px 8px;
	margin: -4px -8px;
	border-radius: 4px;
}

.report-toc-link:hover {
	background: rgba(66, 133, 244, 0.1);
	color: var(--reports-blue-600);
}

.report-toc-link:hover .report-toc-title {
	color: var(--reports-blue-600);
}

.report-toc-title {
	flex: 1;
}

.report-toc-page {
	color: var(--reports-gray-500);
}

/* Report Sections */
.report-section {
	page-break-after: auto;
	margin-bottom: 40px;
	scroll-margin-top: 20px;
}

.report-section p {
	margin: 12px 0;
	text-align: justify;
}

.report-section h1 {
	font-size: 28px;
	font-weight: 700;
	color: var(--reports-gray-700);
	margin: 40px 0 20px 0;
	padding-bottom: 12px;
	border-bottom: 4px solid var(--reports-blue-600);
	page-break-after: avoid;
}

.report-section h2 {
	font-size: 20px;
	font-weight: 600;
	color: var(--reports-gray-700);
	margin: 30px 0 15px 0;
	page-break-after: avoid;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--reports-gray-200);
}

.report-section h3 {
	font-size: 16px;
	font-weight: 600;
	color: var(--reports-gray-600);
	margin: 15px 0 10px 0;
	page-break-after: avoid;
}

/* Tables */
.report-section table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
	page-break-inside: avoid;
	font-size: 13px;
}

.report-section table th {
	background: linear-gradient(135deg, var(--reports-blue-600) 0%, var(--reports-blue-700) 100%);
	color: white;
	padding: 14px 12px;
	text-align: left;
	font-weight: 600;
	border: 1px solid var(--reports-blue-700);
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.5px;
}

.report-section table td {
	padding: 10px 12px;
	border: 1px solid var(--reports-gray-200);
	text-align: left;
}

.report-section table td.numeric {
	text-align: right;
}

.report-section table tbody tr:nth-child(even) {
	background: var(--reports-gray-50);
}

.report-section table tbody tr:hover {
	background: rgba(66, 133, 244, 0.05);
}

/* Risk Summary Grid */
.report-risk-summary {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 15px;
	margin: 20px 0;
	page-break-inside: avoid;
}

/* Risk Levels */
.risk-high {
	color: #dc2626;
	font-weight: 600;
}

.risk-medium {
	color: #f59e0b;
	font-weight: 600;
}

.risk-low {
	color: #16a34a;
	font-weight: 600;
}

/* Consequence Levels */
.consequence-high {
	color: #dc2626;
	font-weight: 600;
}

.consequence-medium {
	color: #f59e0b;
	font-weight: 600;
}

.consequence-low {
	color: #16a34a;
	font-weight: 600;
}

.consequence-na {
	color: var(--reports-gray-500);
	font-weight: 600;
}

/* DNV Compliance Badge */
.dnv-compliance-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
	color: white;
	padding: 8px 16px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	margin: 20px 0;
	box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Enhanced Report Figure */
.report-figure {
	page-break-inside: avoid;
	margin: 30px 0;
	padding: 20px;
	background: var(--reports-gray-100);
	border: 1px solid var(--reports-gray-200);
	border-radius: 12px;
}

.report-figure img {
	max-width: 100%;
	height: auto;
	border: 1px solid var(--reports-gray-200);
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	background: white;
}

.report-figure-caption {
	font-size: 13px;
	color: var(--reports-gray-600);
	margin-top: 12px;
	font-weight: 500;
	text-align: center;
}

.report-figure-caption strong {
	color: var(--reports-gray-700);
}

/* Map Placeholder */
.report-map-placeholder {
	background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(66, 133, 244, 0.05) 100%);
	border: 2px dashed var(--reports-blue-600);
	border-radius: 12px;
	padding: 40px;
	text-align: center;
	margin: 20px 0;
	page-break-inside: avoid;
}

.report-map-placeholder i {
	font-size: 48px;
	color: var(--reports-blue-600);
	margin-bottom: 15px;
}

.report-map-placeholder p {
	color: var(--reports-gray-600);
	margin: 10px 0;
	font-size: 14px;
}

/* Enhanced Risk Metric Cards */
.risk-metric-card {
	background: white;
	border: 1px solid var(--reports-gray-200);
	border-radius: 12px;
	padding: 20px;
	text-align: center;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.risk-metric-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
	border-color: var(--reports-blue-600);
}

.risk-metric-label {
	font-size: 11px;
	color: var(--reports-gray-500);
	text-transform: uppercase;
	margin-bottom: 12px;
	font-weight: 700;
	letter-spacing: 0.5px;
}

.risk-metric-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--reports-gray-700);
	margin: 8px 0;
}

.risk-metric-unit {
	font-size: 11px;
	color: var(--reports-gray-500);
	margin-top: 8px;
	font-style: italic;
}

/* Key Findings Box */
.report-key-findings {
	background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
	border-left: 4px solid #f59e0b;
	padding: 20px;
	margin: 20px 0;
	border-radius: 0 8px 8px 0;
	page-break-inside: avoid;
}

.report-key-findings h3 {
	margin-top: 0;
	color: #b45309;
	font-weight: 700;
}

/* Study Metadata Box */
.report-study-meta {
	background: linear-gradient(135deg, rgba(66, 133, 244, 0.1) 0%, rgba(66, 133, 244, 0.05) 100%);
	border: 2px solid var(--reports-blue-600);
	border-radius: 12px;
	padding: 20px;
	margin: 20px 0;
	page-break-inside: avoid;
}

.report-study-meta h3 {
	color: var(--reports-blue-700);
	margin-top: 0;
}

/* Better List Styling */
.report-section ul {
	margin: 15px 0;
	padding-left: 25px;
	line-height: 1.8;
}

.report-section li {
	margin: 10px 0;
	page-break-inside: avoid;
}

.report-section li strong {
	color: var(--reports-gray-700);
}

/* Fullscreen mode styling */
.report-display:fullscreen {
	background: white;
	display: flex;
	flex-direction: column;
	padding: 0;
	border-radius: 0;
}

.report-display:fullscreen .report-content {
	flex: 1;
	background: white;
}

/* Print Styling */
@media print {
	.reports-header,
	.report-selector,
	.report-toolbar {
		display: none;
	}

	.reports-main-content {
		grid-template-columns: 1fr;
		gap: 0;
		padding: 0;
	}

	.report-display {
		box-shadow: none;
		border-radius: 0;
	}

	.report-content {
		padding: 20mm;
	}

	.report-section h1 {
		page-break-before: always;
	}

	.report-section table {
		page-break-inside: avoid;
	}

	.report-figure {
		page-break-inside: avoid;
	}
}

/* Responsive Design */
@media (max-width: 1400px) {
	.reports-main-content {
		grid-template-columns: 300px 1fr;
	}
}

@media (max-width: 1200px) {
	.reports-main-content {
		grid-template-columns: 280px 1fr;
		gap: 15px;
	}

	.reports-container {
		padding: 16px;
	}
}

@media (max-width: 900px) {
	.reports-main-content {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.report-selector {
		max-height: 300px;
	}

	.section-options {
		max-height: 150px;
	}

	.report-risk-summary {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.reports-container {
		padding: 12px;
	}

	.reports-header {
		padding: 12px;
		margin-bottom: 12px;
	}

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

	.reports-header h2 i {
		width: 32px;
		height: 32px;
		font-size: 14px;
	}

	.report-content {
		padding: 16px;
	}

	.report-risk-summary {
		grid-template-columns: 1fr;
	}

	.report-cover-meta {
		grid-template-columns: 1fr;
	}
}
