/*
* demo.css
* File include item demo only specific css only
******************************************************************************/

.menu .app-brand.demo {
  height: 64px;
}

.dark-style .menu .app-brand.demo {
  height: 64px;
}

.app-brand-logo.demo svg {
  width: 30px;
  height: 24px;
}

.app-brand-text.demo {
  font-size: 1.25rem;
}

/* ! For .layout-navbar-fixed added fix padding top tpo .layout-page */
.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page {
  padding-top: 64px !important;
}

/* Navbar page z-index issue solution */
.content-wrapper .navbar {
  z-index: auto;
}

/*
* Content
******************************************************************************/

.demo-blocks > * {
  display: block !important;
}

.demo-inline-spacing > * {
  margin: 1rem 0.375rem 0 0 !important;
}

/* ? .demo-vertical-spacing class is used to have vertical margins between elements. To remove margin-top from the first-child, use .demo-only-element class with .demo-vertical-spacing class. For example, we have used this class in forms-input-groups.html file. */
.demo-vertical-spacing > * {
  margin-top: 1.25rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-lg > * {
  margin-top: 1.875rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-lg.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-xl > * {
  margin-top: 5rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-xl.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.rtl-only {
  display: none !important;
  text-align: left !important;
  direction: ltr !important;
}

[dir='rtl'] .rtl-only {
  display: block !important;
}

/* Dropdown buttons going out of small screens */
@media (max-width: 576px) {
  #dropdown-variation-demo .btn-group .text-truncate {
    width: 300px;
    position: relative;
  }
  #dropdown-variation-demo .btn-group .text-truncate::after {
    position: absolute;
    top: 45%;
    right: 0.65rem;
  }
}
/*
* Layout demo
******************************************************************************/

.layout-demo-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  margin-top: 1.25rem;
}
.layout-demo-placeholder img {
  width: 900px;
}
.layout-demo-info {
  text-align: center;
  margin-top: 1.25rem;
}

/*
* DataTables Responsive Improvements
******************************************************************************/

/* Ensure DataTables container doesn't overflow on small screens */
.card-datatable {
  overflow-x: auto;
  overflow-y: hidden;
}

.dataTables_wrapper {
  overflow-x: hidden;
  width: 100%;
}

table.dataTable {
  width: 100% !important;
}

/* DataTables responsive utility classes */
@media (min-width: 992px) {
  .card-datatable {
    overflow-x: hidden;
  }
}

@media (max-width: 575.98px) {
  .dt-buttons {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .dt-buttons .btn {
    flex: 1;
    min-width: 45%;
  }
  
  .card-datatable .table td, 
  .card-datatable .table th {
    white-space: nowrap;
  }
  
  /* Adjust DataTables filter and length controls for mobile */
  .card-datatable .row:first-child {
    flex-direction: column;
    gap: 1rem;
  }
  
  .card-datatable .row:first-child > div {
    width: 100%;
  }
  
  /* Make DataTables search box full width on mobile */
  .card-datatable .dataTables_filter input {
    width: 100%;
    margin-left: 0 !important;
  }
  
  /* Adjust DataTables length selector for mobile */
  .card-datatable .dataTables_length select {
    margin-left: 0 !important;
    margin-right: 0.5rem;
  }
  
  /* Additional mobile adaptations for DataTables */
  .card-datatable .table-responsive {
    border: none;
  }
  
  .dataTables_wrapper .row:last-child {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  
  .dataTables_wrapper .row:last-child > div {
    width: 100%;
    text-align: center !important;
  }
  
  .dataTables_info {
    text-align: center;
    margin-bottom: 0.5rem;
  }
  
  .dataTables_paginate {
    display: flex;
    justify-content: center;
  }
  
  .paginate_button {
    padding: 0.5rem 0.75rem;
    margin: 0 0.1rem;
    font-size: 0.875rem;
  }
}

/* Medium screens */
@media (min-width: 576px) and (max-width: 767.98px) {
  .card-datatable .table td, 
  .card-datatable .table th {
    padding: 0.5rem;
  }
  
  .dataTables_wrapper .row:first-child {
    flex-direction: column;
    gap: 1rem;
  }
  
  .dataTables_wrapper .row:first-child > div {
    width: 100%;
  }
}

/* Small tablets and large phones */
@media (min-width: 481px) and (max-width: 768px) {
  .dt-buttons .btn {
    min-width: 30%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  .paginate_button {
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
  }
}

/* Hide DataTables info text on very small screens */
@media (max-width: 400px) {
  .dataTables_info {
    font-size: 0.8rem;
  }
  
  .dt-buttons .btn {
    min-width: 100%;
    margin-bottom: 0.25rem;
  }
  
  .paginate_button {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .card-datatable .table td,
  .card-datatable .table th {
    padding: 0.25rem;
  }
}

/* Dashboard specific responsive improvements */
@media (max-width: 767.98px) {
  /* Stack dashboard statistics cards vertically on mobile */
  .row.gy-4.mb-4 .col-md-4,
  .row.gy-4.mb-4 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Adjust dashboard header for mobile */
  .card .d-flex.justify-content-between.flex-wrap.gap-4 {
    flex-direction: column;
    gap: 1rem !important;
    text-align: center;
  }
  
  .card .d-flex.justify-content-between.flex-wrap.gap-4 .text-end {
    text-align: center !important;
  }
  
  /* Stack pending tasks and quick actions vertically on mobile */
  .row.gy-4.mb-4 .col-md-8,
  .row.gy-4.mb-4 .col-md-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Adjust quick actions buttons for mobile */
  .card-body .row.gy-3 .col-sm-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Center align quick action buttons on mobile */
  .btn.d-flex.align-items-center.w-100 {
    justify-content: center;
  }
}

/* List pages responsive improvements */
@media (max-width: 767.98px) {
  /* Stack filter controls vertically on mobile */
  .row.mb-3 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  /* Adjust statistics cards on mobile */
  .row.gy-4.mb-4 .col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
    margin-bottom: 1rem;
  }
  
  /* Center align card headers on mobile */
  .card-header.d-flex.align-items-center.justify-content-between {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .card-header.d-flex.align-items-center.justify-content-between .btn {
    width: 100%;
    max-width: 200px;
  }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
  /* Make statistics cards full width on very small screens */
  .row.gy-4.mb-4 .col-md-4,
  .row.gy-4.mb-4 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Adjust filter controls for very small screens */
  .row.mb-3 .col-md-3 {
    margin-bottom: 0.75rem;
  }
  
  /* Reduce padding on very small screens */
  .card {
    margin-bottom: 0.75rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Optimize card content for small screens */
  .card .d-flex.justify-content-between.align-items-center {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .card .d-flex.justify-content-between.align-items-center .avatar {
    margin-bottom: 0.5rem;
  }
  
  /* Adjust statistics text for small screens */
  .card h2.mb-1 {
    font-size: 1.5rem;
  }
  
  .card .mt-3 {
    text-align: center;
  }
}

/* Small screens optimizations for all cards */
@media (max-width: 767.98px) {
  /* Ensure cards maintain proper spacing on mobile */
  .card.h-100 {
    min-height: auto;
    margin-bottom: 1rem;
  }
  
  /* Center card content on mobile */
  .card-body {
    text-align: center;
  }
  
  /* Stack card header elements vertically on mobile */
  .card-header.d-flex.align-items-center.justify-content-between {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  /* Adjust card title alignment */
  .card-title {
    margin-bottom: 0.5rem;
  }
  
  /* Optimize avatar display on mobile */
  .avatar-initial {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
}

/* Improve touch targets for mobile */
@media (max-width: 767.98px) {
  .btn {
    min-height: 44px; /* Minimum touch target size */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem; /* Increase padding for better touch targets */
  }
  
  .form-control,
  .form-select {
    min-height: 44px; /* Minimum touch target size */
    padding: 0.75rem 1rem; /* Increase padding for better touch targets */
  }
  
  /* Enhance form labels for mobile readability */
  .form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
  }
  
  /* Optimize modal buttons for touch */
  .modal-footer .btn {
    min-width: 100px;
    margin: 0 0.25rem;
  }
  
  /* Improve checkbox and radio button touch targets */
  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.25rem;
  }
  
  .form-check-label {
    padding: 0.5rem 0;
    margin-left: 0.5rem;
  }
  
  /* Increase spacing for mobile */
  .mb-4 {
    margin-bottom: 1.5rem !important;
  }
  
  .gy-4 {
    --bs-gutter-y: 1.5rem;
  }
  
  .gy-3 {
    --bs-gutter-y: 1rem;
  }
  
  /* Optimize data tables for touch */
  .table th,
  .table td {
    padding: 0.75rem;
  }
  
  /* Ensure action buttons in tables are touch-friendly */
  .btn-sm {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
  }
}

/* Very small screen optimizations */
@media (max-width: 480px) {
  /* Further increase touch target sizes */
  .btn {
    min-height: 48px;
    padding: 1rem 1.25rem;
  }
  
  .form-control,
  .form-select {
    min-height: 48px;
    padding: 1rem 1.25rem;
  }
  
  /* Optimize modal dialogs for small screens */
  .modal-dialog {
    margin: 1rem;
  }
  
  .modal-content {
    border-radius: 0.5rem;
  }
  
  /* Adjust form spacing for very small screens */
  .row .col-md-6.mb-3 {
    margin-bottom: 1.25rem !important;
  }
}

/* DataTables responsive collapsed row styling */
table.dataTable.dtr-column > tbody > tr > td.control,
table.dataTable.dtr-column > tbody > tr > th.control {
  cursor: pointer;
  text-align: center;
}

table.dataTable.dtr-column > tbody > tr > td.control:before,
table.dataTable.dtr-column > tbody > tr > th.control:before {
  content: '\25BC';
  display: inline-block;
  font-family: 'Material Design Icons';
  font-size: 0.875rem;
  color: #696cff;
  vertical-align: middle;
  margin-right: 0.25rem;
  line-height: 1;
}

table.dataTable.dtr-column > tbody > tr.parent > td.control:before,
table.dataTable.dtr-column > tbody > tr.parent > th.control:before {
  content: '\25B2';
}

/* DataTables child rows */
table.dataTable > tbody > tr.child {
  background-color: rgba(105, 108, 255, 0.03);
}

table.dataTable > tbody > tr.child:hover {
  background-color: rgba(105, 108, 255, 0.05);
}

table.dataTable > tbody > tr.child ul.dtr-details {
  width: 100%;
  display: block;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
  border-bottom: none;
  padding: 0.5rem 0;
}

table.dataTable > tbody > tr.child ul.dtr-details > li:first-child {
  padding-top: 0;
}

table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

table.dataTable > tbody > tr.child span.dtr-title {
  display: inline-block;
  min-width: 75px;
  font-weight: 500;
}

/* Prevent table header from wrapping and causing width issues */
table.dataTable thead th {
  white-space: nowrap;
}

/* General DataTables responsive improvements */
@media screen and (max-width: 768px) {
  .dataTables_wrapper {
    overflow-x: auto;
  }
  
  table.dataTable {
    width: 100% !important;
  }
  
  .table-responsive .dataTables_wrapper {
    overflow-x: visible;
  }
  
  /* Ensure DataTables controls are properly spaced on small screens */
  .dataTables_wrapper .row > div {
    margin-bottom: 0.5rem;
  }
}

/* Autocomplete styles for policy customer search */
.autocomplete-items {
  position: absolute;
  border: 1px solid #d4d4d4;
  border-bottom: none;
  border-top: none;
  z-index: 99;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background-color: #fff;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.autocomplete-item {
  padding: 10px;
  cursor: pointer;
  background-color: #fff;
  border-bottom: 1px solid #d4d4d4;
}

.autocomplete-item:hover {
  background-color: #e9ecef;
}

.autocomplete-item:last-child {
  border-bottom: none;
}
