/* ==========================================================================
   ATH AGENT PORTAL - DUAL MOBILE VIEW TUNING (PORTRAIT & LANDSCAPE)
   ========================================================================== */

@media (max-width: 768px) {
	/* DESKTOP HIDE / MOBILE SHOW */
	.ath-history-desktop-table { display: none !important; }
	.ath-history-mobile-cards { display: flex !important; flex-direction: column; gap: 10px; }

	/* BASE BACKDROP WITH SAFE AREA SUPPORT */
	#modal_agent_telemetry_backdrop {
		padding: 8px !important;
		align-items: flex-end; /* Native bottom sheet feel */
	}

	.ath-telemetry-container {
		width: 100% !important;
		max-height: 92vh !important;
		border-radius: 18px 18px 10px 10px !important;
		display: flex;
		flex-direction: column;
	}

	/* 1. PORTRAIT VIEW TUNING */
	.ath-modal-head {
		padding: 12px 16px !important;
	}
	.ath-modal-head h3 {
		font-size: 14.5px !important;
	}
	.ath-modal-head span {
		font-size: 10.5px !important;
	}

	.ath-modal-body {
		padding: 10px 12px !important;
		-webkit-overflow-scrolling: touch;
	}

	/* Compact Card Structure */
	.ath-card-item {
		background: #ffffff;
		border: 1px solid #e2e8f0;
		border-radius: 12px;
		padding: 11px 12px;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
		display: flex;
		flex-direction: column;
		gap: 8px;
	}
	.ath-card-header {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 8px;
	}
	.ath-card-title {
		font-size: 13.5px;
		font-weight: 800;
		color: #0f172a;
		line-height: 1.3;
	}
	.ath-card-meta-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px 10px;
		background: #f8fafc;
		border-radius: 7px;
		padding: 7px 9px;
		border: 1px solid #f1f5f9;
	}
	.ath-card-meta-label {
		font-size: 9px;
		font-weight: 800;
		color: #64748b;
		text-transform: uppercase;
		letter-spacing: 0.4px;
	}
	.ath-card-meta-val {
		font-size: 11px;
		font-weight: 700;
		color: #1e293b;
	}

	/* Action Buttons */
	.ath-card-actions-bar {
		display: flex;
		gap: 6px;
	}
	.ath-card-actions-bar button,
	.ath-card-actions-bar a {
		height: 36px;
		border-radius: 7px;
		font-size: 11.5px;
		font-weight: 800;
		touch-action: manipulation;
	}

	/* Footer with iPhone Bottom Notch Safe Padding */
	.ath-modal-foot {
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) 14px !important;
		flex-direction: column !important;
		gap: 6px !important;
		align-items: stretch !important;
	}
	.ath-foot-left {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
	}
	.ath-foot-right {
		display: flex;
		justify-content: center;
		font-size: 10.5px !important;
	}
}

/* 2. LANDSCAPE MODE TUNING (Screen ghumaane par auto-adjust) */
@media (max-width: 920px) and (orientation: landscape), (max-height: 500px) {
	#modal_agent_telemetry_backdrop {
		align-items: center !important;
		padding: 6px !important;
	}
	.ath-telemetry-container {
		max-height: 98vh !important;
		border-radius: 12px !important;
	}

	/* Header & Footer Slim Compression */
	.ath-modal-head {
		padding: 7px 14px !important;
	}
	.ath-modal-body {
		padding: 8px 12px !important;
	}
	.ath-modal-foot {
		padding: 6px 14px !important;
		flex-direction: row !important;
		justify-content: space-between !important;
		align-items: center !important;
	}

	/* 2-Column Cards Grid in Landscape (Double records visible) */
	.ath-history-mobile-cards {
		display: grid !important;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}
	.ath-card-item {
		padding: 9px 10px;
		gap: 6px;
	}
	.ath-card-actions-bar button,
	.ath-card-actions-bar a {
		height: 32px;
		font-size: 11px;
	}
}