/* ==========================================================
   Email Migration Hub - WHMCS Client Area Custom Branding
   Template: Twenty-One (Bootstrap 4)
   Matches emailmigrationhub.com design system
   ========================================================== */

/* ---- Google Font Import ---- */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables (EMH Design Tokens) ---- */
:root {
    --emh-bg: #f3f6fb;
    --emh-ink: #0d1b2a;
    --emh-muted: #5d6b7d;
    --emh-line: #dce5f0;
    --emh-card: #ffffff;
    --emh-accent: #0f766e;
    --emh-accent-dark: #065f46;
    --emh-accent-2: #1f6feb;
    --emh-danger: #b42318;
    --emh-ok: #0c9f6f;
    --emh-hero-start: #0f172a;
    --emh-hero-end: #11304f;
    --emh-radius: 16px;
    --emh-radius-sm: 10px;
    --emh-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --emh-shadow-lg: 0 4px 24px rgba(0,0,0,0.08);

    /* Override Bootstrap 4 theme variables */
    --primary: #0f766e;
    --success: #0c9f6f;
    --info: #1f6feb;
    --danger: #b42318;
}

/* ---- Global Typography ---- */
body,
html {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 600;
    color: var(--emh-ink);
}

/* ---- Page Background ---- */
.primary-bg-color {
    background-color: var(--emh-bg) !important;
}

/* Subtle radial gradients like EMH website */
body.primary-bg-color::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 15% 20%, rgba(15,118,110,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 80%, rgba(31,111,235,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ---- Links ---- */
a {
    color: var(--emh-accent);
    transition: color 0.2s ease;
}
a:hover,
a:focus {
    color: var(--emh-accent-dark);
    text-decoration: none;
}

/* ---- Back to Website Banner ---- */
.emh-back-banner {
    background: var(--emh-hero-start);
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.emh-back-banner .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.emh-back-banner a {
    color: rgba(255,255,255,0.7) !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.2s;
}
.emh-back-banner a:hover {
    color: #fff !important;
}
.emh-back-banner .emh-portal-label {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* ---- Header ---- */
header.header {
    background: linear-gradient(135deg, var(--emh-hero-start) 0%, var(--emh-hero-end) 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Top bar (logged in user bar) */
header.header .topbar {
    background-color: rgba(0,0,0,0.2) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
header.header .topbar .btn {
    color: rgba(255,255,255,0.7) !important;
}
header.header .topbar .btn:hover {
    color: #fff !important;
}
header.header .topbar .active-client .input-group-text {
    color: rgba(255,255,255,0.6) !important;
}
header.header .topbar .active-client .btn {
    color: rgba(255,255,255,0.75) !important;
}
header.header .topbar .active-client .btn.btn-active-client span {
    border-bottom-color: rgba(255,255,255,0.4) !important;
}

/* Navbar brand / logo */
header.header .navbar {
    padding: 12px 0;
}
header.header .navbar-brand {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff !important;
    letter-spacing: -0.02em;
}
header.header .navbar a {
    color: rgba(255,255,255,0.85) !important;
}
header.header .navbar a:hover {
    color: #fff !important;
}
header.header .logo-img {
    max-height: 50px;
    filter: brightness(0) invert(1);
}

/* EMH custom branded logo */
.emh-logo-link {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    color: #fff !important;
}
.emh-logo-link:hover {
    color: #fff !important;
    text-decoration: none !important;
}
.emh-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--emh-accent), var(--emh-accent-2));
    border-radius: 10px;
    font-size: 18px;
    color: #fff;
}
.emh-logo-wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.35em;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.emh-logo-wordmark small {
    display: block;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    font-size: 0.45em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Search bar in header */
header.header .search {
    border-color: rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.08);
    border-radius: var(--emh-radius-sm);
}
header.header .search .form-control {
    background: transparent !important;
    color: #fff !important;
}
header.header .search .form-control::placeholder {
    color: rgba(255,255,255,0.4);
}
header.header .search .btn {
    color: rgba(255,255,255,0.5) !important;
}
header.header .search:focus-within {
    border-color: rgba(255,255,255,0.3) !important;
    background: rgba(255,255,255,0.12);
}

/* Toolbar icons (cart, menu) */
header.header .toolbar .nav-link {
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.75) !important;
    border-radius: var(--emh-radius-sm) !important;
}
header.header .toolbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.1);
}
header.header .toolbar .nav-link .badge {
    background-color: var(--emh-accent) !important;
}

/* Main navigation wrapper */
header.header .main-navbar-wrapper {
    background: rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.06);
}
header.header .main-navbar-wrapper .navbar-collapse {
    padding: 0 1rem;
}
header.header .navbar-nav a {
    color: rgba(255,255,255,0.8) !important;
    font-weight: 500;
    font-size: 14px !important;
    padding: 10px 14px !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}
header.header .navbar-nav a:hover,
header.header .navbar-nav a:focus {
    color: #fff !important;
    background: rgba(255,255,255,0.08);
}
header.header .navbar-nav .nav-item.active > a {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
}

/* Dropdown menus */
header.header .dropdown-menu {
    border-radius: var(--emh-radius-sm) !important;
    border: 1px solid var(--emh-line) !important;
    box-shadow: var(--emh-shadow-lg) !important;
    padding: 8px 0;
    margin-top: 4px !important;
    background: var(--emh-card);
}
header.header .dropdown-menu .dropdown-item {
    color: var(--emh-ink) !important;
    padding: 8px 18px;
    font-size: 13px;
    transition: all 0.15s;
}
header.header .dropdown-menu .dropdown-item:hover,
header.header .dropdown-menu .dropdown-item:focus {
    background: var(--emh-bg) !important;
    color: var(--emh-accent) !important;
}
header.header .dropdown-item.active,
header.header .dropdown-item:active {
    background: var(--emh-accent) !important;
    color: #fff !important;
}

/* Return to admin button */
.btn-return-to-admin {
    background: rgba(255,255,255,0.12) !important;
    color: rgba(255,255,255,0.8) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 8px !important;
}
.btn-return-to-admin:hover {
    background: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

/* ---- Breadcrumb ---- */
.master-breadcrumb {
    background-color: var(--emh-card) !important;
    border-bottom: 1px solid var(--emh-line);
}
.master-breadcrumb .breadcrumb {
    background: transparent;
    font-size: 0.85rem;
}
.master-breadcrumb .breadcrumb-item a {
    color: var(--emh-accent) !important;
}
.master-breadcrumb .breadcrumb-item.active {
    color: var(--emh-muted);
}

/* ---- Main Body ---- */
section#main-body {
    padding: 30px 0 !important;
}

/* ---- Cards (Bootstrap 4) ---- */
.card,
.mc-promo-manage,
.mc-promo-login {
    border-radius: var(--emh-radius) !important;
    border: 1px solid var(--emh-line) !important;
    box-shadow: var(--emh-shadow) !important;
    overflow: hidden;
    background: var(--emh-card);
}

.card-header {
    background: var(--emh-card) !important;
    border-bottom: 1px solid var(--emh-line) !important;
    font-weight: 600;
    padding: 16px 20px;
}

.card-footer {
    background: var(--emh-bg) !important;
    border-top: 1px solid var(--emh-line) !important;
}

.card-body,
.mc-promo-manage .content,
.mc-promo-login .content {
    padding: 20px;
}

.primary-content .card-title,
.primary-content .mc-promo-manage .panel-heading h3,
.primary-content .mc-promo-login .panel-heading h3 {
    color: var(--emh-ink);
    font-weight: 700;
}

/* ---- Buttons ---- */
.btn {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 600;
    border-radius: var(--emh-radius-sm) !important;
    padding: 8px 20px;
    transition: all 0.2s ease;
    font-size: 14px;
    letter-spacing: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emh-accent-dark), var(--emh-accent)) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(15,118,110,0.2);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-primary:not(:disabled):not(.disabled):active,
.show > .btn-primary.dropdown-toggle {
    background: linear-gradient(135deg, #054d38, var(--emh-accent-dark)) !important;
    border: none !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15,118,110,0.3) !important;
}
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:not(:disabled):not(.disabled):active:focus {
    box-shadow: 0 0 0 3px rgba(15,118,110,0.2) !important;
}

.btn-success {
    background: linear-gradient(135deg, var(--emh-accent-dark), var(--emh-ok)) !important;
    border: none !important;
    color: #fff !important;
}
.btn-success:hover,
.btn-success:focus {
    background: linear-gradient(135deg, #054d38, var(--emh-accent-dark)) !important;
}

.btn-info {
    background: linear-gradient(135deg, #1a5bbf, var(--emh-accent-2)) !important;
    border: none !important;
    color: #fff !important;
}
.btn-info:hover,
.btn-info:focus {
    background: linear-gradient(135deg, #144da0, #1a5bbf) !important;
}

.btn-secondary,
.btn-default {
    background: var(--emh-card) !important;
    border: 1px solid var(--emh-line) !important;
    color: var(--emh-ink) !important;
}
.btn-secondary:hover,
.btn-secondary:focus,
.btn-default:hover,
.btn-default:focus {
    background: var(--emh-bg) !important;
    border-color: var(--emh-accent) !important;
    color: var(--emh-accent) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #8b1a12, var(--emh-danger)) !important;
    border: none !important;
    color: #fff !important;
}

.btn-warning {
    background: linear-gradient(135deg, #c27803, #d97706) !important;
    border: none !important;
    color: #fff !important;
}

.btn-outline-primary {
    color: var(--emh-accent) !important;
    border-color: var(--emh-accent) !important;
    background: transparent !important;
}
.btn-outline-primary:hover {
    background: var(--emh-accent) !important;
    color: #fff !important;
}

/* Button groups */
.btn-group .btn:first-child {
    border-radius: var(--emh-radius-sm) 0 0 var(--emh-radius-sm) !important;
}
.btn-group .btn:last-child {
    border-radius: 0 var(--emh-radius-sm) var(--emh-radius-sm) 0 !important;
}

/* ---- Forms ---- */
.form-control {
    border-radius: var(--emh-radius-sm) !important;
    border: 1px solid var(--emh-line) !important;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--emh-ink);
    background: var(--emh-card);
}
.form-control:focus {
    border-color: var(--emh-accent) !important;
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12) !important;
    outline: none;
}

.custom-select {
    border-radius: var(--emh-radius-sm) !important;
    border-color: var(--emh-line) !important;
}
.custom-select:focus {
    border-color: var(--emh-accent) !important;
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12) !important;
}

.input-group-prepend .btn,
.input-group-append .btn {
    border-radius: 0 !important;
}
.input-group > .form-control:first-child {
    border-radius: var(--emh-radius-sm) 0 0 var(--emh-radius-sm) !important;
}
.input-group > .form-control:last-child,
.input-group > .input-group-append > .btn {
    border-radius: 0 var(--emh-radius-sm) var(--emh-radius-sm) 0 !important;
}

/* ---- Tables ---- */
.table thead th {
    background: var(--emh-bg) !important;
    border-bottom: 2px solid var(--emh-line) !important;
    color: var(--emh-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
}
.table td {
    border-top-color: var(--emh-line) !important;
    padding: 12px 16px;
    vertical-align: middle;
}
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(243,246,251,0.5) !important;
}
.table tbody tr:hover {
    background-color: rgba(15,118,110,0.03) !important;
}

/* ---- Sidebar ---- */
.sidebar .list-group-item {
    border-color: var(--emh-line) !important;
    color: var(--emh-ink);
    padding: 10px 16px;
    font-size: 14px;
    transition: all 0.15s;
}
.sidebar .list-group-item:first-child {
    border-radius: var(--emh-radius-sm) var(--emh-radius-sm) 0 0 !important;
}
.sidebar .list-group-item:last-child {
    border-radius: 0 0 var(--emh-radius-sm) var(--emh-radius-sm) !important;
}
.sidebar .list-group-item.active,
.sidebar .list-group-item.active:hover {
    background: linear-gradient(135deg, var(--emh-accent-dark), var(--emh-accent)) !important;
    border-color: var(--emh-accent) !important;
    color: #fff !important;
}
.sidebar .list-group-item:hover:not(.active) {
    background: var(--emh-bg);
    color: var(--emh-accent);
}
.sidebar .list-group .badge {
    background: var(--emh-accent) !important;
    border-radius: 8px;
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--emh-radius-sm) !important;
    border: none !important;
    font-size: 14px;
}
.alert-success {
    background: rgba(12,159,111,0.1) !important;
    color: #065f46 !important;
    border-left: 4px solid var(--emh-ok) !important;
}
.alert-info {
    background: rgba(31,111,235,0.08) !important;
    color: #1a4b8f !important;
    border-left: 4px solid var(--emh-accent-2) !important;
}
.alert-warning {
    background: rgba(217,119,6,0.1) !important;
    color: #92400e !important;
    border-left: 4px solid #d97706 !important;
}
.alert-danger {
    background: rgba(180,35,24,0.08) !important;
    color: var(--emh-danger) !important;
    border-left: 4px solid var(--emh-danger) !important;
}

/* ---- Badges ---- */
.badge-primary {
    background: var(--emh-accent) !important;
}
.badge-success {
    background: var(--emh-ok) !important;
}
.badge-info {
    background: var(--emh-accent-2) !important;
}
.badge-danger {
    background: var(--emh-danger) !important;
}
.badge-warning {
    background: #d97706 !important;
    color: #fff !important;
}

.label {
    border-radius: 6px;
    font-weight: 600;
}
.label-primary { background-color: var(--emh-accent) !important; }
.label-success { background-color: var(--emh-ok) !important; }
.label-info { background-color: var(--emh-accent-2) !important; }
.label-danger { background-color: var(--emh-danger) !important; }

/* ---- Login Page ---- */
.logincontainer,
.card.mw-540 {
    border-radius: var(--emh-radius) !important;
    box-shadow: var(--emh-shadow-lg) !important;
    border: 1px solid var(--emh-line) !important;
}

/* ---- Modal Dialogs ---- */
.modal-content {
    border-radius: var(--emh-radius) !important;
    border: none !important;
    box-shadow: var(--emh-shadow-lg) !important;
    overflow: hidden;
}
.modal-header {
    background: linear-gradient(135deg, var(--emh-hero-start), var(--emh-hero-end)) !important;
    border-bottom: none !important;
    color: #fff;
    padding: 16px 20px;
}
.modal-header .close {
    color: #fff;
    opacity: 0.7;
    text-shadow: none;
}
.modal-header .modal-title,
.modal-header .h5 {
    font-weight: 700;
    color: #fff;
}
.modal-footer {
    background: var(--emh-bg);
    border-top: 1px solid var(--emh-line);
}

/* Language/currency modal */
.modal-localisation .modal-body {
    background: linear-gradient(135deg, var(--emh-hero-start), var(--emh-hero-end));
    color: #fff;
}
.modal-localisation .item-selector .item {
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    transition: all 0.15s;
}
.modal-localisation .item-selector .item:hover {
    border-color: var(--emh-accent);
    background: rgba(15,118,110,0.2);
}
.modal-localisation .item-selector .item.active {
    background: var(--emh-accent);
    border-color: var(--emh-accent);
    color: #fff;
}

/* ---- Pagination ---- */
.page-item .page-link {
    color: var(--emh-accent);
    border-color: var(--emh-line);
}
.page-item.active .page-link {
    background: var(--emh-accent) !important;
    border-color: var(--emh-accent) !important;
    color: #fff;
}
.page-item:first-child .page-link {
    border-radius: 8px 0 0 8px;
}
.page-item:last-child .page-link {
    border-radius: 0 8px 8px 0;
}

/* ---- Tabs ---- */
.nav-tabs {
    border-bottom-color: var(--emh-line);
}
.nav-tabs .nav-link {
    border-radius: var(--emh-radius-sm) var(--emh-radius-sm) 0 0 !important;
    color: var(--emh-muted);
    font-weight: 500;
}
.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--emh-accent);
    background: transparent;
}
.nav-tabs .nav-link.active {
    border-color: var(--emh-line) var(--emh-line) #fff !important;
    color: var(--emh-accent) !important;
    font-weight: 600;
}

/* ---- Progress Bars ---- */
.progress {
    border-radius: 8px;
    background: var(--emh-bg);
    height: 8px;
    box-shadow: none;
}
.progress-bar {
    background: linear-gradient(90deg, var(--emh-accent-dark), var(--emh-accent)) !important;
    border-radius: 8px;
}
.progress-bar.bg-info {
    background: linear-gradient(90deg, #1a5bbf, var(--emh-accent-2)) !important;
}
.progress-bar.bg-success {
    background: linear-gradient(90deg, #065f46, var(--emh-ok)) !important;
}
.progress-bar.bg-danger {
    background: linear-gradient(90deg, #8b1a12, var(--emh-danger)) !important;
}

/* ---- Footer ---- */
footer#footer,
footer.footer {
    background: linear-gradient(135deg, var(--emh-hero-start) 0%, var(--emh-hero-end) 100%) !important;
    border-top: none !important;
    color: rgba(255,255,255,0.6) !important;
    padding: 28px 0 !important;
}
footer#footer p,
footer.footer p,
footer.footer .copyright {
    color: rgba(255,255,255,0.45) !important;
    font-size: 13px;
}
footer#footer a,
footer.footer a,
footer.footer .nav-link,
footer.footer .btn {
    color: rgba(255,255,255,0.65) !important;
}
footer#footer a:hover,
footer.footer a:hover,
footer.footer .nav-link:hover,
footer.footer .btn:hover {
    color: #fff !important;
}
footer.footer .list-inline-item .btn {
    border: none !important;
}

/* ---- Well / Background areas ---- */
.bg-light,
.jumbotron {
    background: var(--emh-bg) !important;
    border-radius: var(--emh-radius-sm);
}

/* ---- Domain Search (homepage) ---- */
.domain-search-container,
.domain-checker-container {
    background: linear-gradient(135deg, var(--emh-hero-start) 0%, var(--emh-hero-end) 100%) !important;
    position: relative;
}
.domain-search-container::before,
.domain-checker-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(15,118,110,0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(31,111,235,0.1) 0%, transparent 60%);
    pointer-events: none;
}

/* ---- Notification popovers ---- */
.popover {
    border-radius: var(--emh-radius-sm) !important;
    border: 1px solid var(--emh-line) !important;
    box-shadow: var(--emh-shadow-lg) !important;
}

/* Client alerts in notifications */
.client-alerts li a {
    color: var(--emh-ink) !important;
    padding: 8px 12px;
    display: block;
}
.client-alerts li a:hover {
    background: var(--emh-bg) !important;
}

/* ---- Header-Lined (page titles) ---- */
.header-lined {
    border-bottom-color: var(--emh-line) !important;
}
.header-lined h1 {
    color: var(--emh-ink) !important;
    font-weight: 700;
}

/* ---- Tooltip ---- */
.tooltip-inner {
    border-radius: 8px;
    font-size: 12px;
    padding: 6px 12px;
    background: var(--emh-hero-start);
}

/* ---- Custom scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--emh-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--emh-line);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--emh-muted);
}

/* ---- Shopping Cart ---- */
.order-summary,
.order-summary-card {
    border-radius: var(--emh-radius) !important;
    border: 1px solid var(--emh-line) !important;
    box-shadow: var(--emh-shadow) !important;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
    .emh-back-banner {
        font-size: 12px;
        padding: 6px 0;
    }
    .emh-logo-wordmark {
        font-size: 1.15em;
    }
    header.header .navbar {
        padding: 8px 0;
    }
    header.header .navbar-nav a {
        padding: 8px 14px !important;
    }
}

@media (max-width: 575px) {
    .emh-back-banner .emh-portal-label {
        display: none;
    }
}

/* ---- Registration / Checkout Form Fix ---- */
.main-content .form-group .form-control,
.main-content .field input.form-control,
.main-content input.form-control,
.main-content select.form-control {
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px;
}

.main-content .row .col-sm-6,
.main-content .row .col-md-6,
.main-content .row .col-lg-6 {
    min-width: 0;
}

/* Fix input group squashing */
.input-group {
    flex-wrap: nowrap !important;
}
.input-group .form-control {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

/* Fix phone field */
.iti {
    width: 100% !important;
}
.iti .form-control {
    width: 100% !important;
}

/* Fix checkout/registration containers */
#order-standard_cart .field,
.order-form .field {
    width: 100% !important;
    overflow: visible !important;
}

/* Fix billing address fields */
.sub-heading + .row .col-sm-6 .form-control,
.sub-heading + .row .col-sm-4 .form-control,
.sub-heading + .row .col-md-6 .form-control {
    width: 100% !important;
}

/* ---- Fix hidden/collapsed form fields on checkout ---- */
.main-content .row,
#containerNewUserSignup .row,
#containerNewUserSecurity .row,
#domainContactDetails .row,
form .row {
    overflow: visible !important;
    display: flex !important;
    flex-wrap: wrap !important;
}

.main-content .row > [class*="col-"],
form .row > [class*="col-"] {
    overflow: visible !important;
    visibility: visible !important;
    display: block !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
    padding-bottom: 10px;
}

/* Ensure all form groups are visible */
.form-group {
    overflow: visible !important;
    display: block !important;
    margin-bottom: 15px !important;
}

/* Fix any collapsed containers */
#newUserFields,
#containerNewUserSignup,
.checkout-container,
.order-form,
#orderSummary {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Fix phone input container */
.iti--allow-dropdown {
    width: 100% !important;
}

/* Ensure labels show */
.form-group label {
    display: block !important;
    visibility: visible !important;
}

/* ---- Fix w-hidden class hiding fields ---- */
#containerNewUserSignup .w-hidden,
#frmCheckout .w-hidden {
    display: none !important;
}

/* But make sure NON w-hidden col-sm-12 are visible */
#containerNewUserSignup .row .col-sm-12:not(.w-hidden),
#containerNewUserSignup .row .col-sm-4:not(.w-hidden),
#containerNewUserSignup .row .col-sm-5:not(.w-hidden),
#containerNewUserSignup .row .col-sm-3:not(.w-hidden) {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 44px !important;
    overflow: visible !important;
    opacity: 1 !important;
}

/* Fix zero-height divs in the address row */
#containerNewUserSignup .row > div {
    min-height: auto;
}

#containerNewUserSignup .row > div:has(input),
#containerNewUserSignup .row > div:has(select) {
    min-height: 44px !important;
    padding-bottom: 10px !important;
}

/* Force the address/city/postcode row to display properly */
#containerNewUserSignup .row .col-sm-4,
#containerNewUserSignup .row .col-sm-5,
#containerNewUserSignup .row .col-sm-3 {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 30% !important;
}
