/*
 * Custom CSS Overrides for Dashboard
 * This file contains fixes for theme CSS issues
 */

/* Fix for overflow-x hidden cutting off content on form pages */
/* The theme's body overflow-x: hidden can clip content in certain layouts */

.nxl-content .main-content {
    overflow: visible !important;
}

.nxl-content .main-content .row {
    overflow: visible !important;
}

/* Ensure cards in sidebar columns are not cut off */
.nxl-content .col-lg-4 .card {
    overflow: visible;
}

/* ============================================== */
/* Fix for table-responsive UI issues            */
/* ============================================== */

/* Reset white-space:nowrap which causes horizontal overflow */
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Custom horizontal scrollbar styles for responsive tables */
.table-responsive::-webkit-scrollbar {
    height: 8px !important;
    display: block !important;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f3f5 !important;
    border-radius: 10px !important;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 10px !important;
    border: 2px solid #f1f3f5 !important;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

.table-responsive .table td {
    white-space: normal;
    word-wrap: break-word;
}

/* Keep header text from wrapping for cleaner appearance */
.table-responsive .table thead th {
    white-space: nowrap;
}

/* For code elements (URLs, slugs), truncate with ellipsis if too long */
.table-responsive .table td code {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Ensure the table itself doesn't force overflow */
.table-responsive .table {
    table-layout: auto !important;
    width: 100% !important;
    min-width: 900px !important; /* Force minimum width to guarantee scrollability on tablets/mobile */
}

/* Action buttons column should not wrap */
.table-responsive .table td.text-end {
    white-space: nowrap;
}

/* Status and badge columns should not wrap */
.table-responsive .table td .badge {
    white-space: nowrap;
}
.nxl-navigation .navbar-wrapper .m-header {
    height: auto;
}

/*
 * Sidebar scroll area: theme uses calc(100vh - $header-height) on .navbar-content
 * while .m-header above is height:auto (large logo). Those heights no longer match,
 * which breaks vertical layout and scrolling on small viewports. Flex fixes it.
 */
.nxl-navigation .navbar-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
}

.nxl-navigation .navbar-wrapper .navbar-content {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    overflow: hidden;
}

.table-responsive .table td.text-end,
.table-responsive .table td:last-child {
    white-space: nowrap !important;
    text-align: right !important;
    display: table-cell !important;
    vertical-align: middle !important;
}
.table tbody td {
    vertical-align: middle !important;
    display: table-cell !important;
}
.btnsequal {display: flex;gap: 10px;}

/* ============================================== */
/* Lock dashboard font family to Inter            */
/* ============================================== */
html body,
html[class*="app-font-family-"] body {
    font-family: Inter, sans-serif !important;
}

/* ============================================== */
/* Quill Editor Table Support Styles             */
/* ============================================== */
.ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.ql-editor table td,
.ql-editor table th {
    border: 1px solid #ddd;
    padding: 8px;
    min-width: 50px;
}

.ql-editor table th {
    background-color: #f4f4f4;
    font-weight: bold;
    text-align: left;
}

.ql-editor table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ql-editor table tr:hover {
    background-color: #f1f1f1;
}

/* Quill Editor Enhanced Height */
.ql-container {
    font-size: 14px;
}

.ql-editor {
    min-height: 350px;
}

/* ============================================== */
/* Quill Editor - ULTIMATE Styling               */
/* ============================================== */

/* Enhanced Editor Container */
.ql-container {
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.ql-editor {
    min-height: 350px;
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
    line-height: 1.6;
}

/* Toolbar Styling */
.ql-toolbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px 4px 0 0;
    padding: 10px;
}

.ql-toolbar button:hover,
.ql-toolbar button:focus,
.ql-toolbar button.ql-active {
    color: #007bff !important;
}

.ql-toolbar .ql-stroke {
    stroke: #495057;
}

.ql-toolbar button:hover .ql-stroke,
.ql-toolbar button.ql-active .ql-stroke {
    stroke: #007bff;
}

.ql-toolbar .ql-fill {
    fill: #495057;
}

.ql-toolbar button:hover .ql-fill,
.ql-toolbar button.ql-active .ql-fill {
    fill: #007bff;
}

/* Enhanced Table Styling */
.ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
    table-layout: auto;
}

.ql-editor table td,
.ql-editor table th {
    border: 1px solid #ddd;
    padding: 10px;
    min-width: 50px;
    vertical-align: top;
}

.ql-editor table th {
    background-color: #f4f4f4;
    font-weight: 600;
    text-align: left;
    color: #333;
}

.ql-editor table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.ql-editor table tr:hover {
    background-color: #f1f1f1;
}

/* Horizontal Rule */
.ql-editor hr {
    border: none;
    border-top: 2px solid #ddd;
    margin: 20px 0;
}

/* Blockquote Styling */
.ql-editor blockquote {
    border-left: 4px solid #007bff;
    padding-left: 16px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

/* Code Block Styling */
.ql-editor pre.ql-syntax {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Link Styling */
.ql-editor a {
    color: #007bff;
    text-decoration: underline;
}

.ql-editor a:hover {
    color: #0056b3;
}

/* Image Styling */
.ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
}

.ql-editor img.resizable {
    cursor: pointer;
    border: 2px dashed transparent;
    transition: border-color 0.3s;
}

.ql-editor img.resizable:hover {
    border-color: #007bff;
}

/* Video Styling */
.ql-editor iframe {
    max-width: 100%;
    margin: 10px 0;
    border-radius: 4px;
}

/* List Styling */
.ql-editor ul,
.ql-editor ol {
    padding-left: 30px;
    margin: 10px 0;
}

.ql-editor li {
    margin: 5px 0;
}

/* Font Families */
.ql-font-arial { font-family: Arial, sans-serif; }
.ql-font-comic-sans { font-family: 'Comic Sans MS', cursive; }
.ql-font-courier-new { font-family: 'Courier New', monospace; }
.ql-font-georgia { font-family: Georgia, serif; }
.ql-font-helvetica { font-family: Helvetica, sans-serif; }
.ql-font-lucida { font-family: 'Lucida Sans Unicode', sans-serif; }
.ql-font-times-new-roman { font-family: 'Times New Roman', serif; }
.ql-font-verdana { font-family: Verdana, sans-serif; }

/* Custom Sizes */
.ql-size-8px { font-size: 8px; }
.ql-size-9px { font-size: 9px; }
.ql-size-10px { font-size: 10px; }
.ql-size-11px { font-size: 11px; }
.ql-size-12px { font-size: 12px; }
.ql-size-14px { font-size: 14px; }
.ql-size-16px { font-size: 16px; }
.ql-size-18px { font-size: 18px; }
.ql-size-20px { font-size: 20px; }
.ql-size-24px { font-size: 24px; }
.ql-size-28px { font-size: 28px; }
.ql-size-32px { font-size: 32px; }
.ql-size-36px { font-size: 36px; }
.ql-size-48px { font-size: 48px; }
.ql-size-64px { font-size: 64px; }
.ql-size-72px { font-size: 72px; }

/* Source Code Textarea */
.quill-source-code {
    font-family: 'Courier New', monospace !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6 !important;
    border-radius: 0 0 4px 4px;
}

.quill-source-code:focus {
    outline: none;
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Placeholder Styling */
.ql-editor.ql-blank::before {
    color: #adb5bd;
    font-style: italic;
}

/* Scrollbar Styling */
.ql-editor::-webkit-scrollbar {
    width: 8px;
}

.ql-editor::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ql-editor::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ql-editor::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Emoji Picker Styling */
#emoji-picker {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Responsive Toolbar */
@media (max-width: 768px) {
    .ql-toolbar {
        padding: 5px;
    }
    
    .ql-toolbar button {
        width: 24px;
        height: 24px;
    }
}

/* ============================================================
   FLOATING SUPPORT CHATBOTS (WHATSAPP & EYE TOOLTIP)
   ============================================================ */
.bottom-whatsapp-icon {
  position: fixed;
  bottom: 90px;
  right: 53px;
  z-index: 999;
}
.bottom-whatsapp-icon img {
  width: 55px;
  height: auto;
}
.tooltiptext {
  position: absolute;
  bottom: 24px;
  right: -150px;
  transform: translateX(-50%);
  background-color: #ffffff;
  color: #858c8e;
  padding: 11px 12px;
  border-radius: 4px;
  font-size: 13px;
  width: 300px;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 10;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.25);
  border: 1px solid #dee2e6;
}
.bottom-eye-icon {
  position: fixed;
  bottom: 144px;
  right: 50px;
  z-index: 999;
  cursor: pointer;
}
.bottom-eye-icon img.eye-num {
  width: 21px;
  height: auto;
}
.bottom-eye-icon:hover .tooltiptext {
  opacity: 1;
  visibility: visible;
}
.bottom-whatsapp-icon:hover .tooltiptext {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 767px) {
  .bottom-eye-icon {
    right: 7px;
  }
  .bottom-whatsapp-icon {
    right: 13px;
  }
}

@media only screen and (max-width: 576px) and (min-width: 320px) {
  .bottom-whatsapp-icon img {
    width: 42px;
  }
  .tooltiptext {
    right: -141px;
    width: 288px;
  }
  .bottom-eye-icon img.eye-num {
    width: 16px;
  }
  .bottom-eye-icon {
    bottom: 131px;
  }
}

/* ============================================================
   TABLET RESPONSIVENESS AND HEADER WRAPPING FOR LISTING PAGES
   ============================================================ */
@media (max-width: 1024px) {
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
        height: auto !important;
        padding-bottom: 15px !important;
    }
    
    .page-header-left, .page-header-right {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        flex: 0 0 100% !important;
    }

    .page-header-right > div,
    .page-header-right-items-wrapper,
    .page-header-right-items {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100% !important;
    }

    /* Make search & filter forms wrap elegantly */
    .page-header-right form {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 10px !important;
        width: 100% !important;
    }

    .page-header-right form > * {
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }

    /* Prevent text button labels from wrapping inside icons */
    .page-header-right .btn {
        white-space: nowrap !important;
    }
}

/* ============================================================
   DROPDOWN Z-INDEX FIX — prevent dropdowns from being clipped
   by parent elements with overflow:hidden (table cards, etc.)
   ============================================================ */

/* Dropdowns inside table rows must always float above content */
.table td .dropdown-menu,
.table .dropdown-menu {
    z-index: 1055 !important;
}

/* position-static on dropdown parent lets Bootstrap position the
   menu relative to the viewport rather than the clipped container */
.table td .dropdown.position-static {
    position: static !important;
}

/* ============================================================
   ORDERS PAGE — filter bar & export button alignment
   ============================================================ */
.page-header-right .d-flex.gap-2.flex-wrap {
    flex-wrap: wrap !important;
}

@media (max-width: 1024px) {
    /* Orders / pages with dual-form header rows */
    .page-header-right form.m-0 {
        flex: 0 0 auto !important;
    }
}

/* ============================================================
   ORDERS FILTER BAR — responsive wrapping at tablet widths
   ============================================================ */
@media (max-width: 1200px) {
    #orderFilterForm {
        flex-wrap: wrap !important;
    }

    #orderFilterForm .input-group {
        width: 100% !important;
        min-width: unset !important;
    }

    #orderFilterForm select {
        flex: 1 1 140px !important;
        max-width: none !important;
    }
}
