/**
 * ICI Container Tracking - Frontend Styles
 *
 * Table styling matching ICI's current system design.
 *
 * @package ICI_Container_Tracking
 * @since 1.0.0
 */

/* Dashboard */
.ici-tracking-wrapper {
	max-width: 100%;
	margin: 20px 0;
	font-family: 'Noto Sans', sans-serif;
}

.ici-user-nav {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 8px 15px;
	margin-bottom: 12px;
	font-size: 13px;
}

.ici-user-nav-link {
	color: #000066;
	text-decoration: none;
}

.ici-user-nav-link:hover {
	text-decoration: underline;
}

.ici-user-nav-link.ici-user-nav-active {
	font-weight: 700;
	text-decoration: underline;
	cursor: default;
}

.ici-account-nav {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.ici-tracking-header {
	margin-bottom: 15px;
}

.ici-tracking-title {
	font-size: 1.5em;
	color: #000066;
	margin: 0 0 5px 0;
	padding: 0;
}

.ici-tracking-count {
	color: #666;
	font-size: 0.9em;
	margin: 0;
}

/* Messages */
.ici-tracking-message {
	padding: 15px 20px;
	margin: 10px 0;
}

.ici-tracking-login {
	background-color: #fff8e1;
	border: 1px solid #ffcc00;
	color: #856404;
}

.ici-tracking-no-customer {
	background-color: #e3f2fd;
	border: 1px solid #2196f3;
	color: #0d47a1;
}

.ici-tracking-error {
	background-color: #ffebee;
	border: 1px solid #f44336;
	color: #c62828;
}

.ici-tracking-empty {
	background-color: #f5f5f5;
	border: 1px solid #ddd;
	color: #666;
}

.ici-tracking-message p {
	margin: 0;
}

.ici-tracking-message a {
	color: inherit;
	font-weight: bold;
}

/* Table wrapper for horizontal scrolling */
.ici-tracking-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 0 15px 0;
	border: 1px solid #ddd;
}

/* Table */
.ici-tracking-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	min-width: 1200px;
	white-space: nowrap;
}

/* Table header */
.ici-tracking-table thead th {
	background-color: #000047;
	color: #ffffff;
	font-weight: 600;
	text-align: left;
	padding: 10px 8px;
	border: 1px solid #000035;
	white-space: nowrap;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Sortable column header links */
.ici-tracking-table thead th a.ici-sort-link {
	color: #ffffff;
	text-decoration: none;
	display: block;
	cursor: pointer;
	user-select: none;
}

.ici-tracking-table thead th a.ici-sort-link:hover {
	color: #ffd64f;
}

.ici-tracking-table thead th a.ici-sort-active {
	color: #ffd64f;
}

.ici-sort-indicator {
	font-size: 10px;
	margin-left: 4px;
	opacity: 0.9;
}

/* Table body */
.ici-tracking-table tbody td {
	padding: 8px;
	border: 1px solid #ddd;
	vertical-align: middle;
}

/* Alternating row colors */
.ici-tracking-table tbody tr:nth-child(odd) {
	background-color: #ffffff;
}

.ici-tracking-table tbody tr:nth-child(even) {
	background-color: #f9f9f9;
}

/* Hover effect */
.ici-tracking-table tbody tr:hover {
	background-color: #eeeef8;
}

/* Equipment number - monospace font */
.ici-tracking-table .ici-equip-num {
	font-family: 'Courier New', Courier, monospace;
	font-weight: 600;
	white-space: nowrap;
}

/* Y/N columns - centered */
.ici-tracking-table .ici-yn {
	/* text-align: center; */
	font-weight: 500;
}

/* Footer */
.ici-tracking-footer {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #eee;
}

.ici-tracking-updated {
	color: #888;
	font-size: 0.85em;
	font-style: italic;
	margin: 0;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
	.ici-tracking-table {
		font-size: 12px;
	}

	.ici-tracking-table thead th,
	.ici-tracking-table tbody td {
		padding: 6px 5px;
	}

	.ici-tracking-title {
		font-size: 1.2em;
	}
}

/* Print styles */
@media print {
	.ici-tracking-wrapper {
		margin: 0;
	}

	.ici-tracking-table-wrapper {
		overflow: visible;
		border: none;
	}

	.ici-tracking-table {
		min-width: auto;
		font-size: 10px;
	}

	.ici-tracking-table thead th {
		background-color: #000047 !important;
		color: #fff !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.ici-tracking-table tbody tr:nth-child(even) {
		background-color: #f5f5f5 !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

/* Search/Filter Controls */
.ici-tracking-controls {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	flex-wrap: wrap;
	gap: 10px;
}

.ici-tracking-search {
	display: flex;
	gap: 8px;
	flex: 1;
	min-width: 300px;
}

.ici-search-field {
	padding: 10px 12px;
	border: 1px solid #ddd;
	font-size: 14px;
	min-width: 140px;
	background: #fff;
	cursor: pointer;
}

.ici-search-field:focus {
	outline: none;
	border-color: #000066;
}

#ici-search-input {
	flex: 1;
	padding: 10px 12px;
	border: 1px solid #ddd;
	font-size: 14px;
	min-width: 200px;
}

#ici-search-input:focus {
	outline: none;
	border-color: #000066;
}

.ici-btn-primary,
.ici-btn-secondary {
	padding: 10px 20px;
	border: none;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.5px;
	cursor: pointer;
	transition: background-color 0.2s;
	white-space: nowrap;
}

.ici-btn-primary {
	background: #F06B00;
    color: #ffffff;
    border: 2px solid #F06B00;
}

.ici-btn-primary:hover {
	background: #005EBD;
	color: #ffffff;
	border-color: #005EBD;
	text-decoration: underline;
}

#ici-export-csv {
	line-height: 42px;
	padding-top: 8px;
	padding-bottom: 8px;
}

.ici-btn-secondary {
	background: #f5f5f5;
	color: #333;
	border: 1px solid #ddd;
}

.ici-btn-secondary:hover {
	background: #e5e5e5;
}

/* Hidden row state for filtering */
.ici-tracking-table tbody tr.ici-hidden {
	display: none !important;
}

/* Loading spinner */
.ici-loading {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #000066;
	border-radius: 50%;
	animation: ici-spin 0.8s linear infinite;
}

@keyframes ici-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
	.ici-tracking-controls {
		flex-direction: column;
		align-items: stretch;
	}

	.ici-tracking-search {
		flex-direction: column;
		min-width: auto;
	}

	.ici-search-field,
	#ici-search-input {
		width: 100%;
		min-width: auto;
	}

	.ici-btn-primary,
	.ici-btn-secondary {
		width: 100%;
	}

	.ici-pagination-wrapper {
		flex-direction: column;
		align-items: flex-start;
	}

	.ici-pagination-buttons {
		width: 100%;
		justify-content: center;
	}

	.ici-page-btn {
		padding: 6px 10px;
		font-size: 13px;
		min-width: 35px;
	}
}

/* Pagination controls */
.ici-pagination-controls {
	margin: 15px 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

.ici-pagination-wrapper {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	flex-wrap: wrap;
	gap: 15px;
}

.ici-pagination-buttons {
	display: flex;
	gap: 5px;
	flex-wrap: wrap;
}

.ici-page-btn {
	padding: 8px 12px;
	background: #f5f5f5;
	border: 1px solid #ddd;
	cursor: pointer;
	font-size: 14px;
	color: #333;
	transition: all 0.2s;
	min-width: 40px;
}

.ici-page-btn:hover:not(:disabled) {
	background: #e5e5e5;
	border-color: #000066;
}

.ici-page-btn.active {
	background: #000066;
	color: #fff;
	border-color: #000066;
	font-weight: 600;
}

.ici-page-btn:disabled {
	background: #f9f9f9;
	color: #ccc;
	border-color: #e5e5e5;
	cursor: not-allowed;
	opacity: 0.6;
}

.ici-page-ellipsis {
	padding: 8px 5px;
	color: #666;
	font-size: 14px;
}

.ici-pagination-info {
	color: #666;
	font-size: 14px;
	white-space: nowrap;
}

/* =========================================================================
   Auth Forms (Login, Register, Account)
   ========================================================================= */

.ici-auth-wrapper,
.ici-account-wrapper {
	max-width: 480px;
	margin: 40px auto;
	font-family: 'Noto Sans', sans-serif;
}

.ici-account-wrapper {
	max-width: 640px;
}

.ici-auth-form {
	background: #fff;
	border: 1px solid #ddd;
	padding: 32px 36px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ici-auth-title {
	font-size: 1.4em;
	color: #000066;
	margin: 0 0 24px 0;
	padding: 0;
}

.ici-auth-error {
	background: #ffebee;
	border: 1px solid #f44336;
	color: #c62828;
	padding: 10px 14px;
	margin-bottom: 18px;
	font-size: 14px;
}

.ici-auth-success {
	background: #e8f5e9;
	border: 1px solid #4caf50;
	color: #1b5e20;
	padding: 10px 14px;
	margin-bottom: 18px;
	font-size: 14px;
}

.ici-form-group {
	margin-bottom: 18px;
}

.ici-form-group label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 6px;
}

.ici-form-group input[type='text'],
.ici-form-group input[type='email'],
.ici-form-group input[type='password'] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	font-size: 14px;
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.ici-form-group input:focus {
	outline: none;
	border-color: #000066;
	box-shadow: 0 0 0 2px rgba(0, 0, 102, 0.12);
}

.ici-form-check {
	margin-bottom: 20px;
	font-size: 14px;
}

.ici-form-check label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	color: #444;
}

.ici-btn-full {
	width: 100%;
	padding: 12px;
	font-size: 15px;
}

.ici-auth-links {
	margin: 18px 0 0 0;
	font-size: 13px;
	color: #666;
	text-align: center;
}

.ici-auth-links a {
	color: #000066;
	font-weight: 600;
	text-decoration: none;
}

.ici-auth-links a:hover {
	text-decoration: underline;
}

.ici-field-hint {
	font-size: 12px;
	color: #888;
	margin: 4px 0 0 0;
}

/* Account page sections */
.ici-account-section {
	background: #fff;
	border: 1px solid #ddd;
	padding: 24px 28px;
	margin-bottom: 20px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ici-account-section h3 {
	color: #000066;
	margin: 0 0 14px 0;
	font-size: 1.1em;
}

.ici-link-status {
	font-size: 14px;
	margin: 0 0 12px 0;
	padding: 10px 14px;
}

.ici-link-status--linked {
	background: #e8f5e9;
	border: 1px solid #4caf50;
	color: #1b5e20;
}

.ici-link-status--unlinked {
	background: #fff8e1;
	border: 1px solid #ffcc00;
	color: #856404;
}

.ici-relink-form {
	margin-top: 14px;
}

.ici-relink-form .ici-form-group {
	margin-bottom: 12px;
}

/* Watchlist */
.ici-watchlist-input-row {
	display: flex;
	gap: 8px;
	margin-bottom: 6px;
}

.ici-watchlist-input-row input[type='text'] {
	flex: 1;
	padding: 10px 12px;
	border: 1px solid #ddd;
	font-size: 14px;
	text-transform: uppercase;
}

.ici-watchlist-input-row input:focus {
	outline: none;
	border-color: #000066;
}

.ici-watchlist-feedback {
	font-size: 13px;
	padding: 8px 12px;
	margin-top: 8px;
}

.ici-watchlist-list {
	margin-top: 16px;
}

.ici-watchlist-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 8px;
	border-bottom: 1px solid #f0f0f0;
}

.ici-watchlist-item:last-child {
	border-bottom: none;
}

.ici-watchlist-num {
	font-family: 'Courier New', Courier, monospace;
	font-weight: 600;
	font-size: 13px;
}

.ici-watchlist-empty {
	color: #888;
	font-size: 14px;
	margin: 0;
}

.ici-btn-danger-sm {
	padding: 2px 8px;
	background: #fff;
	color: #c62828;
	border: 1px solid #f44336;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
}

.ici-btn-danger-sm:hover:not(:disabled) {
	background: #ffebee;
}

.ici-btn-danger-sm:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Confirmation modal (custom, replaces native confirm()) */
.ici-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 20, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 20px;
}

.ici-modal {
	background: #fff;
	max-width: 420px;
	width: 100%;
	padding: 24px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	font-family: 'Noto Sans', sans-serif;
}

.ici-modal-title {
	margin: 0 0 12px;
	color: #000066;
	font-size: 18px;
}

.ici-modal-message {
	margin: 0 0 16px;
	color: #333;
	font-size: 15px;
	line-height: 1.5;
}

.ici-modal-error {
	margin: 0 0 16px;
	padding: 10px 12px;
	background: #ffebee;
	color: #c62828;
	border: 1px solid #f44336;
	font-size: 14px;
}

.ici-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

/* Keep modal buttons side-by-side; override the global mobile width:100% rule. */
.ici-modal-actions .ici-btn-secondary,
.ici-modal-actions .ici-btn-danger {
	width: auto;
}

.ici-btn-danger {
	padding: 10px 20px;
	background: #c62828;
	color: #fff;
	border: 2px solid #c62828;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.5px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.ici-btn-danger:hover:not(:disabled) {
	background: #b71c1c;
	border-color: #b71c1c;
}

.ici-btn-danger:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Manage Users console */
.ici-manage-users-wrapper {
	font-family: 'Noto Sans', sans-serif;
	/* Break out of the theme's centered ~1100px content container to a
	   near-full-width layout matching the tracking dashboard (80px gutter
	   each side). Centers on the viewport. */
	width: calc(100vw - 160px);
	position: relative;
	left: 50%;
	transform: translateX(-50%);
}

@media screen and (max-width: 768px) {
	/* Narrower gutter on small screens so the content isn't over-squeezed. */
	.ici-manage-users-wrapper {
		width: calc(100vw - 40px);
	}
}

.ici-manage-users-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 12px;
}

.ici-manage-users-search {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.ici-manage-users-search input[type='text'] {
	padding: 9px 12px;
	border: 1px solid #ddd;
	font-size: 14px;
	min-width: 240px;
}

.ici-manage-users-count {
	color: #666;
	font-size: 14px;
	margin: 0 0 10px 0;
}

.ici-users-table .ici-users-actions {
	white-space: nowrap;
	display: flex;
	gap: 10px;
	align-items: center;
}

@media screen and (max-width: 600px) {
	.ici-auth-form {
		padding: 24px 20px;
	}

	.ici-account-section {
		padding: 20px 16px;
	}

	.ici-auth-wrapper,
	.ici-account-wrapper {
		margin: 20px 0;
	}
}

/* Watchlist panel on tracking dashboard */
.ici-watchlist-panel {
	display: flex;
	gap: 2rem;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 1rem 1.25rem;
	margin-bottom: 6rem;
	align-items: flex-start;
}

.ici-watchlist-panel-title {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #000066;
	margin: 0 0 0.5rem;
}

.ici-watchlist-list-col {
	flex: 0 0 200px;
}

.ici-watchlist-panel-list {
	max-height: 180px;
	overflow-y: auto;
	border: 1px solid #ccc;
	border-radius: 3px;
	padding: 0.25rem;
}

.ici-watchlist-add-col {
	flex: 1;
}

@media (max-width: 600px) {
	.ici-watchlist-panel {
		flex-direction: column;
		gap: 1.25rem;
		margin-bottom: 2rem;
	}
	.ici-watchlist-list-col {
		flex: none;
		width: 100%;
	}
	/* Stack the add-container input and button full-width on mobile. */
	.ici-watchlist-input-row {
		flex-direction: column;
	}
	.ici-watchlist-input-row input[type='text'],
	.ici-watchlist-input-row .ici-btn-primary {
		width: 100%;
		box-sizing: border-box;
	}
	/* Larger tap target for the "×" remove button on touch screens. */
	.ici-btn-danger-sm {
		padding: 6px 12px;
		font-size: 14px;
	}
}
