/* ==========================================================================
   WHMCS UI Parity Stylesheet - Themes/client_custom
   Strictly isolated to custom theme. Safe against core and theme updates.
   ========================================================================== */

:root {
    --whmcs-primary: #0066cc;
    --whmcs-primary-hover: #0052a3;
    --whmcs-success: #28a745;
    --whmcs-danger: #dc3545;
    --whmcs-warning: #f0ad4e;
    --whmcs-info: #17a2b8;
    --whmcs-body-bg: #f4f6f9;
    --whmcs-text-main: #334155;
    --whmcs-text-muted: #64748b;
    --whmcs-border: #e2e8f0;
    --whmcs-card-bg: #ffffff;
    --whmcs-topbar-bg: #1e293b;
}

/* Base & Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    color: var(--whmcs-text-main);
    background-color: var(--whmcs-body-bg) !important;
    margin: 0;
    padding: 0;
}

a {
    color: var(--whmcs-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--whmcs-primary-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: normal;
}
h1 { font-size: 1.65rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }

/* Container Normalization */
.container-whmcs {
    width: 100%;
    max-width: 1360px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* ==========================================================================
   Two-Tier WHMCS Navigation
   ========================================================================== */

/* Top Secondary Bar */
.whmcs-topbar {
    background-color: var(--whmcs-topbar-bg);
    color: #cbd5e1;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.whmcs-topbar > .container-whmcs a,
.whmcs-topbar .dropdown-toggle {
    color: #cbd5e1;
    text-decoration: none;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}
.whmcs-topbar > .container-whmcs a:hover,
.whmcs-topbar .dropdown-toggle:hover {
    color: #ffffff;
    text-decoration: none;
}
.whmcs-topbar .dropdown-menu {
    background-color: #ffffff !important;
    font-size: 13px;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--whmcs-border);
    padding: 6px 0;
    min-width: 180px;
}
.whmcs-topbar .dropdown-menu .dropdown-item,
.whmcs-topbar .dropdown-item {
    color: #1e293b !important;
    padding: 8px 18px !important;
    display: block !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    text-decoration: none !important;
    background-color: transparent !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}
.whmcs-topbar .dropdown-menu .dropdown-item:hover,
.whmcs-topbar .dropdown-menu .dropdown-item:focus,
.whmcs-topbar .dropdown-item:hover,
.whmcs-topbar .dropdown-item:focus {
    background-color: #f1f5f9 !important;
    color: var(--whmcs-primary) !important;
}
.whmcs-topbar .dropdown-menu .dropdown-item.text-danger,
.whmcs-topbar .dropdown-item.text-danger {
    color: #dc2626 !important;
}
.whmcs-topbar .dropdown-menu .dropdown-item.text-danger:hover,
.whmcs-topbar .dropdown-item.text-danger:hover {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
}
.whmcs-topbar .badge-count {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* Main Primary Navbar */
.whmcs-mainbar {
    background-color: #ffffff;
    border-bottom: 1px solid var(--whmcs-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.whmcs-mainbar .navbar-brand {
    padding-top: 10px;
    padding-bottom: 10px;
    margin-right: 2rem;
}
.whmcs-mainbar .navbar-brand img {
    max-height: 40px;
    width: auto;
}
.whmcs-mainbar .nav-link {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    padding: 16px 14px !important;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}
.whmcs-mainbar .nav-link:hover,
.whmcs-mainbar .nav-link:focus {
    color: var(--whmcs-primary);
    border-bottom-color: var(--whmcs-primary);
    background-color: transparent;
}
.whmcs-mainbar .nav-item.active .nav-link,
.whmcs-mainbar .nav-link.active {
    color: var(--whmcs-primary);
    border-bottom-color: var(--whmcs-primary);
    font-weight: 600;
}
.whmcs-mainbar .nav-item {
    position: relative;
    display: block;
}
.whmcs-mainbar .dropdown-menu {
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--whmcs-border);
    padding: 6px 0;
    margin-top: 0;
    font-size: 13.5px;
}
.whmcs-mainbar .dropdown-item {
    padding: 8px 18px;
    color: #334155;
    transition: background-color 0.15s ease;
}
.whmcs-mainbar .dropdown-item:hover {
    background-color: #f1f5f9;
    color: var(--whmcs-primary);
}

/* Desktop Dropdown Positioning: Anchor below the navbar item */
@media (min-width: 992px) {
    .whmcs-mainbar .navbar-nav {
        flex-direction: row;
        align-items: center;
    }
    .whmcs-mainbar .navbar-nav .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        margin-top: 0 !important;
        z-index: 1050;
        min-width: 180px;
    }
    .whmcs-mainbar .navbar-nav .dropdown-menu-end {
        left: auto !important;
        right: 0 !important;
    }
}

/* Mobile Dropdown Behavior: Inline expansion inside drawer */
@media (max-width: 991.98px) {
    .whmcs-mainbar .navbar-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .whmcs-mainbar .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        box-shadow: none;
        border: none;
        background-color: #f8fafc;
        padding-left: 15px;
        margin-top: 4px;
        margin-bottom: 8px;
    }
}

/* Mobile Navbar Toggle */
.whmcs-mainbar .navbar-toggler {
    border: 1px solid var(--whmcs-border);
    padding: 6px 10px;
}

/* ==========================================================================
   Breadcrumb Bar
   ========================================================================== */
.whmcs-breadcrumb-wrapper {
    background-color: #ffffff;
    border-bottom: 1px solid var(--whmcs-border);
    padding: 10px 0;
    margin-bottom: 24px;
}
.whmcs-breadcrumb-wrapper .breadcrumb {
    margin-bottom: 0;
    font-size: 12.5px;
}
.whmcs-breadcrumb-wrapper .breadcrumb-item a {
    color: var(--whmcs-primary);
    text-decoration: none;
}
.whmcs-breadcrumb-wrapper .breadcrumb-item.active {
    color: var(--whmcs-text-muted);
}

/* ==========================================================================
   WHMCS Panels & Cards
   ========================================================================== */
.panel-whmcs {
    background: #ffffff;
    border: 1px solid var(--whmcs-border);
    border-radius: 5px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.panel-whmcs-heading {
    padding: 12px 18px;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--whmcs-border);
    font-weight: 600;
    font-size: 14.5px;
    color: #1e293b;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-whmcs-body {
    padding: 18px 20px;
}
.panel-whmcs-footer {
    padding: 10px 18px;
    background-color: #f8fafc;
    border-top: 1px solid var(--whmcs-border);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* WHMCS Dashboard Stat Tiles */
.whmcs-stat-tile {
    background: #ffffff;
    border: 1px solid var(--whmcs-border);
    border-top: 3px solid var(--whmcs-primary);
    border-radius: 5px;
    padding: 16px 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
}
.whmcs-stat-tile.tile-services { border-top-color: var(--whmcs-success); }
.whmcs-stat-tile.tile-invoices { border-top-color: var(--whmcs-danger); }
.whmcs-stat-tile.tile-tickets { border-top-color: var(--whmcs-warning); }
.whmcs-stat-tile.tile-domains { border-top-color: var(--whmcs-info); }
.whmcs-stat-tile.tile-balance { border-top-color: var(--whmcs-info); }

.whmcs-stat-tile .stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
    margin-bottom: 4px;
}
.whmcs-stat-tile .stat-title {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--whmcs-text-muted);
}
.whmcs-stat-tile a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-whmcs {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}
.table-whmcs th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--whmcs-border);
    border-top: none;
}
.table-whmcs td {
    padding: 12px 14px;
    font-size: 13.5px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}
.table-whmcs tbody tr:hover {
    background-color: #f8fafc;
}

/* Compact customer tables and clear, persistent list filters. */
.client-compact-table {
    font-size: 13px;
    margin-bottom: 0;
    vertical-align: middle;
}
.client-compact-table > :not(caption) > * > * {
    padding: 0.48rem 0.7rem;
}
.client-compact-table thead th {
    color: #475569;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.client-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    border-bottom: 1px solid var(--whmcs-border);
    padding: 0 0.25rem 0.55rem;
}
.client-status-link {
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    padding: 0.4rem 0.7rem;
    color: #475569;
    font-size: 13px;
    text-decoration: none;
}
.client-status-link:hover,
.client-status-link.is-active {
    color: #fff;
    background: #14527a;
    text-decoration: none;
}
.client-list-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 0 1rem 0.65rem;
}
.client-list-toolbar .form-control {
    width: min(100%, 320px);
    font-size: 13px;
}
.client-source-badge {
    background: #eef2f7;
    color: #526276;
    border: 1px solid #dbe3ec;
    font-size: 10px;
    font-weight: 600;
    vertical-align: middle;
}
.client-service-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    height: 100%;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid var(--whmcs-border);
    border-radius: 5px;
}
.client-service-metric span {
    color: var(--whmcs-text-muted);
    font-size: 12px;
}
.client-service-metric strong {
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
}
.client-service-tabs .nav-link {
    color: #475569;
    font-size: 13px;
}
.client-service-tabs .nav-link.active {
    color: var(--whmcs-primary);
    font-weight: 600;
}
.client-service-facts dt,
.client-service-facts dd {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid #f1f5f9;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.client-service-facts dt { color: #64748b; font-weight: 500; }
.client-credential-panel {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--whmcs-border);
    border-left: 3px solid var(--whmcs-info);
    border-radius: 5px;
}
.client-credential-panel p[role="status"] { margin: 0.5rem 0 0; }
table[data-sortable] th[role="columnheader"] { cursor: pointer; }
table[data-sortable] th[aria-sort]::after {
    content: "↕";
    display: inline-block;
    margin-left: 0.4rem;
    color: #94a3b8;
    font-size: 0.75em;
}
table[data-sortable] th[aria-sort="ascending"]::after { content: "↑"; color: var(--whmcs-primary); }
table[data-sortable] th[aria-sort="descending"]::after { content: "↓"; color: var(--whmcs-primary); }

/* ==========================================================================
   Badges & Status Pills
   ========================================================================== */
.badge-whmcs {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}
.badge-whmcs-paid, .badge-whmcs-active {
    background-color: #28a745;
    color: #ffffff;
}
.badge-whmcs-unpaid, .badge-whmcs-suspended {
    background-color: #dc3545;
    color: #ffffff;
}
.badge-whmcs-pending {
    background-color: #f0ad4e;
    color: #ffffff;
}
.badge-whmcs-closed, .badge-whmcs-terminated {
    background-color: #64748b;
    color: #ffffff;
}

@media (max-width: 575.98px) {
    .container-whmcs { padding-left: 12px; padding-right: 12px; }
    .whmcs-stat-tile { padding: 13px 10px; margin-bottom: 8px; }
    .whmcs-stat-tile .stat-value { font-size: 23px; }
    .client-status-filter { overflow-x: auto; flex-wrap: nowrap; }
    .client-status-link { white-space: nowrap; }
}

/* Department & Category Badges */
.badge-whmcs-dept {
    background-color: #f1f5f9;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: normal;
    text-transform: none;
}

/* Fix Huraga wildcard forcing white text on light badges */
.badge.bg-light,
.badge.bg-white,
.badge.bg-light-subtle,
.badge.text-dark {
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
    background-color: #f1f5f9 !important;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.whmcs-footer {
    background-color: #ffffff;
    border-top: 1px solid var(--whmcs-border);
    padding: 24px 0 20px;
    margin-top: 40px;
    font-size: 12.5px;
    color: var(--whmcs-text-muted);
}
.whmcs-footer a {
    color: var(--whmcs-text-muted);
}
.whmcs-footer a:hover {
    color: var(--whmcs-primary);
}

/* ==========================================================================
   Missing Bootstrap Grid & Navbar Utilities (purged in vendor.css)
   ========================================================================== */

/* Navbar Desktop Expansion */
@media (min-width: 992px) {
    .navbar-expand-lg {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    .navbar-expand-lg .navbar-nav {
        flex-direction: row;
    }
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    .navbar-expand-lg .navbar-toggler {
        display: none !important;
    }
}

/* Grid columns missing in vendor.css */
.col-6 {
    flex: 0 0 auto;
    width: 50%;
}
.col-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
}

@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 auto;
        width: 25%;
    }
    .col-md-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }
    .col-md-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }
    .col-md-9 {
        flex: 0 0 auto;
        width: 75%;
    }
}

@media (min-width: 992px) {
    .col-lg-5 {
        flex: 0 0 auto;
        width: 41.66666667%;
    }
    .col-lg-7 {
        flex: 0 0 auto;
        width: 58.33333333%;
    }
    .col-lg-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }
    .col-lg-9 {
        flex: 0 0 auto;
        width: 75%;
    }
}

/* List Utilities */
.list-inline {
    padding-left: 0;
    list-style: none;
}
.list-inline-item {
    display: inline-block;
}
.list-inline-item:not(:last-child) {
    margin-right: 0.5rem;
}

/* ==========================================================================
   Service Details & Management View Polish (WHMCS Style)
   ========================================================================== */
body.order-manage .card {
    border: 1px solid var(--whmcs-border);
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
body.order-manage .card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--whmcs-border);
    padding: 14px 20px;
}
body.order-manage .card-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}
body.order-manage .card-body {
    padding: 20px;
}
body.order-manage table.table {
    margin-bottom: 0;
    border: 1px solid var(--whmcs-border);
}
body.order-manage table.table td {
    padding: 10px 16px;
    vertical-align: middle;
}
body.order-manage table.table tr td:first-child {
    width: 28%;
    max-width: 240px;
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-right: 1px solid var(--whmcs-border);
}
body.order-manage .card-footer {
    background-color: #f8fafc;
    border-top: 1px solid var(--whmcs-border);
    padding: 12px 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   CKEditor WYSIWYG Styling & Powered By Badge Removal
   ========================================================================== */

/* Expand vertical height of ticket description to at least 5+ lines (180px+) by default */
.ck-editor__editable,
.ck-editor__editable_inline,
.ck.ck-content,
.ck.ck-editor__main > .ck-editor__editable,
.ck.ck-editor__main > .ck-editor__editable:not(.ck-focused) {
    min-height: 180px !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

textarea.editor-textarea {
    min-height: 180px !important;
}

/* Remove Powered By CKEditor badge, watermarks, and floating balloons */
.ck.ck-powered-by,
.ck-powered-by,
.ck-powered-by-balloon,
.ck.ck-balloon-panel.ck-powered-by-balloon,
.ck.ck-balloon-panel.ck-evaluation-badge-balloon,
.ck.ck-evaluation-badge,
a.ck-powered-by__link,
.ck-powered-by__label,
[class*="ck-powered-by"],
[class*="ck-evaluation-badge"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    line-height: 0 !important;
    position: absolute !important;
    z-index: -9999 !important;
}
