/* ********** */
/* EDIT FORM STYLES */
/* ********** */
.edit-form-container {
	padding: 20px;
}

.edit-form {
	max-width: 800px;
	margin: 0 auto;
}

.edit-form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
	justify-items: center;
}

/* Base grid styles for both flight and template */
.edit-form-grid-flight,
.edit-form-grid-template {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: auto auto auto auto;
	gap: 30px 20px;
	justify-items: stretch;
	align-items: stretch;
	width: 100%;
}

/* Flight grid specific areas */
.edit-form-grid-flight {
	grid-template-areas:
		"date aircraft capacity"
		"from map to"
		"flight-data flight-data flight-data"
		"notes notes mark";
}

/* Template grid specific areas - no date, aircraft spans 2 columns */
.edit-form-grid-template {
	grid-template-areas:
		"aircraft aircraft capacity"
		"from map to"
		"flight-data flight-data flight-data"
		"notes notes mark";
}

/* Override form-group max-width for both flight and template grids to fill space */
.edit-form-grid-flight .form-group,
.edit-form-grid-template .form-group {
	max-width: none;
	width: 100%;
	min-height: 0;
	height: 100%;
}

/* Grid area assignments - work for both flight and template grids */
#flightEditGridDate { grid-area: date; }
#flightEditGridAircraft { grid-area: aircraft; }
#flightEditGridCapacity { grid-area: capacity; }
#flightEditGridFrom { grid-area: from; }
#flightEditGridMap { grid-area: map; }
#flightEditGridTo { grid-area: to; }
#flightEditGridFlightData { grid-area: flight-data; }
#flightEditGridNotes { grid-area: notes; }
#flightEditGridMark { grid-area: mark; }

.edit-form .form-group {
	width: 100%;
	max-width: 400px;
	display: flex;
	flex-direction: column;
}

.edit-form .form-group .info-box {
	width: 100%;
	max-width: none;
	margin-bottom: 0;
}

.edit-form .form-group:has(.info-box) {
	grid-column: 1 / -1;
	max-width: none;
}

/* In both flight and template grids, do not auto-span items that contain an info-box
   so columns remain three equal widths on desktop */
.edit-form-grid-flight .form-group:has(.info-box),
.edit-form-grid-template .form-group:has(.info-box) {
	grid-column: auto;
	max-width: none;
}

/* Flight data grid should span full width */
#flightEditGridFlightData {
	grid-column: 1 / -1;
	max-width: none;
	width: 100%;
}

/* Data Grid Styles */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 0.6fr));
    gap: 10px;
    width: 100%;
}

.data-grid-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--back-section-title);
    border: 1px solid var(--back-bdr-grey);
    border-radius: 5px;
    padding: 10px;
}

/* Other Name field should be double width */
.data-grid-item:has(input[name="name"]) {
    grid-column: span 2;
}

/* Mobile responsive - collapse to single column */
@media (max-width: 600px) {
    .data-grid {
        grid-template-columns: 1fr;
    }

    .data-grid-item:has(input[name="name"]) {
        grid-column: 1;
    }
}

.data-grid-item .form-checkbox-input {
    margin: auto;
    transform: scale(1.5);
}

/* Center text in data-grid-item inputs except name field */
.data-grid-item input:not([name="name"]) {
    text-align: center;
}

/* Hide number input spinners to keep text centered */
.data-grid-item input[type="number"]::-webkit-outer-spin-button,
.data-grid-item input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.data-grid-item input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}


.data-grid-label {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-base);
    color: var(--font-color-base);
    text-transform: uppercase;
    margin-bottom: 2px;
    text-align: center;
}

/* Specific styling for flight edit form help text */
#flightEditGridFlightData .form-info-text {
    margin-bottom: 10px;
}

.toggle-search {
	position: absolute;
	top: 15px;
	right: 15px;
	z-index: 10;
}

.info-search {
	display: flex;
	align-items: center;
	position: relative;
	margin: 10px 0 10px 0;
}

.search-button-container {
	display: flex;
	justify-content: center;
}

.search-icon {
	position: absolute;
	left: 12px;
	width: 16px;
	height: 16px;
	z-index: 1;
	opacity: 0.6;
}

.search-input {
	padding-left: 40px;
	width: 100%;
	border: none;
	background: var(--white);
	border-radius: 4px;
}

.edit-form-group-checkbox {
	justify-content: center;
	align-items: flex-start;
}

.edit-form-required-asterisk {
	color: #cc0000;
}

.edit-form-error {
	color: #cc0000;
	font-size: var(--font-size-small);
	margin-top: 6px;
	display: flex;
	align-items: flex-start;
	gap: 6px;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.edit-form-error.show {
	max-height: 50px;
	opacity: 1;
	margin-top: 6px;
}

.edit-form-error img {
	width: 16px;
	height: 16px;
	margin-top: 1px;
	margin-left: 5px;
	filter: brightness(0) saturate(100%) invert(20%) sepia(100%) saturate(10000%) hue-rotate(0deg) brightness(0.8);
}

.edit-form-input-error {
	border-color: #cc0000 !important;
}

.edit-form .form-actions .blue-button,
.edit-form .form-actions .green-button,
.edit-form .form-actions .secondary-button,
.edit-form .form-actions .red-button {
	flex: 1;
	max-width: 50%;
	justify-content: center;
	align-items: center;
}

/* Single button/anchor in form-actions goes full width */
.edit-form .form-actions:has(.blue-button:only-child),
.edit-form .form-actions:has(.green-button:only-child),
.edit-form .form-actions:has(.secondary-button:only-child),
.edit-form .form-actions:has(.red-button:only-child),
.edit-form .form-actions:has(a:only-child) {
	.blue-button,
	.green-button,
	.secondary-button,
	.red-button,
	a {
		max-width: 100%;
	}
}

/* Password input with toggle button */
.password-input-container {
	position: relative;
	display: inline-block;
	width: 100%;
}

.password-input-container .form-input {
	padding-right: 40px;
	width: 100%;
}

.password-toggle {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	width: 20px;
	height: 20px;
}

.eye-icon {
	width: 18px;
	height: 18px;
}

/* ********** */
/* HOTLINK BUTTON STYLES */
/* ********** */
.form-hotlink-options {
	display: flex;
	gap: 8px;
	margin-top: 8px;
	flex-wrap: wrap;
}

.form-label-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.form-label-container .form-label {
	margin-bottom: 0;
}

.form-label-container .form-hotlink-options {
	margin-top: 0;
	justify-content: flex-end;
}

/* Hide form-hotlink-options on smaller screens */
@media (max-width: 1159px) {
	.form-hotlink-options {
		display: none;
	}
}

.blue-button.small.green {
	background: var(--rag-green);
	border: 1px solid transparent;
	padding: 4px 8px;
	font-size: var(--font-size-small);
	width: auto;
	flex: none;
}

.blue-button.small.green:hover {
	background: var(--white);
	border-color: var(--rag-green);
	color: var(--rag-green);
}

.secondary-button.small {
	border: 1px solid var(--border-medium);
	padding: 4px 8px;
	font-size: var(--font-size-small);
	width: auto;
	flex: none;
}

/* Responsive design for smaller screens */
@media (max-width: 795px) {
	.edit-form-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.edit-form .form-group {
		max-width: 100%;
	}
}

@media (max-width: 975px) {
	/* Base responsive styles for both grids */
	.edit-form-grid-flight,
	.edit-form-grid-template {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
	}

	/* Flight grid mobile areas */
	.edit-form-grid-flight {
		grid-template-areas:
			"date"
			"aircraft"
			"capacity"
			"from"
			"to"
			"map"
			"flight-data"
			"notes"
			"mark";
	}

	/* Template grid mobile areas - no date */
	.edit-form-grid-template {
		grid-template-areas:
			"aircraft"
			"capacity"
			"from"
			"to"
			"map"
			"flight-data"
			"notes"
			"mark";
	}
}

/* ********** */
/* TOAST */
/* ********** */
.form-toast {
	position: fixed;
	display: block;
	bottom: -50vh;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 100vw;
	max-height: 50vh;
	border-radius: 20px 20px 0 0;
	background: var(--white);
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
	transition: bottom 0.3s ease;
	z-index: 1000;
	box-sizing: border-box;
}

.form-toast.open {
	bottom: 0;
}

.form-toast .top {
	height: 40px;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	padding: 0;
}

.form-toast .top::before {
	content: '';
	width: 20px;
	height: 5px;
	background: #000;
	border-radius: 3px;
}

.form-toast .body {
	padding: 0 20px 20px 20px;
}

#formToastContainer {
	overflow-x: auto;
	overflow-y: auto;
	width: 100%;
	max-height: 350px;
}

#formToastContainer table {
	width: 100%;
	min-width: 100%;
}

#formToastContainer table thead tr {
	position: sticky;
	top: 0;
	z-index: 10;
}

#formToastContainer table thead th.asc,
#formToastContainer table thead th.dsc {
	border-left: none;
}

#formToastContainer table thead th.asc::after,
#formToastContainer table thead th.dsc::after {
	content: none;
}