:root {
	--wine-dark: #6D214F;
	--wine-light: #833471;
	--silver-light: #f0f2f5;
	--silver-dark: #bdc3c7;
	--text-dark: #333;
	--text-light: #fff;
	--border-color: #dfe4ea;
	--shadow-color: rgba(0, 0, 0, 0.1);
}

* {
	box-sizing: border-box;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
	background-color: var(--silver-light);
	color: var(--text-dark);
	margin: 0;
	padding: 0;
}

.hidden {
	display: none !important;
}

/* --- Login Page --- */
#login-page {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	background-color: var(--wine-dark);
}

.login-container {
	background-color: var(--text-light);
	padding: 40px;
	border-radius: 8px;
	box-shadow: 0 4px 15px var(--shadow-color);
	text-align: center;
	width: 100%;
	max-width: 400px;
}

	.login-container h1 {
		color: var(--wine-dark);
		font-size: 3rem;
		margin-bottom: 10px;
	}

	.login-container p {
		color: var(--wine-light);
		margin-bottom: 30px;
	}

	.login-container .input-group {
		margin-bottom: 20px;
		text-align: left;
	}

	.login-container label {
		display: block;
		margin-bottom: 5px;
		font-weight: bold;
		color: #555;
	}

	.login-input {
		width: 100%;
		padding: 12px 14px;
		border: 1.5px solid var(--silver-dark);
		border-radius: 6px;
		font-size: 1rem;
		font-family: inherit;
		color: var(--text-dark);
		background: #fff;
		box-sizing: border-box;
		transition: border-color 0.2s, box-shadow 0.2s;
	}

	.login-input:focus {
		border-color: var(--wine-light);
		box-shadow: 0 0 0 3px rgba(109, 33, 79, 0.12);
		outline: none;
	}

	.login-button {
		width: 100%;
		padding: 12px;
		background-color: var(--wine-light);
		color: var(--text-light);
		border: none;
		border-radius: 6px;
		font-size: 1.1rem;
		font-weight: 600;
		font-family: inherit;
		cursor: pointer;
		transition: background-color 0.3s, box-shadow 0.3s;
		margin-top: 8px;
	}

	.login-button:hover {
		background-color: var(--wine-dark);
		box-shadow: 0 2px 8px rgba(109, 33, 79, 0.3);
	}


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

header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 2rem;
	background-color: var(--text-light);
	border-bottom: 1px solid var(--border-color);
	height: 60px;
	flex-shrink: 0;
}

.logo {
	font-size: 1.8rem;
	font-weight: bold;
	color: var(--wine-dark);
}

nav {
	display: flex;
	gap: 1.5rem;
}

.nav-link {
	color: #555;
	text-decoration: none;
	padding: 20px 0;
	border-bottom: 3px solid transparent;
	transition: all 0.3s;
}

	.nav-link i {
		margin-right: 8px;
	}

	.nav-link:hover {
		color: var(--wine-dark);
	}

	.nav-link.active {
		color: var(--wine-dark);
		border-bottom-color: var(--wine-dark);
	}


.header-right {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

	.header-right .nav-link {
		font-size: 1.2rem;
		padding: 10px;
	}

.user-info {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-size: 0.9rem;
}

.user-name {
	font-weight: bold;
}

.user-role {
	color: #777;
	font-size: 0.8rem;
}

.user-ua {
	background-color: var(--wine-dark);
	color: #fff;
	padding: 1px 7px;
	border-radius: 3px;
	font-size: 0.7rem;
	font-weight: 600;
	margin-left: 4px;
}

#logout-link {
	color: var(--wine-light);
	text-decoration: none;
	font-size: 0.8rem;
}

	#logout-link:hover {
		text-decoration: underline;
	}

main {
	flex-grow: 1;
	overflow-y: auto;
	padding: 0 2rem;
}

.page {
	animation: fadeIn 0.5s ease-in-out;
}

	.page.hidden {
		display: none !important;
	}

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

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

h2 {
	font-size: 1.8rem;
	color: var(--wine-dark);
	margin-bottom: 1.5rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--border-color);
}

/* Dashboard */
.dashboard-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 1.5rem;
}

.dashboard-card {
	background-color: #fff;
	padding: 1.5rem;
	border-radius: 8px;
	box-shadow: 0 2px 5px var(--shadow-color);
	text-align: center;
}

.card-icon {
	font-size: 3rem;
	color: var(--wine-light);
	margin-bottom: 1rem;
}

.dashboard-card h3 {
	margin-bottom: 0.5rem;
	color: #555;
}

.card-value {
	font-size: 2.5rem;
	font-weight: bold;
	color: var(--wine-dark);
}


/* Documents Page */
.documents-container {
	display: flex;
	gap: 1.5rem;
	height: calc(100vh - 60px - 4rem - 54px); /* header - padding - h2 */
}

.documents-sidebar {
	width: 300px;
	flex-shrink: 0;
	background-color: #fff;
	border-radius: 8px;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 5px var(--shadow-color);
	overflow: hidden;
}

#document-tree {
	flex: 1;
	overflow: auto;
	min-height: 0;
}

.main-content-area {
    flex-grow: 1;
    display: flex;
    gap: 1.5rem;
}

.document-content-viewer {
    flex-grow: 1;
    min-width: 400px; /* Minimum width for the list */
}

.document-preview-pane {
    flex-grow: 2; /* Takes up more space when visible */
    display: flex;
    flex-direction: column;
}

/* New styles for Document Content Viewer */
.document-content-viewer.card,
.document-preview-pane.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-color);
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--wine-dark);
    display: flex;
    align-items: center;
}

.header-tags {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.add-file-button {
    margin-left: auto;
    font-size: 0.9rem;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--wine-dark);
    background-color: white;
    transition: all 0.2s;
}
.add-file-button:hover {
    background-color: var(--silver-light);
    border-color: #aaa;
}

.card-body {
    padding: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}

.item-list {
    list-style: none;
}

.item-row {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.item-row:hover {
    background-color: var(--silver-light);
}

.item-row i {
    width: 30px;
    text-align: center;
    margin-right: 1rem;
    color: var(--wine-light);
    font-size: 1.2rem;
}

.item-name {
    font-size: 1rem;
    color: var(--text-dark);
}

.empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.empty-message i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.item-row-grid {
    display: grid;
    grid-template-columns: 3fr 2fr 2fr 2fr 2fr; /* Name, Path, Tags, Created, Actions */
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.item-row-grid:hover {
    background-color: var(--silver-light);
}
.item-name-cell {
    display: flex;
    align-items: center;
}
.item-name-cell i {
    width: 30px;
    text-align: center;
    margin-right: 1rem;
    color: var(--wine-light);
    font-size: 1.2rem;
}
.item-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tag {
    background-color: var(--silver-light);
    color: #555;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}
.item-meta {
    font-size: 0.9rem;
    color: #777;
}
.item-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}
.item-actions a {
    margin-left: 0;
    text-decoration: none;
    color: var(--wine-light);
    font-size: 0.95rem;
    position: relative;
}
.item-actions a:hover {
    color: var(--wine-dark);
}

/* ── Fast CSS Tooltips ── */
[data-tip] {
    position: relative;
}
[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #333;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    margin-bottom: 4px;
}
[data-tip]:hover::after {
    opacity: 1;
}

.ocr-snippet {
    background-color: #f8f9fa;
    border-left: 3px solid var(--wine-light);
    padding: 0.75rem;
    margin: 0 0.75rem 0.75rem 0.75rem;
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
}

.highlight {
    background-color: #fff3cd; /* A light yellow */
    font-weight: bold;
    color: #664d03;
}

.search-results-container {
	flex-grow: 1;
	min-width: 400px; /* Minimum width for the list */
}

.search-preview-pane {
    flex-grow: 2; /* Takes up more space when visible */
    display: flex;
    flex-direction: column;
}

/* New styles for Document Content Viewer */
.search-results-container.card,
.search-preview-pane.card {
	background-color: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 5px var(--shadow-color);
	display: flex;
	flex-direction: column;
}

/* Reports & Settings */
.report-filters, .settings-container {
	background-color: #fff;
	padding: 1.5rem;
	border-radius: 8px;
	box-shadow: 0 2px 5px var(--shadow-color);
}

.report-filters {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	margin-bottom: 1.5rem;
}

	.report-filters .input-group {
		display: flex;
		flex-direction: column;
	}

	.report-filters label {
		font-size: 0.9rem;
		margin-bottom: 5px;
	}

	.report-filters input[type="date"], .report-filters button {
		padding: 8px;
		border-radius: 4px;
		border: 1px solid var(--border-color);
	}

	.report-filters button {
		background-color: var(--wine-light);
		color: var(--text-light);
		border: none;
		cursor: pointer;
		transition: background-color 0.3s;
		align-self: flex-end;
	}

		.report-filters button:hover {
			background-color: var(--wine-dark);
		}

.report-results {
	background-color: #fff;
	padding: 1.5rem;
	border-radius: 8px;
	box-shadow: 0 2px 5px var(--shadow-color);
	min-height: 200px;
}

.settings-container {
	display: flex;
	gap: 1.5rem;
}

.settings-menu {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	width: 250px;
	flex-shrink: 0;
}

.settings-menu-item {
	padding: 10px 15px;
	text-decoration: none;
	color: #333;
	border-radius: 5px;
	transition: all 0.3s;
	border-left: 4px solid transparent;
}

	.settings-menu-item i {
		margin-right: 10px;
	}

	.settings-menu-item:hover {
		background-color: var(--silver-light);
		color: var(--wine-dark);
	}

	.settings-menu-item.active {
		background-color: var(--silver-light);
		color: var(--wine-dark);
		font-weight: bold;
		border-left-color: var(--wine-dark);
	}

.settings-content {
	flex-grow: 1;
}

.settings-content-pane h3 {
	color: var(--wine-dark);
	margin-bottom: 1rem;
}

.settings-content-pane.active {
	animation: fadeIn 0.5s ease-in-out;
}
