/* Dark Mode CSS Variables */

/* Theme variables */
:root {
	/* Base surfaces */
	--bg-primary: #ffffff;
	--bg-secondary: #f5f5f5;
	--bg-tertiary: #e0e0e0;

	/* Text */
	--text-primary: #000000;
	--text-secondary: #333333;
	--muted-text: #666666;

	/* Greys (light theme) */
	--gray-50: #fafafa;
	--gray-100: #f5f5f5;
	--gray-200: #eeeeee;
	--gray-300: #e0e0e0;
	--gray-800: #333333;

	/* Components */
	--panel-bg: #ffffff;
	--card-bg: #f9f9f9;
	--table-row-alt-bg: #f9f9f9;
	--chip-bg: var(--gray-100);
	--border-radius: 6px;

	/* Borders & shadows */
	--border-color: #dddddd;
	--input-bg: #ffffff;
	--input-border: #cccccc;
	--shadow: rgba(0, 0, 0, 0.1);

	/* Accent & brand */
	--accent-color: #e53935;
	--app-bg-full: #667eea;
}

body.dark-mode {
	/* Base surfaces */
	--bg-primary: #121212;
	--bg-secondary: #1e1e1e;
	--bg-tertiary: #2a2a2a;

	/* Text */
	--text-primary: #e0e0e0;
	--text-secondary: #b0b0b0;
	--muted-text: #9aa0a6;

	/* Greys (dark theme) */
	--gray-50: #1a1a1a;
	--gray-100: #222222;
	--gray-200: #2a2a2a;
	--gray-300: #333333;
	--gray-400: #777777;
	--gray-500: #9aa0a6;
	--gray-600: #b0b7bd;
	--gray-700: #c9cfd4;
	--gray-800: #e0e0e0;
	--gray-900: #f5f5f5;

	/* Components */
	--panel-bg: #191919;
	--card-bg: #1f1f1f;
	--table-row-alt-bg: #1c1c1c;
	--chip-bg: #2c2c2c;

	/* Borders & shadows */
	--border-color: #444444;
	--input-bg: #232323;
	--input-border: #555555;
	--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.35);

	/* Accent & brand */
	--accent-color: #ff6b6b;
	
	/* Profile.php specific overrides for dark mode */
	--primary-color: #8ab4f8;
	--primary-hover: #6ea6ff;
	--success-color: #34d399;
	--success-hover: #10b981;
	--danger-color: #f87171;
	--danger-hover: #ef4444;
	--warning-color: #f59e0b;
	--warning-hover: #d97706;
}

body {
	background-color: var(--bg-primary);
	color: var(--text-primary);
	transition: background-color 0.3s ease, color 0.3s ease;
}

/* Headings follow theme */
h1, h2, h3, h4, h5, h6 {
	color: var(--text-primary);
}

/* Dark mode menu item styling */
.dark-mode-toggle-menu {
	display: flex;
	align-items: center;
	gap: 8px;
}

.dark-mode-toggle-menu .dark-mode-icon {
	font-size: 1.2em;
}

body.dark-mode .off-canvas-list {
	background-color: var(--bg-secondary);
}

body.dark-mode .off-canvas-list li a {
	color: var(--text-primary);
}

body.dark-mode .off-canvas-list li label {
	color: var(--text-secondary);
}

body.dark-mode .tab-bar {
	background-color: var(--bg-secondary);
	border-bottom: 1px solid var(--border-color);
}

body.dark-mode .tab-bar .title {
	color: var(--text-primary);
}

#sommerhusForm,
#bfeEkstra {
	overflow: auto;
	z-index: 100;
	position:fixed;
	padding:20px;
	background-color: var(--bg-primary);
	border-color: var(--accent-color);
}

#sommerhusForm form {
	padding-bottom:80px;
	overflow:hidden;
}

#sommerhusForm {
	width: 40%;
	right: -40%;
	border-left:3px solid var(--accent-color);
	top:0;
	height:100vh;
}

#bfeEkstra {
	height:30vh;
	bottom:-30vh;
	border-top:3px solid var(--accent-color);
	left:0;
	width:100%;
}

@media screen and (max-width: 800px) {
	#sommerhusForm {
		width:calc(100vw - 30px);
		right:calc(30px - 100vw);
	}
	#bfeEkstra {
		height:50vh;
		bottom:-50vh;
	}
}

#toggle-sommerhus,
#toggle-bfeekstra {
	margin:0;
	position:fixed;
	color: var(--accent-color);
	border:3px solid var(--accent-color);
	background-color: var(--bg-primary);
}

#toggle-sommerhus {
	top:40%;
	right:0;
	padding:20px 10px;
	border-right:none;
	border-radius:15px 0px 0px 15px;
}
#toggle-sommerhus span:after {
	content:"filter_alt";
}
#toggle-sommerhus.active span:after {
	content:"filter_alt_off";
}


#toggle-bfeekstra {
	left:20%;
	bottom:0;
	padding:10px 20px;
	border-bottom:none;
	border-radius:15px 15px 0px 0px;
}
#toggle-bfeekstra span:after {
	content:"";
	background-image:url(loading.gif);
	width:20px;
	height:20px;
	background-size:contain;
	display:inline-block;
}
#toggle-bfeekstra.ready span:after {
	content:"real_estate_agent";
	background:none;
}
#toggle-bfeekstra.active span:after {
	content:"expand_more";
	background:none;
}

body.full-frame {
	overflow:hidden;
}

/* Remove blue background - use standard background like other pages */
body.full-frame {
	background: var(--bg-primary);
	min-height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Filter form themed card */
.filter-form {
	background-color: var(--card-bg);
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 25px;
	box-shadow: 0 2px 5px var(--shadow);
	max-width: 800px;
	margin-left: auto;
	margin-right: auto;
}

#oisFrame {
	width:calc(100% + 10px);
	height:calc(100vh - 45px);
}

.dark-mode #oisFrame {
	filter: invert(1) hue-rotate(180deg);
}

ul.building-list li {
	font-size:12px;
}

.disclaimer-result {
	position:absolute;
	top:0;
	right:0;
	font-size:10px;
	margin:5px;
}

/* Dark mode styling for common elements */
body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="tel"],
body.dark-mode input[type="date"],
body.dark-mode select,
body.dark-mode textarea {
	background-color: var(--input-bg);
	color: var(--text-primary);
	border-color: var(--input-border);
}

body.dark-mode table {
	background-color: var(--bg-secondary);
	color: var(--text-primary);
}

body.dark-mode table th,
body.dark-mode table td {
	border-color: var(--border-color);
	color: var(--text-primary) !important;
}

body.dark-mode table thead tr th,
body.dark-mode table thead tr td {
	color: var(--text-primary) !important;
	background-color: var(--bg-tertiary);
}

body.dark-mode .button,
body.dark-mode button {
	background-color: var(--bg-tertiary);
	color: var(--text-primary);
	border-color: var(--border-color);
}

body.dark-mode .button:hover,
body.dark-mode button:hover {
	background-color: var(--bg-secondary);
}

body.dark-mode a {
	color: #6ba3ff;
}

body.dark-mode .card,
body.dark-mode .panel {
	background-color: var(--panel-bg) !important;
	border-color: var(--border-color) !important;
	color: var(--text-primary) !important;
}

body.dark-mode hr {
	border-color: var(--border-color);
}

/* ============================== */
/* Explicit overrides for dark mode*/
/* ============================== */

/* Table zebra striping */
table tr.even,
table tr.alt,
table tr:nth-of-type(even),
tr:nth-child(even) {
	background: var(--table-row-alt-bg);
}

/* Table cell text color */
table tr th,
table tr td {
	color: var(--text-primary);
}

/* Labels */
label {
	color: var(--text-secondary);
}

/* Restriction chip */
.restriction-item {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--chip-bg);
	padding: 0.25rem 0.5rem;
	border-radius: var(--border-radius);
	margin: 0.125rem;
	font-size: 0.75rem;
}

/* Saved queries */
.saved-query-item {
	background: var(--panel-bg);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	padding: 10px;
	margin-bottom: 8px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

body.dark-mode .saved-query-item {
	background: var(--panel-bg) !important;
	border-color: var(--border-color) !important;
}

.saved-query-item .query-date {
	font-size: 0.85em;
	color: var(--muted-text);
}
.saved-query-item .query-name {
	font-weight: bold;
	margin-bottom: 3px;
}
.saved-queries-box {
	background: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	padding: 15px;
	margin-bottom: 20px;
	clear: both;
}

/* OR criteria container */
.or-criteria-parent {
	border-left: 5px solid var(--border-color);
	border-bottom: 5px solid var(--border-color);
	background-color: var(--bg-secondary);
	border-radius: 6px;
	margin-bottom: 15px;
	clear: both;
}

/* Panels and headings */
.panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6, .panel p, .panel li, .panel dl {
	color: var(--text-primary);
}

/* Stat cards */
.stat-card {
	background-color: var(--card-bg);
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 2px 5px var(--shadow);
	border-left: 4px solid #1779ba;
}
.stat-card.info { border-left-color: #2196F3; }
.stat-card.warning { border-left-color: #ffae00; }
.stat-card.success { border-left-color: #4CAF50; }

/* Certificate test boxes */
.certificate-tests details {
	border: 1px solid var(--border-color);
	border-radius: 6px;
	background: var(--panel-bg);
	margin-bottom: 12px;
	overflow: hidden;
}
.certificate-tests .cert-body {
	padding: 0 16px 16px;
	border-top: 1px solid var(--border-color);
	background: var(--bg-secondary);
}
.section-title {
	text-align: center;
	margin: 30px 0 20px;
	font-size: 1.5em;
	color: var(--text-primary);
}

/* ============================== */
/* SommerhusForm Styles (extracted from bbr_form.php) */
/* ============================== */

.or-criteria-container {
	padding: 15px;
	position: relative;
	overflow: hidden;
}
.or-criteria-container:not(:first-child) {
	padding-top: 0;
}
.or-criteria-parent.has-values {
	border-color: #4CAF50;
	background-color: #f3fff6;
}
body.dark-mode .or-criteria-parent.has-values {
	border-color: #4CAF50;
	background-color: #1a3d20;
}
.or-remove-btn {
	position: absolute;
	top: 0px;
	right: 5px;
	background: #d32f2f;
	color: white;
	border: none;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 0;
}
.or-remove-btn:hover {
	background: #b71c1c;
}
.saved-queries-box h4 {
	margin-top: 0;
	margin-bottom: 10px;
}
.save-query-controls {
	display: flex;
	gap: 10px;
	margin-bottom: 15px;
}
.save-query-controls input {
	flex: 1;
	margin: 0;
}
.saved-query-list {
	max-height: 200px;
	overflow-y: auto;
}
.saved-query-item .query-info {
	flex: 1;
}
.btn-load {
	background: #2196F3;
	color: white;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85em;
}
.btn-rename {
	background: #FF9800;
	color: white;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85em;
}
.btn-delete {
	background: #d32f2f;
	color: white;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85em;
}
.btn-save, .btn-clear {
	padding: 8px 16px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9em;
}
.btn-save {
	background: #4CAF50;
	color: white;
}
.btn-clear {
	background: #757575;
	color: white;
}
.postnr-bulk-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}
.postnr-bulk-button {
	background: #2196F3;
	color: #fff;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9em;
}
.postnr-bulk-button:hover {
	background: #1976D2;
}
.postnr-bulk-button.secondary {
	background: #757575;
}
.postnr-bulk-button.secondary:hover {
	background: #616161;
}
.postnr-bulk-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.45);
	z-index: 9999;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
body.dark-mode .postnr-bulk-modal {
	background: rgba(0, 0, 0, 0.75);
}
.postnr-bulk-modal.is-visible {
	display: flex;
}
.postnr-bulk-modal .modal-content {
	background: var(--bg-primary);
	border-radius: 6px;
	padding: 20px;
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}
.postnr-bulk-modal h3 {
	margin-top: 0;
}
.postnr-bulk-modal textarea {
	width: 100%;
	min-height: 120px;
	margin-bottom: 10px;
}
.postnr-bulk-current {
	background: var(--bg-secondary);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	padding: 10px;
	margin-bottom: 15px;
	max-height: 150px;
	overflow-y: auto;
}
.postnr-bulk-current strong {
	display: block;
	margin-bottom: 6px;
}
.postnr-bulk-current ul {
	margin: 0;
	padding-left: 17px;
}
.postnr-bulk-current li {
	margin-bottom: 4px;
}
.postnr-bulk-feedback {
	color: #d32f2f;
	margin-bottom: 10px;
	display: none;
}
.postnr-bulk-feedback.is-visible {
	display: block;
}
.postnr-bulk-modal .button-row {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}
#postnrBulkLink {
	background: #2196F3;
	color: white;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.85em;
}

/* ============================== */
/* profile.php variable overrides */
/* ============================== */

/* Menu dark mode polish */
.dark-mode-toggle-menu {
	display: flex;
	align-items: center;
	gap: 8px;
}
.dark-mode-toggle-menu .dark-mode-icon { font-size: 1.2em; }
body.dark-mode .off-canvas-list { background-color: var(--bg-secondary); }
body.dark-mode .off-canvas-list li a { color: var(--text-primary); }
body.dark-mode .off-canvas-list li label { color: var(--text-secondary); }
body.dark-mode .tab-bar { background-color: var(--bg-secondary); border-bottom: 1px solid var(--border-color); }
body.dark-mode .tab-bar .title { color: var(--text-primary); }

body.dark-mode .alert-box {
	background-color: var(--bg-tertiary);
	border-color: var(--border-color);
}

/* Modal Styles - Generalized for multiple modal types */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.modal {
	background-color: var(--bg-primary);
	color: var(--text-primary);
	border-radius: var(--border-radius);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	max-width: 600px;
	width: 90%;
	max-height: 80vh;
	overflow-y: auto;
	position: relative;
	padding: 30px;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 1px solid var(--border-color);
}

.modal-title {
	margin: 0;
	color: var(--accent-color);
	font-size: 1.5em;
}

.modal-close {
	background: none;
	border: none;
	font-size: 1.5em;
	cursor: pointer;
	color: var(--text-secondary);
	padding: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
}

.modal-close:hover {
	color: var(--accent-color);
}

.modal-content {
	margin-bottom: 20px;
}

.modal-entry {
	margin-bottom: 20px;
	padding-bottom: 15px;
	border-bottom: 1px solid var(--border-color);
}

.modal-entry:last-child {
	border-bottom: none;
}

.modal-entry-title {
	margin-top: 0;
	margin-bottom: 10px;
	color: var(--text-primary);
}

.modal-entry-list {
	margin: 10px 0;
	padding-left: 20px;
	color: var(--text-secondary);
}

.modal-entry-list li {
	margin-bottom: 5px;
}

.modal-footer {
	text-align: center;
	padding-top: 15px;
	border-top: 1px solid var(--border-color);
}

.modal-footer a {
	color: var(--accent-color);
	text-decoration: none;
}

.modal-footer a:hover {
	text-decoration: underline;
}