/**
 * Forms Tab Styles
 *
 * Styles for the Epic HQ Forms submission system.
 *
 * @package EM_Epic_HQ
 */

/* ==========================================================================
   Forms Page Layout
   ========================================================================== */

.em-portal-forms {
	max-width: 1200px;
}

.em-forms-section {
	margin-bottom: 2rem;
}

.em-forms-section__title {
	font-size: 1.125rem;
	font-weight: 600;
	margin-bottom: 1rem;
	color: #1f2937;
}

/* ==========================================================================
   Form Type Cards
   ========================================================================== */

.em-form-type-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 1rem;
}

.em-form-type-card {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	padding: 1.25rem;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.em-form-type-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.em-form-type-card__icon {
	flex-shrink: 0;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #e0f2fe, #dbeafe);
	border-radius: 10px;
	color: #0284c7;
}

.em-form-type-card__icon svg {
	width: 24px;
	height: 24px;
}

.em-form-type-card__content {
	flex: 1;
	min-width: 0;
}

.em-form-type-card__title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
	color: #1f2937;
}

.em-form-type-card__desc {
	font-size: 0.875rem;
	color: #6b7280;
	margin: 0;
	line-height: 1.4;
}

.em-form-type-card .em-btn {
	flex-shrink: 0;
	align-self: center;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.em-forms-empty-state {
	text-align: center;
	padding: 3rem 1.5rem;
	background: #f9fafb;
	border-radius: 12px;
	border: 2px dashed #e5e7eb;
}

.em-forms-empty-state__icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 1rem;
	color: #9ca3af;
}

.em-forms-empty-state__icon svg {
	width: 100%;
	height: 100%;
}

.em-forms-empty-state h3 {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
	color: #374151;
}

.em-forms-empty-state p {
	font-size: 0.875rem;
	color: #6b7280;
	margin: 0;
}

.em-forms-empty {
	color: #6b7280;
	font-style: italic;
	padding: 1rem;
}

/* ==========================================================================
   Submissions Table
   ========================================================================== */

.em-forms-table-wrapper {
	overflow-x: auto;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.em-forms-table {
	width: 100%;
	border-collapse: collapse;
}

.em-forms-table th,
.em-forms-table td {
	padding: 0.875rem 1rem;
	text-align: left;
}

.em-forms-table thead th {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	background: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
}

.em-forms-table tbody tr {
	border-bottom: 1px solid #f3f4f6;
}

.em-forms-table tbody tr:last-child {
	border-bottom: none;
}

.em-forms-table tbody tr:hover {
	background: #f9fafb;
}

.em-forms-table__type {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-weight: 500;
}

.em-forms-table__type-icon {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f3f4f6;
	border-radius: 6px;
	color: #6b7280;
}

.em-forms-table__type-icon svg {
	width: 16px;
	height: 16px;
}

.em-forms-table__actions {
	display: flex;
	gap: 0.5rem;
}

.em-forms-table__notes-row {
	background: #fef3c7 !important;
}

.em-forms-table__notes-row td {
	padding-top: 0;
}

.em-forms-rejection-notes {
	font-size: 0.875rem;
	color: #92400e;
	padding: 0.75rem 1rem;
	background: rgba(251, 191, 36, 0.1);
	border-radius: 6px;
	margin-top: -0.5rem;
}

.em-forms-rejection-notes strong {
	display: block;
	margin-bottom: 0.25rem;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.em-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.625rem;
	font-size: 0.75rem;
	font-weight: 500;
	border-radius: 9999px;
}

.em-badge--gray {
	background: #f3f4f6;
	color: #6b7280;
}

.em-badge--yellow {
	background: #fef3c7;
	color: #92400e;
}

.em-badge--green {
	background: #d1fae5;
	color: #065f46;
}

.em-badge--red {
	background: #fee2e2;
	color: #991b1b;
}

/* ==========================================================================
   Form Modal
   ========================================================================== */

.em-modal--lg .em-modal__dialog {
	max-width: 640px;
	max-height: calc(100vh - 2rem);
	max-height: calc(100dvh - 2rem);
	display: flex;
	flex-direction: column;
}

.em-modal--lg .em-modal__content {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

/* Prevent body scroll when modal is open */
body.em-modal-open {
	overflow: hidden;
	position: fixed;
	width: 100%;
	height: 100%;
}

/* iOS Safari fixes for modal */
@supports (-webkit-touch-callout: none) {
	.em-modal--lg .em-modal__dialog {
		max-height: -webkit-fill-available;
	}
}

/* Form Fields */
.em-form-field {
	margin-bottom: 1.25rem;
}

.em-form-label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	margin-bottom: 0.375rem;
	color: #374151;
}

.em-required {
	color: #dc2626;
}

.em-optional {
	font-weight: 400;
	color: #9ca3af;
}

.em-form-input,
.em-form-select,
.em-form-textarea {
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-size: 0.9375rem;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #ffffff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.em-form-input:focus,
.em-form-select:focus,
.em-form-textarea:focus {
	outline: none;
	border-color: #5bbcc6;
	box-shadow: 0 0 0 3px rgba(91, 188, 198, 0.15);
}

.em-form-input::placeholder {
	color: #9ca3af;
}

.em-form-help {
	font-size: 0.8125rem;
	color: #6b7280;
	margin-top: 0.375rem;
}

.em-form-error {
	font-size: 0.8125rem;
	color: #dc2626;
	margin-top: 0.375rem;
}

.em-form-input.is-invalid,
.em-form-select.is-invalid,
.em-form-textarea.is-invalid {
	border-color: #dc2626;
}

/* Form Attachments Section */
.em-form-attachments {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid #e5e7eb;
}

.em-form-attachments__title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 1rem;
	color: #1f2937;
}

.em-form-attachment-field {
	margin-bottom: 1rem;
	padding: 1rem;
	background: #f9fafb;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
}

.em-form-attachment-field__label {
	font-size: 0.875rem;
	font-weight: 500;
	margin-bottom: 0.25rem;
	color: #374151;
}

.em-form-attachment-field__desc {
	font-size: 0.8125rem;
	color: #6b7280;
	margin-bottom: 0.75rem;
}

.em-form-attachment-field__upload {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.em-form-attachment-field__file-input {
	flex: 1;
}

.em-form-attachment-field__uploaded {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: #d1fae5;
	border-radius: 6px;
	color: #065f46;
	font-size: 0.875rem;
}

.em-form-attachment-field__uploaded svg {
	width: 16px;
	height: 16px;
	color: #10b981;
}

.em-form-attachment-field__remove {
	margin-left: auto;
	background: none;
	border: none;
	color: #991b1b;
	cursor: pointer;
	padding: 0.25rem;
}

/* Status Message (for view-only mode) */
.em-form-status-message {
	padding: 1rem;
	border-radius: 8px;
	margin-bottom: 1rem;
}

.em-form-status-message--approved {
	background: #d1fae5;
	color: #065f46;
}

.em-form-status-message--rejected {
	background: #fee2e2;
	color: #991b1b;
}

.em-form-status-message--pending {
	background: #fef3c7;
	color: #92400e;
}

/* ==========================================================================
   Dropzone
   ========================================================================== */

.em-dropzone {
	position: relative;
	border: 2px dashed #d1d5db;
	border-radius: 8px;
	padding: 1.5rem;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.em-dropzone:hover,
.em-dropzone.is-dragover {
	border-color: #5bbcc6;
	background: rgba(91, 188, 198, 0.05);
}

.em-dropzone input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}

.em-dropzone__icon {
	margin-bottom: 0.5rem;
	color: #9ca3af;
}

.em-dropzone__text {
	font-size: 0.9375rem;
	color: #374151;
	margin: 0 0 0.25rem;
}

.em-dropzone__hint {
	font-size: 0.8125rem;
	color: #9ca3af;
	margin: 0;
}

.em-dropzone__file {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 0.75rem;
	padding: 0.5rem 0.75rem;
	background: #f3f4f6;
	border-radius: 6px;
}

.em-dropzone__filename {
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
}

.em-dropzone__remove {
	background: none;
	border: none;
	font-size: 1.25rem;
	color: #6b7280;
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

.em-dropzone__remove:hover {
	color: #dc2626;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.em-form-type-grid {
		grid-template-columns: 1fr;
	}

	.em-form-type-card {
		flex-wrap: wrap;
	}

	.em-form-type-card .em-btn {
		width: 100%;
		margin-top: 0.75rem;
	}

	.em-forms-table th:nth-child(3),
	.em-forms-table td:nth-child(3) {
		display: none;
	}

	.em-forms-table__actions {
		flex-direction: column;
	}

	.em-forms-table__actions .em-btn {
		width: 100%;
		justify-content: center;
	}

	/* Modal mobile fixes */
	.em-modal--lg {
		padding: 0;
		align-items: flex-end;
	}

	.em-modal--lg .em-modal__dialog {
		max-width: 100%;
		max-height: 90vh;
		max-height: 90dvh;
		border-radius: 16px 16px 0 0;
		margin: 0;
	}

	.em-modal--lg .em-modal__content {
		max-height: calc(90vh - 120px);
		max-height: calc(90dvh - 120px);
		padding-bottom: 1.5rem;
	}

	.em-modal--lg .em-modal__header {
		position: sticky;
		top: 0;
		background: var(--em-hq-bg-white, #fff);
		z-index: 1;
	}
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.em-text-muted {
	color: #9ca3af;
}
