/* Global box-sizing fix */
* {
	box-sizing: border-box;
}

/* Prevent horizontal scroll on html and body */
html, body {
	max-width: 100%;
	overflow-x: hidden;
}/* ========================================
 * ORIGINAL LOGIN STYLES (UNCHANGED)
 * ======================================== */

#login-wrapper {
	background-image: url("/assets/images/atlascoveralone.png");
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	min-height: 100vh;
	overflow-x: hidden; /* Prevent horizontal scroll */
	overflow-y: auto; /* Allow vertical scroll if needed */
}

.login-container {
	min-height: 100vh;
	width: 100%;
	display: flex;
	justify-content: center;
	flex-direction: column;
	align-items: center;
	gap: 15px;
	padding: 20px;
	overflow-x: hidden; /* Prevent horizontal scroll */
	box-sizing: border-box; /* Include padding in width */
}

.login-form {
	background-color: #5da9dd;
	border-radius: 20px;
	padding: 25px 30px;
	width: 100%;
	max-width: 350px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#login-form {
	display: flex !important;
	flex-direction: column;
	gap: 12px;
}

.form-group {
	display: flex !important;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}

#login-form label {
	color: black !important;
}

.form-group label {
	flex: 0 0 auto;
	min-width: 80px;
	color: white;
	font-weight: 500;
	font-size: 14px;
}

.form-group input {
	flex: 1;
	background-color: white !important;
	padding: 8px 12px;
	border: none;
	border-radius: 5px;
	font-size: 14px;
}

.form-buttons {
	width: 100%;
	display: flex;
	justify-content: center;
	margin-top: 8px;
}

.btn-login {
	padding: 8px 35px !important;
	background-color: #16273c;
	color: white;
	border-radius: 10px;
	border: none;
	cursor: pointer;
	font-size: 15px;
	transition: background-color 0.3s ease;
}

.btn-login:hover {
	background-color: #1e3a5f;
}

.atlas-image {
	width: 100%;
	max-width: 450px;
	height: auto;
}

.hyperion-image {
	height: 50px;
	width: auto;
}

/* ========================================
 * RESPONSIVE ADJUSTMENTS (LAYOUT ONLY)
 * ======================================== */

/* Large screens - reduce sizes */
@media (min-width: 1200px) {
	.login-container {
		gap: 20px;
	}
	
	.atlas-image {
		max-width: 500px;
	}
	
	.hyperion-image {
		height: 60px;
	}
}

/* Tablet - Medium screens */
@media (max-width: 768px) {
	.login-container {
		gap: 15px;
	}
	
	.login-form {
		padding: 20px 25px;
		max-width: 320px;
	}
	
	.atlas-image {
		max-width: 400px;
	}
	
	.hyperion-image {
		height: 45px;
	}
}

/* Mobile - Small screens */
@media (max-width: 480px) {
	/* Prevent horizontal scroll */
	body {
		overflow-x: hidden;
		width: 100%;
	}
	
	#login-wrapper {
		background-attachment: fixed;
		width: 100%;
		overflow-x: hidden;
	}
	
	.login-container {
		padding: 15px;
		gap: 10px;
		min-height: 100vh;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		overflow-x: hidden;
	}
	
	.login-form {
		padding: 20px;
		border-radius: 15px;
		max-width: calc(100% - 30px); /* Account for container padding */
		width: 100%;
		margin: 0 auto;
		box-sizing: border-box;
		/* Keep original background color */
		background-color: #5da9dd;
	}
	
	#login-form {
		gap: 10px;
		width: 100%;
		box-sizing: border-box;
	}
	
	/* Stack labels and inputs vertically on mobile */
	.form-group {
		flex-direction: column;
		align-items: stretch;
		gap: 5px;
		width: 100%;
		box-sizing: border-box;
	}
	
	.form-group label {
		text-align: left;
		margin-bottom: 2px;
		min-width: unset;
		width: 100%;
		/* Force white color on mobile */
		color: white !important;
		font-weight: 500;
	}
	
	#login-form label {
		/* Force white color on mobile */
		/* color: white !important; */
	}
	
	.form-group input {
		width: 100% !important;
		max-width: 100% !important;
		padding: 10px 12px;
		font-size: 16px; /* Prevents zoom on iOS */
		box-sizing: border-box;
		/* Keep original input styles */
		background-color: white !important;
		border-radius: 5px;
		border: none;
	}
	
	/* Checkbox stays horizontal */
	.form-group:has(input[type="checkbox"]) {
		flex-direction: row;
		align-items: center;
		gap: 8px;
	}
	
	.form-group:has(input[type="checkbox"]) input {
		width: 18px !important;
		min-width: 18px !important;
		max-width: 18px !important;
		height: 18px;
		flex: 0 0 18px;
	}
	
	.form-group:has(input[type="checkbox"]) label {
		flex: 1;
		margin-bottom: 0;
		color: white !important;
		width: auto;
	}
	
	/* Keep original button styles, just make full width */
	.btn-login {
		padding: 10px 30px !important;
		width: 100%;
		max-width: 100%;
		font-size: 16px;
		box-sizing: border-box;
		/* Keep original button colors */
		background-color: #16273c;
		color: white;
		border-radius: 10px;
		border: none;
		cursor: pointer;
	}
	
	.form-buttons {
		width: 100%;
		box-sizing: border-box;
	}
	
	.atlas-image {
		max-width: 280px;
		width: 90%;
		height: auto;
	}
	
	.hyperion-image {
		height: 40px;
		width: auto;
		max-width: 90%;
	}
}

/* Very small screens */
@media (max-width: 360px) {
	.login-form {
		padding: 15px;
	}
	
	#login-form {
		gap: 8px;
	}
	
	.atlas-image {
		max-width: 240px;
	}
	
	.hyperion-image {
		height: 35px;
	}
}

/* Landscape orientation for mobile */
@media (max-height: 600px) and (orientation: landscape) {
	.login-container {
		min-height: auto;
		padding: 10px;
		gap: 10px;
	}
	
	.login-form {
		padding: 15px 25px;
	}
	
	.atlas-image {
		max-width: 250px;
	}
	
	.hyperion-image {
		height: 35px;
	}
}

/* Prevent vertical overflow on very small heights */
@media (max-height: 500px) {
	.atlas-image {
		display: none;
	}
	
	.login-container {
		gap: 10px;
	}
}

/* iOS specific - prevent zoom */
@supports (-webkit-touch-callout: none) {
	.form-group input {
		font-size: 16px !important;
	}
}

/* ========================================
 * ORGANIZATION & APP SELECTION MODALS
 * ======================================== */

/* Modal Base Styles */
.modal {
	display: none;
	position: fixed;
	z-index: 1050;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	outline: 0;
}

.modal.show {
	display: block !important;
}

.modal-dialog {
	position: relative;
	width: auto;
	margin: 1.75rem auto;
	max-width: 500px;
	pointer-events: none;
}

.modal-content {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	pointer-events: auto;
	background-color: #fff;
	background-clip: padding-box;
	border: 1px solid rgba(0, 0, 0, 0.2);
	border-radius: 0.3rem;
	outline: 0;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1rem;
	border-bottom: 1px solid #dee2e6;
	border-top-left-radius: 0.3rem;
	border-top-right-radius: 0.3rem;
}

.modal-title {
	margin-bottom: 0;
	line-height: 1.5;
	font-size: 1.25rem;
	font-weight: 500;
}

.modal-body {
	position: relative;
	flex: 1 1 auto;
	padding: 1rem;
}

.modal-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 0.75rem;
	border-top: 1px solid #dee2e6;
	border-bottom-right-radius: 0.3rem;
	border-bottom-left-radius: 0.3rem;
	gap: 0.5rem;
}

.modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1040;
	width: 100vw;
	height: 100vh;
	background-color: rgba(0, 0, 0, 0.5);
}

body.modal-open {
	overflow: hidden;
}

.close {
	background: transparent;
	border: 0;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	color: #000;
	opacity: 0.5;
	cursor: pointer;
	padding: 0;
}

.close:hover {
	opacity: 0.75;
}

.modal-footer .btn {
	padding: 0.5rem 1rem;
	border-radius: 0.25rem;
	border: 1px solid transparent;
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
}

.modal-footer .btn-secondary {
	background-color: #6c757d;
	border-color: #6c757d;
	color: #fff;
}

.modal-footer .btn-secondary:hover {
	background-color: #5a6268;
	border-color: #545b62;
}

.modal-footer .btn-primary {
	background-color: #5da9dd;
	border-color: #5da9dd;
	color: #fff;
}

.modal-footer .btn-primary:hover {
	background-color: #4a93c8;
	border-color: #4589be;
}

/* Mobile modal adjustments */
@media (max-width: 576px) {
	.modal-dialog {
		margin: 0.5rem;
		max-width: calc(100% - 1rem);
	}
}

.selection-list {
	width: 100%;
	max-height: 400px;
	overflow-y: auto;
}

.selection-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.organization-item,
.app-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 20px;
	border-bottom: 1px solid var(--border-color, #e0e0e0);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.organization-item:hover,
.app-item:hover {
	background-color: var(--hover-color, rgba(0, 0, 0, 0.05));
}

.organization-item:last-child,
.app-item:last-child {
	border-bottom: none;
}

.item-name {
	font-size: 16px;
	font-weight: 500;
	color: var(--text-color, #333);
}

.organization-item i,
.app-item i {
	color: var(--accent-color, #5da9dd);
	font-size: 14px;
}

/* Responsive adjustments for selection modals */
@media (max-width: 480px) {
	.selection-list {
		max-height: 300px;
	}

	.organization-item,
	.app-item {
		padding: 12px 15px;
	}

	.item-name {
		font-size: 14px;
	}
}