/* ==========================================================================
   1. TSS GLOBAL DESIGN SYSTEM (tss_style.css)
   Role: Standardizes inputs, buttons, and high-density grid layouts.
========================================================================== */

:root {
    --portal-primary-color: #0078d4;
    --portal-primary-hover: #106ebe;
    --portal-bg-light: #f8f9fa;
    --portal-bg-hover: #f0f7ff;
    --portal-border: #dee2e6;
    --portal-radius: 6px;
    --portal-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    /* Text Colors & Typography */
    --tss-text-main: #323130;
    --tss-text-label: #64748b; /* Muted Slate for labels */
    --tss-text-dark: #111827; /* Near black for data values */
    --tss-font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;

    /* Status Colors */
    --tss-status-success: #166534;
    --tss-status-error: #991b1b;
    --tss-status-info: #1e40af;
    --tss-status-warning: #9a3412;
}

body {
    -webkit-font-smoothing: antialiased;
    color: var(--tss-text-main);
    font-family: var(--tss-font-family);
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   2. Layout & Tabs Architecture
   -------------------------------------------------------------------------- */
.navbar-inverse .navbar-nav > li > a:hover {
    padding-bottom: 5px !important; /* before 10px, changed by sohith to the following *//
}

body .nav-tabs {
    border-bottom: 2px solid var(--portal-border);
    margin-bottom: 10px;
}

body .nav-tabs > li > a {
    border: none;
    font-weight: 600;
    color: var(--tss-text-label);
    transition: color 0.2s ease;
}

body .nav-tabs > li.active > a {
    color: var(--portal-primary-color);
    border-bottom: 3px solid var(--portal-primary-color);
    background: transparent;
}

/* --------------------------------------------------------------------------
   3. Form Modernization (inputs, labels, spacing)
   -------------------------------------------------------------------------- */
body .control {
    margin-bottom: 0.75rem;
}

/* Labels: Small, muted, uppercase for scanning */
body .control-label, 
body .crmEntityFormView .field-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    color: var(--tss-text-label);
    display: block;
}

/* Polished Inputs */
body input[type="text"],
body input[type="password"],
body select,
body .query.form-control {
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    padding: 8px 12px;
    height: 40px;
    font-size: 14px;
    transition: all 0.2s ease-in-out;
    box-shadow: none;
}

body input:focus,
body textarea:focus,
body select:focus {
    border-color: var(--portal-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
    outline: none;
}

/* Buttons */
body .btn {
    border-radius: var(--portal-radius);
    padding: 8px 20px;
    height: 38px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: none;
    transition: all 0.2s ease-in-out;
}

body .btn-primary {
    background-color: var(--portal-primary-color);
    border-color: var(--portal-primary-color);
    color: #fff;
}

body .btn-primary:hover {
    background-color: var(--portal-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 120, 212, 0.3);
}

/* --------------------------------------------------------------------------
   4. Entity Form Refinement (crmEntityFormView)
   -------------------------------------------------------------------------- */
body .crmEntityFormView .tab {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

body .crmEntityFormView td.cell {
    padding: 6px 12px;
    border: none;
}

body .crmEntityFormView td.cell.subgrid-cell {
    padding: 0 12px 5px 12px !important;
}

/* Hide empty subgrid headings that create gaps */
body .crmEntityFormView .form-subgrid-heading:empty {
    display: none !important;
}

body .crmEntityFormView fieldset {
    border: none;
    margin: 0 0 15px 0 !important;
    padding: 0;
}

body .crmEntityFormView fieldset legend {
    font-size: 2rem !important;
    font-weight: 700;
    color: var(--tss-text-main);
    border-bottom: 1px solid var(--portal-border);
    width: 100%;
    padding-bottom: 4px;
    margin: 15px 0 8px 0 !important;
}

body .crmEntityFormView fieldset legend h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

/* Data Values: Bold to pop against labels */
body .crmEntityFormView .form-control[readonly],
body .crmEntityFormView .form-control[disabled] {
    font-weight: 400;
    color: var(--tss-text-dark);
    font-size: 14px;
    border-color: transparent;
    background: transparent;
    padding-left: 0;
    box-shadow: none;
    min-height: auto;
    height: auto;
}

/* Dim empty fields to reduce cognitive noise */
.crmEntityFormView .text-muted:contains("—") {
    opacity: 0.4;
}

/* --------------------------------------------------------------------------
   5. Data Grid / Table Polish
   -------------------------------------------------------------------------- */
body .view-grid table.table {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    box-shadow: var(--portal-shadow);
    margin-bottom: 0;
}

body .view-grid thead th {
    background-color: var(--portal-bg-light);
    color: var(--tss-text-label);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 8px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--portal-border);
    letter-spacing: 0.5px;
}

body .view-grid tbody tr td {
    padding: 10px 8px !important;
}

body .view-grid tbody tr:hover {
    background-color: #f0f7ff !important;
    cursor: pointer;
}

.view-grid .dropdown.action .btn.btn-xs {
    padding: 4px 8px !important;
    height: 28px !important;
    width: 32px !important;
    border-radius: 4px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #605e5c !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.view-grid .dropdown.action .btn.btn-xs:hover,
.view-grid .dropdown.action.open .btn.btn-xs {
    background-color: #edebe9 !important;
    color: var(--portal-primary-color) !important;
    border-color: #e1dfdd !important;
}

.view-grid .dropdown-menu {
    border: none !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12) !important;
    border-radius: 8px !important;
    padding: 6px 0 !important;
    min-width: 180px !important;
}

.view-grid .dropdown-menu li a {
    padding: 8px 16px !important;
    font-size: 1.2rem !important;
    font-weight: 500 !important;
    color: #323130 !important;
}

/* Tighten Subgrid toolbar space */
.view-toolbar.grid-actions {
    margin-bottom: 4px !important;
}

.view-toolbar.grid-actions .pull-right {
    margin-bottom: 5px;
}

/* --------------------------------------------------------------------------
   6. Status Badges & Search
   -------------------------------------------------------------------------- */
.status-grid-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    display: inline-block;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-unscheduled { background-color: #e0f2fe; color: #0369a1; }
.status-scheduled   { background-color: #ffedd5; color: var(--tss-status-warning); }
.status-inprogress  { background-color: #dbeafe; color: var(--tss-status-info); }
.status-completed   { background-color: #dcfce7; color: var(--tss-status-success); }
.status-canceled    { background-color: #fee2e2; color: var(--tss-status-error); }

/* Search responsive fix */
body .view-search .query {
    width: 100%;
    max-width: 280px;
    border-right: none;
    height: 38px;
}

/* --------------------------------------------------------------------------
   7. Specialized Components (ShopCore Status)
   -------------------------------------------------------------------------- */
#shopcore-status-wrapper .border {
    border-left: 4px solid var(--portal-primary-color) !important;
    background-color: #f8faff;
    padding: 10px !important;
}

#shopcore-status-value {
    font-size: 1rem;
    color: var(--tss-text-dark);
}

/* --------------------------------------------------------------------------
   8. Spacing Utilities (Bootstrap 3 Compatibility)
   -------------------------------------------------------------------------- */
.mt-0  { margin-top: 0px !important; }
.mt-5  { margin-top: 5px !important; }
.mt-10 { margin-top: 10px !important; }
.mt-15 { margin-top: 15px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-30 { margin-top: 30px !important; }

.mb-20 { margin-bottom: 20px !important; }

 .instructions-note {
     display: block;
     margin-top: 16px;
     margin-bottom: 16px;
     color: #31708f;
     background-color: #d9edf7;
     border: 1px solid #bce8f1;
     border-radius: 4px;
     padding: 10px 15px;
     font-size: 16px;
     font-weight: 500;
 }

 .instructions-note:focus {
     outline: 2px solid #31708f;
     outline-offset: 2px;
 }

body .field-mandatory {
    margin-left: 4px; 
    font-size: 14px; 
    font-weight: 600; 
    color: #9a3412;
}



/* ── Bootstrap 3 → 5 visual compatibility ──────────────────────── */

/* Nav link padding matches BS3 default (10px 15px) */
.navbar .navbar-nav > li > .header-link {
    padding: 10px 15px;
    line-height: 20px;
    display: inline-block;
    background-color: #0078d4;
    font-weight: 400;
    text-decoration: none;
}

/* Navbar min-height matches BS3 (50px) */
.navbar {
    min-height: 50px;
}

/* Dropdown menu - BS3 style: white bg, border-radius, shadow */
.navbar .dropdown-menu {
    margin-top: 0;           /* removes the 2px BS5 gap that caused menu flicker */
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.15);
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    padding: 5px 0;
    min-width: 160px;
    background-color: #ffffff;
    text-decoration: none;
}

/* Dropdown link items - BS3 style */
.navbar .dropdown-menu li > a {
    display: block;
    padding: 3px 20px;
    line-height: 1.42857;
    white-space: nowrap;
    font-weight: normal;
    color: #333333;
    text-decoration: none;
}

.navbar .dropdown-menu li > a:hover,
.navbar .dropdown-menu li > a:focus {
    background-color: #f5f5f5;
    color: #262626;
    text-decoration: none;
}

/* Divider inside dropdown - BS3 style */
.navbar .dropdown-menu .divider {
    height: 1px;
    margin: 9px 0;
    overflow: hidden;
    background-color: #106ebe;
}

/* White text on all nav menu links */
.navbar .header-link,
.navbar .header-link:hover,
.navbar .header-link:focus {
    color: #ffffff !important;
}

/* Positioning context for JS-controlled dropdowns */
.navbar .dropdown {
    position: relative;
}

/* Dropdowns open left-aligned by default (left-to-right); JS flips to right-anchored if near screen edge */
.navbar .dropdown-menu {  /* before left is 0 and right is auto, Changed by sohith to the following */
    right: 0;
    left: auto; 
}

.entitylist-filter-option-group {
    min-width: 250px;
}
 .entitylist-filter-option, select.form-control, .entitylist-filter-option-text {
     width: 200px !important;
}

.text-muted {
    display: none !important;
}
