/* CSS Document */

/* ========== Reset & Base Styles ========== */
* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: #333;
	background-color: #f5f5f5;
	overflow-x: hidden;
}

body.panel-open {
	overflow: hidden;
}

/* ========== Container ========== */
#container {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	background: #fff;
	position: relative;
}

/* ========== Header ========== */
#header {
	position: sticky;
	top: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: #3388cc;
	color: #fff;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#header h1 {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
	flex: 1;
	text-align: center;
}

/* ========== Icon Buttons ========== */
.icon-btn {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	transition: background-color 0.2s;
}

.icon-btn:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

/* Hamburger Icon */
.hamburger {
	display: block;
	width: 24px;
	height: 2px;
	background: #fff;
	position: relative;
}

.hamburger::before,
.hamburger::after {
	content: '';
	position: absolute;
	width: 24px;
	height: 2px;
	background: #fff;
	left: 0;
}

.hamburger::before {
	top: -8px;
}

.hamburger::after {
	bottom: -8px;
}

/* User Icon */
.user-icon {
	display: block;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid #fff;
	position: relative;
}

.user-icon::after {
	content: '';
	position: absolute;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	top: 2px;
	left: 50%;
	transform: translateX(-50%);
}

/* ========== Side Panels ========== */
.side-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 280px;
	max-width: 85%;
	background: #fff;
	box-shadow: 0 0 10px rgba(0,0,0,0.3);
	z-index: 1000;
	overflow-y: auto;
	transition: transform 0.3s ease;
	padding-top: 3rem;
}

#panelViewSettings {
	display: none;
	padding: 1rem;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	margin-bottom: 1rem;
}

#navPanel {
	left: 0;
	transform: translateX(-100%);
}

#navPanel.open {
	transform: translateX(0);
}

#userPanel {
	right: 0;
	transform: translateX(100%);
}

#userPanel.open {
	transform: translateX(0);
}

.side-panel ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.side-panel li {
	border-bottom: 1px solid #e0e0e0;
}

.side-panel a {
	display: block;
	padding: 1rem 1.5rem;
	color: #333;
	text-decoration: none;
	transition: background-color 0.2s;
}

.side-panel a:hover {
	background-color: #f5f5f5;
}

/* ========== Overlay ========== */
.overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 999;
}

.overlay.active {
	display: block;
}

/* ========== Main Content ========== */
#content {
	flex: 1;
	padding: 1.5rem 1rem;
	padding-bottom: calc(8rem + env(safe-area-inset-bottom, 100px)); /* Extra space for fixed footer */
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
}

/* ========== Footer ========== */
#footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background: #f5f5f5;
	padding: 1rem;
	padding-bottom: calc(1rem + env(safe-area-inset-bottom, 20px));
	border-top: 1px solid #e0e0e0;
	text-align: center;
	z-index: 90;
	box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
	overflow-x: auto;
	overflow-y: hidden;
	white-space: nowrap;
	-webkit-overflow-scrolling: touch;
}

/* ========== Forms ========== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 1rem;
	font-family: inherit;
	margin-bottom: 1rem;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: #3388cc;
	box-shadow: 0 0 0 3px rgba(51, 136, 204, 0.1);
}

/* ========== Buttons ========== */
button,
input[type="submit"],
.btn {
	padding: 0.5rem 1rem;
	background: #3388cc;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 0.9rem;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
	transition: background-color 0.2s;
	margin: 0.25rem;
	white-space: nowrap;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
	background: #2577bb;
}

/* jQuery Mobile compatibility classes */
.ui-btn,
.ui-btn-inline {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	background: #3388cc;
	color: #fff;
	border: none;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s;
	margin: 0.25rem;
}

.ui-btn:hover {
	background: #2577bb;
}

.ui-btn-a {
	background: #3388cc;
}

.ui-mini {
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
}

.ui-corner-all {
	border-radius: 4px;
}

.ui-bar {
	padding: 0.75rem 1rem;
	background: #e9e9e9;
	border: 1px solid #ddd;
	font-weight: bold;
}

.ui-bar-a {
	background: #e9e9e9;
	color: #333;
}

.ui-body {
	padding: 1rem;
	background: #fff;
	border: 1px solid #ddd;
	border-top: none;
}

.ui-body-a {
	background: #fff;
	color: #333;
}

/* ========== Desktop Responsive ========== */
@media (min-width: 768px) {
	body {
		max-width: 700px;
		margin: 0 auto;
	}

	#header h1 {
		font-size: 1.5rem;
	}

	#content {
		padding: 2rem 1.5rem;
		padding-bottom: calc(8rem + env(safe-area-inset-bottom, 100px)); /* Keep space for fixed footer */
	}

	#footer {
		max-width: 700px;
		left: 50%;
		transform: translateX(-50%);
	}
}

/* ========== Gallery Dialog ========== */
#gallery-dialog {
	padding: 0;
	border: none;
	background: rgba(0, 0, 0, 0.95);
	max-width: 100vw;
	max-height: 100vh;
	width: 100vw;
	height: 100vh;
}

#gallery-dialog::backdrop {
	background: rgba(0, 0, 0, 0.9);
}

.gallery-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gallery-image {
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
	user-select: none;
	-webkit-user-select: none;
}

.gallery-close,
.gallery-prev,
.gallery-next {
	position: absolute;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	border: none;
	font-size: 2rem;
	width: 50px;
	height: 50px;
	cursor: pointer;
	transition: background-color 0.2s;
	z-index: 10;
	border-radius: 4px;
}

.gallery-close:hover,
.gallery-prev:hover,
.gallery-next:hover {
	background: rgba(255, 255, 255, 0.3);
}

.gallery-close {
	top: 1rem;
	right: 1rem;
	font-size: 2.5rem;
	line-height: 1;
}

.gallery-prev {
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

.gallery-next {
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

.gallery-counter {
	position: absolute;
	bottom: 1rem;
	left: 50%;
	transform: translateX(-50%);
	color: #fff;
	background: rgba(0, 0, 0, 0.5);
	padding: 0.5rem 1rem;
	border-radius: 4px;
	font-size: 0.9rem;
}

@media (max-width: 767px) {
	.gallery-close,
	.gallery-prev,
	.gallery-next {
		width: 40px;
		height: 40px;
		font-size: 1.5rem;
	}

	.gallery-close {
		font-size: 2rem;
	}
}
