/*
 * nxt-polish.css — global UI polish layer
 * Loaded after nxt-thor.css in main layout. Improves consistency across all
 * migrated pages without modifying individual views.
 *
 * Sections:
 *   1. Page loader spinner refinement
 *   2. Panel + alert + page-header transitions
 *   3. Action bar spacing helpers
 *   4. Badges (semantic colors + size + spacing)
 *   5. Buttons (consistent hover, disabled, loading state)
 *   6. Form validation visual states (.is-invalid / .is-valid)
 *   7. DataTables polish (sane spacing, consistent search/length)
 *   8. SweetAlert2 dark-theme fit
 *   9. jQuery-Toast positioning + theme
 *  10. Modal + ticket-thread polish
 *  11. Responsive small fixes
 */

/* 1. Page loader spinner refinement
   ------------------------------------------------------------- */
#page-loader {
    background: linear-gradient(135deg, #1a1d2b 0%, #2c2842 50%, #1a1d2b 100%);
    transition: opacity .35s ease;
}
#page-loader .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #f59c1a;
    border-radius: 50%;
    animation: nxt-spin 0.9s linear infinite;
    display: inline-block;
}
@keyframes nxt-spin {
    to { transform: rotate(360deg); }
}

/* 2. Panel + alert + page-header transitions
   ------------------------------------------------------------- */
.panel { transition: transform .25s ease, box-shadow .25s ease; }
.panel.panel-inverse {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
.panel.panel-inverse:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
}
.panel.panel-inverse > .panel-heading {
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-body {
    animation: nxt-panel-in .35s ease both;
}
@keyframes nxt-panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert {
    border: 0;
    border-left: 4px solid;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    animation: nxt-alert-in .25s ease both;
}
.alert-success { border-left-color: #00acac; }
.alert-warning { border-left-color: #f59c1a; }
.alert-danger  { border-left-color: #ff5b57; }
.alert-info    { border-left-color: #348fe2; }
.alert-secondary, .alert-light { border-left-color: #6c757d; }
@keyframes nxt-alert-in {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.page-header {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* 3. Action bar spacing helpers
   used across migrated pages: <div class="d-flex flex-wrap"
       style="gap:0.5rem;"> ... </div>
   normalize it in case any page forgets the inline style.
   ------------------------------------------------------------- */
.panel.panel-inverse > .panel-body > .d-flex.flex-wrap {
    align-items: center;
}
.panel.panel-inverse > .panel-body > .d-flex.flex-wrap > .btn,
.panel.panel-inverse > .panel-body > .d-flex.flex-wrap > .form-group {
    margin: 0;
}
.btn + .btn { margin-left: 0.25rem; }

/* 4. Badges (semantic + spacing)
   Normalize badge sizes across pages and add a tiny shadow.
   ------------------------------------------------------------- */
.badge {
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 0.35em 0.6em;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.badge.badge-success   { background-color: #00acac; }
.badge.badge-info      { background-color: #348fe2; }
.badge.badge-warning   { background-color: #f59c1a; color: #fff; }
.badge.badge-danger    { background-color: #ff5b57; }
.badge.badge-primary   { background-color: #6f5cf2; }
.badge.badge-secondary { background-color: #6c757d; }
.badge + .badge { margin-left: 0.25rem; }

/* table cells with badges: small visual breathing room */
table td .badge { vertical-align: middle; }

/* 5. Buttons (hover + disabled + loading)
   ------------------------------------------------------------- */
.btn {
    transition: filter .15s ease, transform .08s ease, box-shadow .15s ease;
}
.btn:not(:disabled):hover { filter: brightness(1.06); }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; }

.btn.is-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    top: 50%; left: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: nxt-spin 0.7s linear infinite;
}

/* 6. Form validation visual states
   Hooked by JS in nxt-polish.js when required fields are missing.
   ------------------------------------------------------------- */
.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: #ff5b57 !important;
    background-color: rgba(255,91,87,0.04);
}
.form-control.is-invalid:focus,
.was-validated .form-control:invalid:focus {
    box-shadow: 0 0 0 0.15rem rgba(255,91,87,0.25);
}
.invalid-feedback {
    display: block;
    color: #ff5b57;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.form-control.is-valid {
    border-color: #00acac !important;
}

/* 7. DataTables polish
   ------------------------------------------------------------- */
.dataTables_wrapper {
    padding-top: 0.25rem;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.5rem;
}
.dataTables_wrapper .dataTables_filter input {
    height: 28px;
    padding: 2px 8px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 4px;
    margin-left: 0.35rem;
}
.dataTables_wrapper .dataTables_length select {
    height: 28px;
    margin: 0 0.35rem;
}
.dataTables_wrapper table.dataTable thead th.sorting,
.dataTables_wrapper table.dataTable thead th.sorting_asc,
.dataTables_wrapper table.dataTable thead th.sorting_desc {
    cursor: pointer;
    user-select: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
}
.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: rgba(0,0,0,0.55);
}

/* 8. SweetAlert2 dark-theme fit
   ------------------------------------------------------------- */
.swal2-popup {
    border-radius: 8px !important;
    font-family: inherit;
}
.swal2-title { font-weight: 600; }
.swal2-styled.swal2-confirm {
    background-color: #6f5cf2 !important;
    border-radius: 4px !important;
}
.swal2-styled.swal2-cancel {
    background-color: #6c757d !important;
    border-radius: 4px !important;
}
.swal2-icon.swal2-warning { border-color: #f59c1a; color: #f59c1a; }
.swal2-icon.swal2-error   { border-color: #ff5b57; color: #ff5b57; }
.swal2-icon.swal2-success { border-color: #00acac; color: #00acac; }

/* 9. jQuery-Toast positioning + theme
   ------------------------------------------------------------- */
.jq-toast-wrap {
    z-index: 1080 !important;
}
.jq-toast-single {
    border-radius: 6px !important;
    font-family: inherit !important;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    padding: 0.75rem 1rem !important;
}
.jq-toast-single h2 {
    font-size: 0.85rem !important;
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.jq-toast-single.jq-has-icon { padding-left: 2.5rem !important; }
.jq-icon-success { background-color: #00acac !important; }
.jq-icon-warning { background-color: #f59c1a !important; }
.jq-icon-error   { background-color: #ff5b57 !important; }
.jq-icon-info    { background-color: #348fe2 !important; }

/* 10. Modal + ticket-thread polish
   ------------------------------------------------------------- */
.modal-content {
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}
.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.06);
}
.list-group-item {
    transition: background-color .15s ease;
}
.list-group-item:hover {
    background-color: rgba(111,92,242,0.04) !important;
}

/* 11. Responsive small fixes
   ------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .breadcrumb.pull-right {
        float: none !important;
        margin-bottom: 0.5rem;
    }
    .page-header { font-size: 1.25rem; }
    .page-header small { display: block; margin-top: 4px; font-size: 0.85rem; }
    .panel.panel-inverse > .panel-body > .d-flex.flex-wrap {
        gap: 0.35rem;
    }
    .table-responsive { -webkit-overflow-scrolling: touch; }
}

/* 12. Misc helpers used in polish JS
   ------------------------------------------------------------- */
.text-monospace, .text-mono {
    font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}
.btn-block + .btn-block { margin-top: 0.35rem; }

/* 13. Charts (Polish-B) — wrappers + empty states + tuning
   ------------------------------------------------------------- */
.chart-wrap {
    position: relative;
    min-height: 200px;
}
.chart-wrap.compact { min-height: 160px; }
.chart-wrap.tall    { min-height: 320px; }

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    color: rgba(0,0,0,0.35);
    text-align: center;
    border: 1px dashed rgba(0,0,0,0.1);
    border-radius: 6px;
    background: rgba(0,0,0,0.015);
    min-height: 200px;
}
.chart-empty i {
    font-size: 28px;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}
.chart-empty-msg {
    font-size: 0.85rem;
    font-weight: 500;
}

.apexcharts-tooltip {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    border: 0 !important;
    border-radius: 6px !important;
}
.apexcharts-tooltip-title {
    background: rgba(111,92,242,0.08) !important;
    border-bottom: 0 !important;
    font-weight: 600;
}
.apexcharts-legend-text { font-size: 12px !important; }

/* small chart card variant */
.chart-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(0,0,0,0.55);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 14. Polish-B typography micro-tuning
   ------------------------------------------------------------- */
body { font-size: 13px; line-height: 1.5; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.2px; }
.page-header { font-size: 1.5rem; font-weight: 600; }
.page-header small {
    font-weight: 400;
    color: rgba(0,0,0,0.45);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}
.panel-title { font-size: 0.9rem; font-weight: 600; letter-spacing: 0.2px; }
.breadcrumb { font-size: 0.8rem; }
table { font-size: 0.875rem; }
table thead th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
.text-muted { color: rgba(0,0,0,0.45) !important; }
code { font-size: 0.82em; }

/* form control density tuning */
.form-control { font-size: 13px; }
.form-control-sm { font-size: 12px; padding: 0.18rem 0.45rem; }
label { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.25rem; }
.form-text, .help-block { font-size: 0.78rem; color: rgba(0,0,0,0.45); }

/* widget-stats density (used on dashboard + statistics) */
.widget.widget-stats {
    border-radius: 6px;
    overflow: hidden;
}
.widget.widget-stats .stats-title {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
}
.widget.widget-stats .stats-number {
    font-size: 28px;
    font-weight: 600;
}
.widget.widget-stats .stats-desc {
    font-size: 11px;
    opacity: 0.75;
}

/* 15. Polish-B responsive pass
   ------------------------------------------------------------- */
/* extra-small ≤ 575: compact action bars, breadcrumb full width */
@media (max-width: 575.98px) {
    body { font-size: 12.5px; }
    .page-header { font-size: 1.2rem; line-height: 1.3; }
    .breadcrumb.pull-right, .breadcrumb.float-xl-right {
        float: none !important;
        margin-bottom: 0.4rem;
        padding: 0.4rem 0.6rem;
    }
    .panel.panel-inverse > .panel-body { padding: 0.85rem; }
    .panel.panel-inverse > .panel-body > .d-flex.flex-wrap > .btn {
        flex: 1 1 auto;
        white-space: nowrap;
    }
    .widget.widget-stats .stats-number { font-size: 22px; }
    .widget.widget-stats .stats-icon { font-size: 26px; }
    .table-responsive table {
        font-size: 0.78rem;
    }
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        text-align: left;
        margin: 0.35rem 0;
    }
}

/* small ≤ 768: tablet portrait — column collapse for 8/4 layout */
@media (max-width: 767.98px) {
    .col-md-8, .col-md-4, .col-lg-8, .col-lg-4 { margin-bottom: 0.75rem; }
    .pagination { flex-wrap: wrap; }
    .pagination .page-item { margin-bottom: 0.25rem; }
}

/* medium ≤ 991: tablet landscape — sidebar overlay-friendly */
@media (max-width: 991.98px) {
    #content { padding: 1rem; }
    .form-row > [class*="col-"] { margin-bottom: 0.5rem; }
}

/* desktop ≥ 1200: ensure widgets row stays 4-up consistently */
@media (min-width: 1200px) {
    .widget.widget-stats .stats-content { padding-right: 0.5rem; }
}

/* Color Admin's sidebar minify behaviour: ensure body padding matches */
@media (min-width: 768px) {
    .page-with-light-sidebar .sidebar { box-shadow: 1px 0 6px rgba(0,0,0,0.04); }
}

/* 16. Action-bar shared helper (used as a reusable component class)
   ------------------------------------------------------------- */
.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.action-bar > .spacer { flex: 1; }

/* 17. table-row hover affordance */
.table.table-bordered tbody tr:hover,
.table.table-striped tbody tr:hover {
    background-color: rgba(111,92,242,0.05) !important;
}

/* keep last */
