/**
 * Mobile Responsiveness Overrides - SurvivalServers.com
 * Created: 2025-11-26
 *
 * This file contains global mobile fixes that apply site-wide.
 * Organized by section per MOBILE-RESPONSIVENESS-PLAN.md
 */

/* ==========================================================================
   1.1 Global Fixes (overflow, images)
   ========================================================================== */
@media only screen and (max-width: 767px) {
	html, body {
		overflow-x: hidden;
	}

	img {
		max-width: 100%;
		height: auto;
	}
}

/* ==========================================================================
   1.2 Container Width Overrides
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.container {
		width: 100%;
		padding-left: 15px;
		padding-right: 15px;
	}
}

/* ==========================================================================
   1.3 Form Horizontal -> Stacked
   Handles form-horizontal across all files via CSS
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.form-horizontal .control-label {
		text-align: left;
		margin-bottom: 5px;
		padding-top: 0;
	}

	.form-horizontal .form-group {
		margin-left: 0;
		margin-right: 0;
	}

	.form-horizontal .col-sm-1,
	.form-horizontal .col-sm-2,
	.form-horizontal .col-sm-3,
	.form-horizontal .col-sm-4,
	.form-horizontal .col-sm-5,
	.form-horizontal .col-sm-6,
	.form-horizontal .col-sm-7,
	.form-horizontal .col-sm-8,
	.form-horizontal .col-sm-9,
	.form-horizontal .col-sm-10,
	.form-horizontal .col-sm-11,
	.form-horizontal .col-sm-12 {
		width: 100%;
		float: none;
		padding-left: 15px;
		padding-right: 15px;
	}
}

/* ==========================================================================
   1.4 Select Dropdown Height Fix
   ========================================================================== */
@media only screen and (max-width: 767px) {
	select[size],
	select[multiple] {
		height: auto;
		max-height: 200px;
	}

	select.form-control {
		height: auto;
		min-height: 34px;
	}
}

/* ==========================================================================
   1.5 Grid Column Fallbacks (col-xs-12 via CSS)
   Makes columns stack on mobile when col-xs-* is missing
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
	.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
	.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
	.col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
		width: 100%;
		float: none;
	}

	/* Preserve explicit col-xs-* classes */
	.col-xs-1 { width: 8.33333333%; }
	.col-xs-2 { width: 16.66666667%; }
	.col-xs-3 { width: 25%; }
	.col-xs-4 { width: 33.33333333%; }
	.col-xs-5 { width: 41.66666667%; }
	.col-xs-6 { width: 50%; }
	.col-xs-7 { width: 58.33333333%; }
	.col-xs-8 { width: 66.66666667%; }
	.col-xs-9 { width: 75%; }
	.col-xs-10 { width: 83.33333333%; }
	.col-xs-11 { width: 91.66666667%; }
	.col-xs-12 { width: 100%; }
}

/* ==========================================================================
   1.6 Table Responsive Scrolling
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.table-responsive {
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Make all tables in panels scrollable */
	.panel-body > table,
	.panel > table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* ==========================================================================
   1.7 Button Stacking & Touch Targets
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.btn-group-xs,
	.btn-group-sm {
		display: flex;
		flex-wrap: wrap;
		gap: 5px;
	}

	.btn-group-xs .btn,
	.btn-group-sm .btn {
		min-height: 44px;
		min-width: 44px;
	}

	/* Stack buttons in panel headers */
	.panel-heading .btn-group {
		margin-top: 10px;
		display: block;
	}

	/* Text-right buttons should center on mobile */
	.text-right .btn-group,
	.text-right .btn {
		text-align: center;
	}
}

/* ==========================================================================
   1.8 Header/Navigation Fixes
   Fixes logo and hamburger menu side-by-side on mobile
   ========================================================================== */

/* Touch device dropdown support - show dropdown when .open class is added via JS */
#topNav ul.nav>li.dropdown.open>ul.dropdown-menu,
#topNav ul.nav>li.mega-menu.open>ul.dropdown-menu {
	display: block;
	opacity: 1;
	visibility: visible;
}

/* Mobile-only and Desktop-only helper classes */
.show_mobile_only {
	display: none !important;
}

#topMain li.show_mobile_only {
	display: none !important;
}

@media only screen and (max-width: 990px) {
	.show_mobile_only {
		display: block !important;
	}

	.hide_mobile {
		display: none !important;
	}

	/* Mobile Top Bar Styling */
	#mobileTopBar {
		background-color: #111;
		padding: 8px 0;
		border-bottom: 1px solid rgba(255,255,255,0.1);
	}

	#mobileTopBar .container {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
	}

	#mobileTopBar .mobile-user-area {
		display: flex;
		align-items: center;
		gap: 8px;
		color: #fff;
		font-size: 12px;
	}

	#mobileTopBar .mobile-user-area img {
		border-radius: 50%;
	}

	#mobileTopBar .mobile-user-area .btn {
		padding: 2px 8px;
		font-size: 11px;
	}

	#mobileTopBar .mobile-promo-area {
		flex: 1;
		text-align: center;
	}

	#mobileTopBar .mobile-promo-area a {
		text-decoration: none;
	}

	#mobileTopBar .mobile-promo-area .promo-text {
		background: linear-gradient(90deg, #ff6b35, #f7931e);
		color: #fff;
		padding: 4px 12px;
		border-radius: 3px;
		font-size: 11px;
		font-weight: bold;
		display: inline-block;
	}

	/* Show Contact Us in mobile menu */
	#topMain li.show_mobile_only {
		display: block !important;
	}

	#topNav .container {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
		padding: 0 15px;
	}

	#topNav a.logo {
		flex: 0 0 auto;
		margin: 5px 0;
	}

	#topNav a.logo img {
		max-height: 40px;
		width: auto;
	}

	#topNav button.btn-mobile {
		flex: 0 0 auto;
		margin: 5px 0;
		float: none;
	}

	#topNav div.nav-main-collapse {
		flex: 0 0 100%;
		width: 100%;
		margin-top: 0 !important;
	}

	/* Remove gap between header and menu items */
	#topNav div.nav-main-collapse.in {
		margin-top: 0 !important;
	}

	/* Hide caret arrows for menu items without real submenus */
	#topNav ul.nav>li.dropdown>a:after {
		content: "\f107";
		font-family: FontAwesome;
	}

	/* Hide caret for items that don't have dropdown-menu children */
	#topNav ul.nav>li.dropdown:not(.mega-menu):not(:has(ul.dropdown-menu))>a:after,
	#topNav ul.nav>li.no-submenu>a:after {
		display: none !important;
	}

	/* Fix mega-menu game list - remove gaps between columns */
	#topNav ul.nav>li.mega-menu>ul.dropdown-menu>li {
		padding: 0;
		margin: 0;
		border: none;
		box-shadow: none;
	}

	#topNav ul.nav>li.mega-menu>ul.dropdown-menu>li>div.row {
		margin: 0;
	}

	#topNav ul.nav>li.mega-menu>ul.dropdown-menu>li>div.row>div {
		padding: 0;
		border: none;
		margin: 0;
	}

	#topNav ul.nav>li.mega-menu>ul.dropdown-menu ul {
		margin: 0;
		padding: 0;
	}

	#topNav ul.nav>li.mega-menu>ul.dropdown-menu ul li a {
		padding: 8px 15px;
		border-bottom: 1px solid rgba(255,255,255,0.1);
		position: relative;
		padding-right: 70px;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	/* Fix NEW/badge labels bleeding off screen on mobile */
	#topNav .dropdown-menu .label,
	#topNav .dropdown-menu .label.pull-right,
	#topNav ul.nav>li.mega-menu>ul.dropdown-menu ul li a .label,
	#topNav .mega-menu .label {
		position: absolute !important;
		right: 8px !important;
		top: 50% !important;
		transform: translateY(-50%) !important;
		float: none !important;
		font-size: 8px !important;
		padding: 2px 4px !important;
		max-width: 55px !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		white-space: nowrap !important;
	}

	/* Mobile dropdown arrow styling - larger click target */
	#topNav ul.nav>li>a:after {
		cursor: pointer;
		padding: 10px 15px;
		margin: -10px -15px;
	}
}

/* Override the 479px breakpoint that stacks logo */
@media only screen and (max-width: 479px) {
	#topNav .container {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
	}

	#topNav a.logo {
		display: block;
		float: none;
		text-align: left;
		margin: 5px 0;
	}
}

/* ==========================================================================
   1.9 Footer Column Stacking
   ========================================================================== */
@media only screen and (max-width: 767px) {
	footer .col-md-2,
	footer .col-md-3,
	footer .col-md-4,
	footer .col-md-6 {
		width: 100%;
		text-align: center;
		margin-bottom: 20px;
	}

	footer .col-md-2:last-child,
	footer .col-md-3:last-child,
	footer .col-md-4:last-child,
	footer .col-md-6:last-child {
		margin-bottom: 0;
	}

	footer ul {
		padding-left: 0;
		list-style: none;
	}
}

/* ==========================================================================
   1.10 Modal Sizing
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.modal-dialog {
		width: 95%;
		margin: 10px auto;
	}

	.modal-lg {
		width: 95%;
	}

	.modal-body {
		max-height: 70vh;
		overflow-y: auto;
	}
}

/* ==========================================================================
   1.11 Panel/Card Adjustments
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.panel-heading {
		padding: 10px;
	}

	.panel-heading .row {
		display: block;
	}

	.panel-heading .col-md-7,
	.panel-heading .col-md-5,
	.panel-heading .col-md-8,
	.panel-heading .col-md-4 {
		width: 100%;
		text-align: center !important;
		margin-bottom: 10px;
	}

	.panel-title {
		font-size: 14px;
	}
}

/* ==========================================================================
   1.12 Parallax Performance Fix
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.parallax,
	[data-stellar-background-ratio] {
		background-attachment: scroll !important;
		background-position: center center !important;
	}
}

/* ==========================================================================
   1.13 Timeline Stacking
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.timeline-center:after,
	.timeline-left:after {
		left: 20px;
	}

	.timeline .item {
		width: 100%;
		padding-left: 50px;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}
}

/* ==========================================================================
   1.14 Pricing Cards Flex Fix
   ========================================================================== */
@media only screen and (max-width: 767px) {
	.price-table {
		margin-bottom: 20px;
	}

	.price-table .btn {
		width: 100%;
	}
}

/* ==========================================================================
   Additional Mobile Helpers
   ========================================================================== */
@media only screen and (max-width: 767px) {
	/* Hide desktop-only elements */
	.hide-mobile {
		display: none !important;
	}

	/* Show mobile-only elements */
	.show-mobile {
		display: block !important;
	}

	/* Full width on mobile */
	.mobile-full-width {
		width: 100% !important;
	}

	/* Center text on mobile */
	.mobile-text-center {
		text-align: center !important;
	}
}
