/**
 * Responsive layout overrides
 * Loads last - makes site fully responsive without changing design
 */

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Containers - full width on small screens */
@media (max-width: 1199px) {
  .container,
  .container-fluid {
    max-width: 100%;
    padding-left: 20px;
    padding-right: 20px;
  }
}

@media (max-width: 991px) {
  .container,
  .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 767px) {
  .container,
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 575px) {
  .container,
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Login dropdown - fit viewport on mobile */
@media (max-width: 991px) {
  .login_container {
    left: 15px !important;
    right: 15px !important;
    max-width: none !important;
  }
}

/* Images - prevent overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Cab (user account) - stack sidebar and content on mobile */
@media (max-width: 991px) {
  .cab_holder {
    display: block;
    width: 100%;
  }
  .cab_holder .leftmenu {
    float: none;
    width: 100%;
    min-height: 0;
    margin-bottom: 16px;
    background-image: none;
  }
  .cab_container {
    float: none;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    box-sizing: border-box;
  }
}

/* Cab - add mobile menu toggle for small screens */
@media (max-width: 767px) {
  .cab-menu-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 16px;
    font-size: 16px;
    background: #3F3D3D;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
  }
  .cab-menu-toggle-icon {
    display: inline-block;
    width: 20px;
    height: 2px;
    margin-right: 10px;
    background: currentColor;
    box-shadow: 0 6px 0 currentColor, 0 -6px 0 currentColor;
  }
  .cab_holder .leftmenu {
    display: none;
  }
  .cab_holder.cab-leftmenu-open .leftmenu {
    display: block;
  }
  .cab_holder .leftmenu a {
    padding: 10px 12px;
  }
}

@media (min-width: 768px) {
  .cab-menu-toggle {
    display: none;
  }
}

/* Simplepage forms - full width on mobile */
@media (max-width: 767px) {
  .form-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
}

/* Tables - scroll horizontally if needed */
@media (max-width: 991px) {
  .cab_container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Form inputs - full width on mobile */
@media (max-width: 767px) {
  .formblock,
  .formblock input,
  .formblock select,
  .formblock textarea,
  .form-field-box input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
}

/* Footer columns - stack on mobile */
@media (max-width: 991px) {
  .cs_footer .row [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
}

/* Order a test kit - cards in 1 column on mobile */
@media (max-width: 767px) {
  .cab_container .order-test-kit-cards,
  .cab_container .st_order0.d-flex,
  .cab_container .d-flex.st_order0 {
    flex-direction: column;
    align-items: stretch;
  }
  .cab_container .order-test-kit-cards .card,
  .cab_container .st_order0 .card,
  .cab_container .d-flex.st_order0 .card {
    min-width: 0;
    width: 100%;
    margin: 10px 0;
  }
  .cab_container .order-test-kit-form-row {
    flex-direction: column !important;
  }
  .cab_container .order-test-kit-form-col {
    width: 100% !important;
    padding: 0 0 10px 0 !important;
  }
}

/* My patients table - fit on screen, no scroll; wrap/split rows on mobile */
@media (max-width: 767px) {
  .cab_container .mypatients-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  .cab_container .mypatients-table-wrap.brws_l {
    height: auto !important;
  }
  .cab_container .mypatients-table {
    width: 100%;
    table-layout: fixed;
  }
  .cab_container .mypatients-table thead .legend {
    display: block;
  }
  .cab_container .mypatients-table thead .legend td {
    display: block;
    padding: 8px 0;
  }
  .cab_container .mypatients-table thead .legend td:first-child {
    font-weight: bold;
  }
  .cab_container .mypatients-table thead .legend td:nth-child(2) {
    padding-left: 0;
  }
  .cab_container .mypatients-table thead .legend td:nth-child(3) {
    padding-left: 0;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
  }
  .cab_container .mypatients-table thead .legend td > div {
    float: none !important;
    width: 100%;
  }
  .cab_container .mypatients-table thead .legend select {
    margin-left: 0 !important;
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
  }
  .cab_container .mypatients-table tbody tr {
    display: block;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 0;
  }
  .cab_container .mypatients-table tbody tr:hover {
    background-color: rgba(0, 141, 210, 0.08);
  }
  .cab_container .mypatients-table tbody td {
    display: block;
    padding: 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
  }
  .cab_container .mypatients-table tbody td::before {
    font-weight: bold;
    display: inline-block;
    min-width: 80px;
    margin-right: 6px;
  }
  .cab_container .mypatients-table tbody td:nth-child(1)::before {
    content: "Name: ";
  }
  .cab_container .mypatients-table tbody td:nth-child(2)::before {
    content: "Date/time: ";
  }
  .cab_container .mypatients-table tbody td:nth-child(3)::before {
    content: "Email: ";
  }
  .cab_container .mypatients-table tbody td:nth-child(4)::before {
    content: "Tests: ";
  }
  .cab_container .mypatients-table tbody td a {
    display: inline-block;
    margin-top: 4px;
    max-width: 100%;
  }
}

/* Your patient's data - mobile responsive */
@media (max-width: 767px) {
  .cab_container .spc {
    display: block !important;
    width: 100%;
    max-width: 100%;
    padding: 16px;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }
  .cab_container .tbll2 {
    width: 100%;
  }
  .cab_container .tbll2 tr {
    display: block;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
  }
  .cab_container .tbll2 tr:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
  .cab_container .tbll2 td {
    display: block;
    padding: 4px 0;
    padding-left: 0 !important;
  }
  .cab_container .tbll2 td:nth-child(1),
  .cab_container .tbll2 td:nth-child(3) {
    font-weight: bold;
  }
  .cab_container .tbll2 td:nth-child(3) {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
  }
  .cab_container .tbll2 td:nth-child(2),
  .cab_container .tbll2 td:nth-child(4) {
    padding-left: 0;
    margin-bottom: 4px;
  }
  .cab_container .tbll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
  }
  .cab_container .tbll {
    min-width: 400px;
  }
  .cab_container #addnewtest {
    width: 100%;
    box-sizing: border-box;
  }
}

/* User account (My account) - mobile responsive */
@media (max-width: 767px) {
  .cab_container .user-account-info {
    display: block !important;
    width: 100%;
    max-width: 100%;
  }
  .cab_container .c_data_phone,
  .cab_container .c_data_email {
    display: block !important;
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    margin-top: 16px;
    box-sizing: border-box;
  }
  .cab_container .c_data_phone h5,
  .cab_container .c_data_email h5 {
    margin-left: 32px;
  }
  .cab_container .cd_phone {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  .cab_container .cd_phone_num,
  .cab_container .cd_phone_comment {
    display: block !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left;
  }
  .cab_container .cd_phone_num {
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
  }
  .cab_container .cd_phone_comment {
    border-radius: 0 0 8px 8px;
    margin-bottom: 8px;
  }
  .cab_container .acd_addr {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .cab_container h1 {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .cab_container h1 span[style*="float:right"] {
    float: none !important;
    display: block;
    margin-top: 8px;
  }
}
/* My patients ordering a test (myptests) - actions below row on mobile */
@media (max-width: 767px) {
  .cab_container .myptests-table tr {
    display: block;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .cab_container .myptests-table td {
    display: block;
    padding: 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .cab_container .myptests-table td::before {
    font-weight: bold;
    display: inline-block;
    min-width: 70px;
    margin-right: 6px;
  }
  .cab_container .myptests-table td:nth-child(1)::before { content: "Patient: "; }
  .cab_container .myptests-table td:nth-child(2)::before { content: "Code: "; }
  .cab_container .myptests-table td:nth-child(3)::before { content: "Date: "; }
  .cab_container .myptests-table td:nth-child(4)::before { content: "Status: "; }
  .cab_container .myptests-table td:nth-child(5)::before { content: "Actions: "; }
  .cab_container .myptests-table td:nth-child(5) {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
  }
  .cab_container .myptests-table td:nth-child(5) a {
    display: inline-block;
    margin: 4px 8px 4px 0;
  }
}