/* Mercury Theme Custom Styles */
:root {
    --primary-color: #4d68eb;
    --secondary-color: #2d3b55;
    --text-color: #2d3b55;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --ds-background-sidebar: #f8f9fa;
    --ds-background-default: #ffffff;
    --ds-background-default-hovered: #f5f5f5;
    --ds-background-secondary: #f5f5f5;
    --ds-border-default: #e9ecef;
    --ds-border-radius-medium: 8px;
    --ds-border-radius-round: 50%;
    --ds-icon-default: #666666;
    --ds-text-default: #212529;
    --ds-text-emphasized: #000000;
    --ds-text-secondary: #666666;
    --ds-text-title: #000000;
    --layout-side-bar-width: 240px;
    --ds-font-family-text: "PP Neue Montreal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ds-icon-primary: #0d6efd;
    --ds-icon-secondary: #6c757d;
    --mercury-bg: #ffffff;
    --mercury-text: #1a1a1a;
    --mercury-sidebar-width: 216px;
}

[data-theme=dark] {
    --ds-background-sidebar: #1a1a1a;
    --ds-background-default: #1a1a1a;
    --ds-background-default-hovered: #2a2a2a;
    --ds-background-secondary: #2a2a2a;
    --ds-border-default: #333333;
    --ds-icon-default: #999999;
    --ds-text-default: #e5e5e5;
    --ds-text-emphasized: #ffffff;
    --ds-text-secondary: #999999;
    --ds-text-title: #ffffff;
}
svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {
    overflow: visible;
    box-sizing: content-box;
}
.svg-inline--fa {
    display: var(--fa-display, inline-block);
    height: 1em;
    overflow: visible;
    vertical-align: -0.125em;
}
/* Base Styles */
body {
    font-family: var(--ds-font-family-text);
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Layout */
.mercury-clientarea {
    min-height: 100vh;
    display: flex;
}

.clientarea-layout {
    display: flex;
    width: 100%;
}

/* Mercury Sidebar Styles */
.styles-module__sidebar_Ft2P4 {
    background-color: var(--ds-background-sidebar);
    border-right: 1px solid var(--ds-border-default);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(64px, auto) 1fr auto;
    height: 100%;
    min-width: var(--layout-side-bar-width);
    position: sticky;
    top: 0;
    width: var(--layout-side-bar-width);
    z-index: 2;
}

.styles-module__wrapper_W97nl {
    align-items: center;
    border-bottom: 1px solid var(--ds-border-default);
    display: flex;
    height: 64px;
    justify-content: center;
}

.styles-module__orgAvatar_oLc9b {
    width: 48px;
    height: 48px;
    border-radius: var(--ds-border-radius-round);
    overflow: hidden;
    margin-bottom: 0.5rem;
    background-color: var(--ds-background-secondary);
}

.styles-module__avatarImg_rdKVQ {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.styles-module__body-secondary_lxBHZ {
    font-family: var(--ds-font-family-text);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    color: var(--ds-text-secondary);
    text-align: center;
}

.styles-module__ellipsis_YY5wP {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.styles-module__text-title_XiAqh {
    color: var(--ds-text-emphasized);
    font-weight: 500;
}

.styles-module__primaryLink_zM7Vn {
    margin: 0 12px;
    width: auto;
}

.styles-module__link_AaEOx, .styles-module__link_AaEOx.styles-module__hasSublinks_SrVgj {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    padding: 8px 12px;
    font-size: 15px;
    min-height: 40px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--ds-text-default);
    background: none;
    transition: background 0.2s;
}

.styles-module__icon_P_Rre {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 24px;
    min-height: 24px;
    font-size: 18px;
}

.styles-module__linkTextWithBadge_zp4dL {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
}

.styles-module__link_AaEOx.styles-module__active_DTENF {
    background-color: var(--ds-background-default-hovered, #f5f6fa);
    color: var(--ds-text-on-secondary-hovered, #1a1a1a);
    font-weight: 500;
}

.mercury-sidebar-user {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--ds-border-radius-medium);
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    margin-top: auto;
    transition: all 0.2s ease;
    font-family: var(--ds-font-family-text);
}

.mercury-sidebar-user:hover {
    background-color: var(--ds-background-default-hovered);
}

.mercury-sidebar-user-initials {
    width: 2rem;
    height: 2rem;
    border-radius: var(--ds-border-radius-round);
    background-color: var(--ds-background-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ds-font-family-text);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ds-text-default);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.mercury-sidebar-user-name {
    font-family: var(--ds-font-family-text);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    color: var(--ds-text-default);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Main Content Area */
.main-content {
    align-items: center;
    background-color: var(--ds-background-default);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .styles-module__sidebar_Ft2P4 {
        width: 64px !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .styles-module__sidebar_Ft2P4.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .styles-module__body-secondary_lxBHZ,
    .styles-module__linkTextWithBadge_zp4dL,
    .mercury-sidebar-user-name {
        display: none;
    }

    .styles-module__link_AaEOx {
        justify-content: center;
        padding: 0.75rem;
    }

    .styles-module__icon_P_Rre {
        margin-right: 0;
    }

    .mercury-sidebar-user {
        justify-content: center;
        padding: 0.75rem;
    }

    .mercury-sidebar-user-initials {
        margin-right: 0;
    }
}

/* WHMCS Panel Styles */
.panel {
    background: var(--card-background);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-border-radius-medium);
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-heading {
    padding: 1rem;
    border-bottom: 1px solid var(--ds-border-default);
    background-color: var(--ds-background-default);
    border-radius: var(--ds-border-radius-medium) var(--ds-border-radius-medium) 0 0;
}

.panel-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--ds-text-title);
}

.panel-body {
    padding: 1rem;
}

/* Dark Theme Overrides */
[data-theme=dark] .panel {
    background: var(--ds-background-default);
    border-color: var(--ds-border-default);
}

[data-theme=dark] .panel-heading {
    background-color: var(--ds-background-default);
    border-color: var(--ds-border-default);
}

[data-theme=dark] .panel-title {
    color: var(--ds-text-title);
}

/* Mercury Theme Sidebar Styles */
.sidebar {
  float: left;
  margin: 0;
  padding: 0;
  width: 195px;
  border: 0;
  word-wrap: normal;
}

.sidebar .sidebar-collapse-expand {
  display: none;
  text-align: right;
  padding: 3px 10px;
}

.sidebar .sidebar-collapse-expand i {
  transition: all 0.5s;
}

.sidebar .sidebar-collapse-expand.expanded i {
  transform: rotate(180deg);
}

.sidebar a {
  text-decoration: underline;
}

.sidebar .sidebar-header {
  margin: 5px 0;
  padding: 3px 10px;
  background-color: rgba(0, 0, 0, 0.05);
  color: #444;
  font-weight: 700;
}

.sidebar .sidebar-header i {
  width: 22px;
  text-align: center;
  color: #aaa;
}

.sidebar .sub-header {
  display: block;
  font-weight: 700;
}

.sidebar .content-padded {
  margin: 0;
  padding: 4px 10px;
}

.sidebar .small {
  font-size: 0.8em;
}

.sidebar .truncate {
  width: 175px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar .btn-min-sidebar {
  margin: 10px 0;
  padding: 4px 4px;
  width: 100%;
  text-decoration: none;
  display: block;
  text-align: center;
  background-color: #666;
  color: #fff;
  font-size: 0.8em;
  border: 0;
}

.sidebar ul {
  margin: 0 0 10px 0;
  padding: 0;
  list-style: none;
  border-top: 0;
}

.sidebar ul li {
  margin: 0;
  padding: 0;
}

.sidebar ul li a {
  display: block;
  margin: 0;
  padding: 2px 10px;
  line-height: 1.2;
  font-size: 0.9em;
}

.sidebar ol {
  margin: 0;
  padding: 0 15px;
}

.sidebar ol li {
  margin: 0;
  padding: 0 0 0 2px;
}

.sidebar .form-control {
  margin: 0 0 5px 0;
  padding: 4px 8px;
  border-radius: 2px;
  height: 26px;
  font-size: 12px;
}

.sidebar .selectize-control.multi .selectize-input {
  padding: 2px 8px;
  min-height: 26px;
  font-size: 12px;
}

.sidebar .selectize-control.multi .selectize-input.has-items {
  padding: 1px 1px 0 1px;
}

.sidebar .selectize-control.multi .selectize-input > div {
  margin: 0 1px 1px 0;
}

.sidebar .btn {
  margin: 0 0 5px 0;
  font-size: 12px;
  height: 26px;
}

.sidebar-opener {
  display: none;
  position: absolute;
  top: 200px;
  left: -37px;
  transform: rotate(-90deg);
  background-color: #666;
  color: #fff;
  padding: 1px 10px;
  font-size: 0.8em;
  border-radius: 0 0 3px 3px;
}

.sidebar-opener:hover {
  color: #fff;
}

.sidebar-opener.minimized {
  display: inline;
}

.contentarea {
  transition: all 0.5s ease 0s;
}

@media only screen and (min-width: 950px) {
  .contentarea.sidebar-minimized {
    margin-left: 10px;
  }
}

@media only screen and (max-width: 949px) {
  .sidebar {
    display: block !important;
    float: none;
    margin: 0;
    padding: 0;
    width: 100%;
    border-bottom: 1px solid #ddd;
  }
  .sidebar .btn-min-sidebar,
  .sidebar .sidebar-collapse {
    display: none;
  }
  .sidebar .sidebar-collapse-expand {
    display: block;
  }
  .sidebar-opener {
    display: none !important;
  }
  .contentarea {
    margin: 0;
    border: 0;
  }
}

@media only screen and (min-width: 950px) {
  .sidebar .sidebar-collapse {
    display: block !important;
  }
  .sidebar.minimized {
    display: none;
  }
}

.no-sidebar .sidebar,
.no-sidebar .sidebar-opener {
  display: none !important;
}

.no-sidebar .contentarea {
  margin-left: 0;
}

/* Dark theme support */
[data-theme=dark] .styles-module__sidebar_Ft2P4 {
  background-color: var(--ds-background-sidebar);
  border-right-color: var(--ds-border-default);
}

[data-theme=dark] .styles-module__link_AaEOx {
  color: var(--ds-text-secondary);
}

[data-theme=dark] .styles-module__link_AaEOx:hover {
  background-color: var(--ds-background-default-hovered);
  color: var(--ds-text-emphasized);
}

[data-theme=dark] .styles-module__icon_P_Rre {
  color: var(--ds-icon-secondary);
}

[data-theme=dark] .styles-module__link_AaEOx:hover .styles-module__icon_P_Rre {
  color: var(--ds-icon-primary);
}

/* Override any WHMCS-specific styles */
#wrapper {
    margin-left: var(--layout-side-bar-width);
    width: calc(100% - var(--layout-side-bar-width));
}

#content, .DashboardLayouts-module__dashboardContent_obhjf {
    margin-left: 216px !important;
    width: calc(100% - 216px) !important;
    min-height: 100vh !important;
    background: var(--ds-background-default, #fff) !important;
}

/* Ensure the sidebar is always visible */
.styles-module__sidebar_Ft2P4 {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

/* WHMCS-specific overrides */
.mercury-root {
    display: flex;
    min-height: 100vh;
    background-color: var(--ds-background-default);
}

/* Ensure Mercury dashboard styles are not overridden */
.styles-module__sidebar_Ft2P4 {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 216px !important;
    height: 100vh !important;
    z-index: 1000 !important;
}

.styles-module__primaryLink_zM7Vn {
    margin: 0 12px !important;
    width: auto !important;
}

/* WHMCS-specific overrides */
#content {
    margin-left: 216px !important;
    padding: 24px !important;
    width: calc(100% - 216px) !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .styles-module__sidebar_Ft2P4 {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .styles-module__sidebar_Ft2P4.active {
        transform: translateX(0);
    }
    
    #content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* Ensure proper font loading */
@font-face {
    font-family: 'PP Neue Montreal';
    src: url('{$WEB_ROOT}/templates/{$template}/fonts/PPNeueMontreal-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .styles-module__sidebar_Ft2P4 {
        width: 64px;
        padding: 16px 8px;
    }

    #content {
        margin-left: 64px;
        width: calc(100% - 64px);
    }

    .styles-module__body-secondary_lxBHZ,
    .styles-module__linkTextWithBadge_zp4dL,
    .mercury-sidebar-user-name {
        display: none;
    }

    .styles-module__link_AaEOx {
        justify-content: center;
        padding: 8px;
    }

    .styles-module__icon_P_Rre {
        margin-right: 0;
    }

    .mercury-sidebar-user {
        justify-content: center;
        padding: 8px;
    }

    .mercury-sidebar-user-initials {
        margin-right: 0;
    }
}

/* Mercury Dashboard Integration */
:root {
    --ds-background-default: #ffffff;
    --ds-background-sidebar: #f8f9fa;
    --ds-border-default: #e9ecef;
    --ds-text-default: #212529;
    --ds-text-emphasized: #000000;
    --ds-icon-primary: #0d6efd;
    --ds-icon-secondary: #6c757d;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.mercury-root {
    display: flex;
    min-height: 100vh;
    background-color: var(--ds-background-default);
}

.styles-module__primaryLink_zM7Vn {
    margin: 0 12px !important;
    width: auto !important;
}

/* WHMCS Content Area */
#content {
    margin-left: 216px !important;
    padding: 24px !important;
    width: calc(100% - 216px) !important;
    min-height: 100vh !important;
    background-color: var(--ds-background-default) !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .styles-module__sidebar_Ft2P4 {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .styles-module__sidebar_Ft2P4.active {
        transform: translateX(0);
    }
    
    #content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* WHMCS Overrides */
.container {
    max-width: 100% !important;
    padding: 0 !important;
}

.header-lined {
    border-bottom: 1px solid var(--ds-border-default) !important;
    margin-bottom: 20px !important;
    padding-bottom: 10px !important;
}

/* Mercury Theme Integration */
:root {
    --mercury-bg: #ffffff;
    --mercury-text: #1a1a1a;
    --mercury-sidebar-width: 216px;
}

/* Ensure Mercury styles take precedence */
.mercury-root {
    display: flex;
    min-height: 100vh;
    background: var(--mercury-bg);
    color: var(--mercury-text);
}

/* Content area */
.mercury-content {
    margin-left: var(--mercury-sidebar-width);
    flex: 1;
    padding: 2rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .styles-module__sidebar_Ft2P4 {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .styles-module__sidebar_Ft2P4.active {
        transform: translateX(0);
    }
    
    .mercury-content {
        margin-left: 0;
    }
}

/* WHMCS overrides */
#main-body {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

#header {
    display: none !important;
}

/* Sidebar Visual Enhancements */
.styles-module__mainLinks_Y0NDN {
    display: grid;
    gap: 4px;
    grid-auto-rows: min-content;
    grid-template-columns: minmax(0, 1fr);
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 0 40px;
}

.styles-module__primaryLink_zM7Vn {
    margin: 0 12px;
    width: auto;
}

.styles-module__link_AaEOx.styles-module__active_DTENF {
    background-color: var(--ds-background-default-hovered);
    color: var(--ds-text-on-secondary-hovered);
    font-weight: 480;
}

.styles-module__primaryLink_zM7Vn .styles-module__link_AaEOx {
    position: relative;
    z-index: 2;
}

.styles-module__link_AaEOx, .styles-module__link_AaEOx.styles-module__hasSublinks_SrVgj {
    grid-template-columns: 24px 1fr;
}

.styles-module__link_AaEOx .styles-module__icon_P_Rre {
    display: grid;
    font-size: 13px;
    justify-content: center;
}

.styles-module__primaryLink_zM7Vn .styles-module__link_AaEOx .styles-module__linkTextWithBadge_zp4dL {
    align-items: center;
    display: flex;
    flex-flow: row nowrap;
    gap: 8px;
    justify-content: space-between;
}

/* --- Mercury Sidebar: Flex Layout Fix (Final) --- */
/* Remove grid-based sidebar link rules */
.styles-module__link_AaEOx, .styles-module__link_AaEOx.styles-module__hasSublinks_SrVgj {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    padding: 8px 12px;
    font-size: 15px;
    min-height: 40px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--ds-text-default);
    background: none;
    transition: background 0.2s;
}

.styles-module__icon_P_Rre {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 24px;
    min-height: 24px;
    font-size: 18px;
}

.styles-module__linkTextWithBadge_zp4dL {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
}

.styles-module__link_AaEOx.styles-module__active_DTENF {
    background-color: var(--ds-background-default-hovered, #f5f6fa);
    color: var(--ds-text-on-secondary-hovered, #1a1a1a);
    font-weight: 500;
}

/* Remove any grid-template-columns or display: grid for sidebar links */
/* (If present elsewhere in the file, they are now overridden by the above) */ 

.styles-module__statusFlag_cLxEs.status-green,
.styles-module__statusFlag_cLxEs.status-green.styles-module__failedCanceledOrBlockedFlag_xq995 {
    border: 1px solid var(--ds-border-success, #27ae60) !important;
    color: var(--ds-text-success, #27ae60) !important;
    background: #eafaf1 !important;
}

.styles-module__statusFlag_cLxEs.status-green {
    border: 1px solid #27ae60 !important;
    color: #27ae60 !important;
    align-items: center !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    height: 20px !important;
    padding: 0 8px !important;
    position: relative !important;
    white-space: nowrap !important;
    font-weight: 600 !important;
    min-width: 60px;
    text-align: center;
    vertical-align: middle;
    box-sizing: border-box;
    margin-left: 8px !important;
    background: #eafaf1 !important;
}

/* Extra specificity: if both classes are present, green always wins */
.styles-module__statusFlag_cLxEs.status-green.styles-module__failedCanceledOrBlockedFlag_xq995 {
    border: 1px solid var(--ds-border-success, #27ae60) !important;
    color: var(--ds-text-success, #27ae60) !important;
    background: #eafaf1 !important;
} 