/* ============================================================
   CimaServer Domain Search - Premium Overrides
   Applied on top of standard_cart HTML structure
   ============================================================ */

/* --- Hero Wrapper --- */
.cima-domain-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border-radius: 20px;
    padding: 50px 30px 40px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cima-domain-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(13,148,136,0.15) 0%, transparent 60%);
    pointer-events: none;
}
.cima-domain-title {
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
    position: relative;
}
.cima-domain-title i {
    opacity: 0.8;
    margin-right: 10px;
}
.cima-domain-subtitle {
    font-size: 18px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 35px;
    position: relative;
}

/* --- Search Bar inside hero --- */
.cima-domain-hero .domain-checker-container {
    margin-bottom: 0;
}
.cima-domain-hero .domain-checker-bg {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.cima-domain-hero .input-group-box {
    background: #ffffff;
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border: none;
}
.cima-domain-hero .input-group-box .form-control {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 18px;
    font-weight: 500;
    color: #0f172a;
    padding: 14px 20px;
    height: auto;
}
.cima-domain-hero .input-group-box .form-control::placeholder {
    color: #94a3b8;
}
.cima-domain-hero .input-group-box .form-control:focus {
    outline: none;
    box-shadow: none !important;
}
.cima-domain-hero #btnCheckAvailability {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 14px 36px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-transform: none;
    letter-spacing: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cima-domain-hero #btnCheckAvailability:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(13,148,136,0.4);
}

/* --- Featured TLDs inside hero --- */
.cima-featured-tlds {
    margin-top: 30px;
    position: relative;
}
.cima-featured-tlds .featured-tld {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    margin-bottom: 10px;
}
.cima-featured-tlds .featured-tld:hover {
    transform: translateY(-3px);
    border-color: rgba(13,148,136,0.5);
}
.cima-featured-tlds .featured-tld .img-container {
    font-weight: 800;
    color: #ffffff;
    font-size: 22px;
    margin-bottom: 6px;
}
.cima-featured-tlds .featured-tld .price {
    font-size: 12px;
    color: #0d9488;
    background: rgba(13,148,136,0.15);
    border-radius: 20px;
    padding: 4px 12px;
    display: inline-block;
    font-weight: 600;
}

/* --- Search Results Styling --- */
#DomainSearchResults {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid rgba(0,0,0,0.06);
}
/* Neutralize borders/padding on inner containers that can appear as empty grey boxes */
#searchDomainInfo,
#primarySuggestionHeading,
#primaryExactHeading {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}
/* Hide the heading elements — they show broken FontAwesome icons and empty boxes */
#primarySuggestionHeading,
#primaryExactHeading {
    display: none !important;
}
/* The loader row should not have a visible box when hidden */
#primaryLookupSearching.w-hidden {
    display: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}
/* CRITICAL: Do NOT force-hide #primaryLookupResult.w-hidden!
   WHMCS shows results by setting inline display:block WITHOUT removing w-hidden class.
   !important CSS overrides inline styles and kills the entire result area.
   Let WHMCS inline styles manage this element's visibility. */
/* spotlightTlds when hidden should take no space */
#spotlightTlds.w-hidden {
    display: none !important;
}
/* The suggested-domains wrapper when shown should not show spinner text raw */
.suggested-domains .domain-lookup-message {
    display: none;
}

/* Center the primary result area */
.domain-checker-result-headline {
    text-align: center;
}
#primaryLookupResult {
    display: block;
    text-align: center;
}
#primaryLookupResult > p,
#primaryLookupResult > div:not(.transfer-eligible):not(.transfer-not-eligible):not(.domain-invalid):not(#idnLanguageSelector) {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
/* Hide structural state containers by default — WHMCS JS shows them as needed */
#primaryLookupResult .transfer-eligible,
#primaryLookupResult .transfer-not-eligible,
#primaryLookupResult .domain-invalid,
#primaryLookupResult #idnLanguageSelector {
    display: none;
}

/* Available message */
.domain-checker-available {
    color: #059669 !important;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}
.domain-checker-available strong {
    color: #047857;
    font-weight: 800;
    font-size: 22px;
}

/* Unavailable message */
.domain-checker-unavailable {
    color: #ef4444 !important;
    font-size: 18px;
    margin-bottom: 8px;
}
.domain-checker-unavailable strong {
    color: #dc2626;
    font-weight: 700;
    font-size: 20px;
}

/* Price + Add to Cart row — centered */
#primaryLookupResult .domain-price {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-radius: 14px;
    border: 1px solid rgba(13,148,136,0.15);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}
#primaryLookupResult .domain-price .price {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

/* TLD Unavailable message (shown when preferred TLD taken but alternative available) */
.domain-tld-unavailable {
    color: #ef4444 !important;
    font-size: 14px;
    margin-bottom: 4px !important;
}

/* Force-hide utility class - beats #order-standard_cart specificity */
#order-standard_cart .cima-force-hide,
#order-standard_cart p.cima-force-hide,
#order-standard_cart div.cima-force-hide,
.cima-force-hide.cima-force-hide {
    display: none !important;
    visibility: hidden !important;
}

/* CSS Safety Net: hide ghost results when WHMCS shows elements with empty/invalid content.
   MUST use #order-standard_cart prefix because orderform-custom.css has:
   #order-standard_cart .domain-checker-available { display: block !important; }
   which overrides class-only selectors even with !important */

/* Rule 1: Hide "available" message when <strong> is empty (ghost "Felicidades") */
#order-standard_cart .domain-available:has(strong:empty) {
    display: none !important;
}

/* Rule 2: Hide .domain-tld-unavailable when <strong> is empty */
#order-standard_cart .domain-tld-unavailable:has(strong:empty) {
    display: none !important;
}

/* Rule 3: Hide price/cart button when the available message has empty <strong> */
#order-standard_cart .domain-available:has(strong:empty) ~ .domain-price {
    display: none !important;
}

/* Rule 4: Parent-level price hide when available has empty strong */
#order-standard_cart #primaryLookupResult:has(.domain-available strong:empty) .domain-price {
    display: none !important;
}

/* Rule 5: Hide empty .domain-error paragraph (shows as broken icon □ when empty) */
#order-standard_cart .domain-error:empty,
#primaryLookupResult .domain-error:empty,
.domain-error:empty {
    display: none !important;
}

/* Add to Cart button in primary result */
#primaryLookupResult .btn-add-to-cart {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 12px 28px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
#primaryLookupResult .btn-add-to-cart:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 15px rgba(13,148,136,0.35);
}

/* =============================================
   Suggested Domains — limit to 5 visible
   ============================================= */
.suggested-domains {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
    margin-top: 16px;
}
.suggested-domains .panel-heading,
.suggested-domains .card-header {
    background: #0f172a;
    color: #fff;
    border-radius: 0;
    font-weight: 700;
    font-size: 16px;
    padding: 14px 24px;
}
.suggested-domains .list-group-item {
    border-radius: 0;
    padding: 14px 24px;
    border-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.suggested-domains .list-group-item:hover {
    background: #f8fafc;
}
/* Hide the empty template row (WHMCS uses it as a clone source) */
.domain-suggestion:not(.clone) {
    display: none !important;
}
/* Limit to 5 visible suggestions — WHMCS shows 10 by default */
.domain-suggestion.clone:nth-child(n+7) {
    display: none !important;
}
/* "Ver más" footer */
.suggested-domains .more-suggestions {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px;
}
.suggested-domains .more-suggestions a {
    color: #0d9488;
    font-weight: 600;
    text-decoration: none;
}
.suggested-domains .more-suggestions a:hover {
    text-decoration: underline;
}
.suggested-domains .btn-add-to-cart {
    background: linear-gradient(135deg, #0d9488 0%, #115e59 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

/* Spotlight TLDs */
.spotlight-tlds {
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

/* Domain pricing table */
.domain-pricing {
    margin-top: 30px;
}
.tld-pricing-header {
    background: #0f172a;
    color: #fff;
    border-radius: 12px 12px 0 0;
    padding: 12px 0;
    font-weight: 700;
}
.tld-row {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
    transition: background 0.15s;
}
.tld-row:hover {
    background: #f8fafc;
}
.tld-filters .badge {
    background: #e2e8f0 !important;
    color: #334155 !important;
    border-radius: 20px;
    padding: 6px 14px;
    margin: 4px;
    font-weight: 500;
    transition: all 0.2s;
}
.tld-filters .badge:hover,
.tld-filters .badge.active {
    background: #0d9488 !important;
    color: #fff !important;
}

/* Promo boxes */
.domain-promo-box {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    padding: 30px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.06);
}

/* Captcha inside hero */
.cima-domain-hero .captcha-container {
    margin-top: 16px;
}
.cima-domain-hero .default-captcha {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
}
.cima-domain-hero .default-captcha p {
    color: #fff;
    margin-bottom: 8px;
}

/* Hide cart sidebar + force main content to full width — ONLY on domain register page */
#order-standard_cart:has(.cima-domain-hero) .cart-sidebar,
#order-standard_cart:has(.cima-domain-hero) .order-summary {
    display: none !important;
}
/* When sidebar is hidden, the cart-body (col-md-9) must take full width */
#order-standard_cart:has(.cima-domain-hero) .cart-body {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin: 0 auto;
}
/* Also handle if WHMCS wraps it in a different column class */
#order-standard_cart:has(.cima-domain-hero) > .row > [class*="col-md-9"],
#order-standard_cart:has(.cima-domain-hero) > .row > [class*="col-lg-9"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

@media (max-width: 768px) {
    .cima-domain-hero {
        padding: 30px 15px;
    }
    .cima-domain-title {
        font-size: 24px;
    }
    .cima-domain-hero .input-group-box .form-control {
        font-size: 15px;
        padding: 10px 14px;
    }
    .cima-domain-hero #btnCheckAvailability {
        padding: 10px 20px !important;
        font-size: 14px !important;
    }
}
