/* TSYS Offline Website - Responsive CSS Framework */

/* ===================================================================
   Mobile-First Approach: Base styles for mobile, override at larger breakpoints
   =================================================================== */

/* ===================================================================
   TABLET LAYOUT (768px - 979px)
   Override fixed widths for fluid layout
   =================================================================== */

@media screen and (max-width: 979px) {
  body.bd .main {
    width: 100% !important;
    padding: 0 15px;
    box-sizing: border-box;
  }

  body.bd #ja-wrapper {
    min-width: 100% !important;
  }

  /* Prevent horizontal scrolling on tablet */
  body {
    overflow-x: hidden;
  }

  /* Stack content sections on smaller screens */
  #ja-current-content,
  #ja-inset1 {
    width: 100% !important;
    float: none !important;
    margin-bottom: 20px;
  }

  /* Responsive images */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Adjust slideshow */
  #ja-slideshow .ja-slide-main,
  #ja-slideshow img {
    max-width: 100%;
    height: auto;
  }

  /* Make search box responsive */
  #ja-search {
    width: 100%;
  }

  #ja-search input[type="text"] {
    width: 100%;
    max-width: 100%;
  }

  /* Stack contact bar items on smaller devices */
  .quick-contact {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-contact li {
    margin: 5px 0;
  }
}

/* ===================================================================
   MOBILE LAYOUT (320px - 767px)
   Aggressive transformations for small screens
   =================================================================== */

@media screen and (max-width: 767px) {
  /* Prevent horizontal scrolling */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
  }

  body {
    font-size: 14px;
    margin: 0;
    padding: 0;
  }

  body.bd .main {
    width: 100% !important;
    padding: 10px;
    box-sizing: border-box;
  }

  /* ===== HEADER LAYOUT ===== */

  /* Hide desktop mega menu, show mobile menu button */
  .ja-megamenu {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: block !important;
  }

  /* Stack header elements vertically */
  #ja-header .main-inner1 {
    flex-direction: column;
    align-items: stretch;
  }

  .logo {
    text-align: center;
    margin-bottom: 15px;
    width: 100%;
  }

  .logo a {
    display: block;
    font-size: 1.2em;
  }

  /* Full-width search on mobile */
  #ja-search {
    width: 100%;
    margin-bottom: 10px;
  }

  #ja-search .search {
    width: 100%;
  }

  #ja-search input[type="text"],
  #ja-search input[type="submit"] {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
  }

  /* ===== TYPOGRAPHY ===== */

  h1 {
    font-size: 1.75em;
    margin: 15px 0 10px 0;
  }

  h2 {
    font-size: 1.5em;
    margin: 12px 0 8px 0;
  }

  h3 {
    font-size: 1.25em;
  }

  p {
    line-height: 1.5;
    margin-bottom: 10px;
  }

  /* ===== NAVIGATION ===== */

  /* Stack quick contact info */
  .quick-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: 13px;
  }

  .quick-contact li {
    margin: 5px 0;
    width: 100%;
  }

  /* ===== CONTENT LAYOUT ===== */

  #ja-contentwrap {
    display: block !important;
  }

  #ja-current-content,
  #ja-inset1 {
    width: 100% !important;
    float: none !important;
    display: block;
    margin-bottom: 20px;
  }

  /* ===== IMAGES ===== */

  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  img[style*="float"] {
    float: none !important;
    margin-bottom: 10px;
  }

  /* Responsive slideshow */
  #ja-slideshow {
    width: 100%;
  }

  #ja-slideshow .ja-slide-main {
    max-width: 100%;
    height: auto;
    max-height: 300px;
  }

  #ja-slideshow img {
    max-width: 100%;
    height: auto;
  }

  /* ===== TABLES ===== */

  table.category {
    width: 100%;
    font-size: 12px;
  }

  table.category thead {
    display: none;
  }

  table.category tbody tr {
    display: block;
    border-bottom: 2px solid #ccc;
    margin-bottom: 10px;
  }

  table.category td {
    display: block;
    text-align: left;
    padding: 8px 0;
  }

  table.category td:before {
    font-weight: bold;
    width: 100px;
    display: inline-block;
  }

  /* ===== FORMS ===== */

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 16px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  input[type="submit"],
  input[type="button"],
  button.buttontext {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }

  /* ===== FOOTER ===== */

  #ja-footer {
    font-size: 12px;
  }

  .ja-copyright small {
    display: block;
    margin-bottom: 5px;
  }

  /* ===== CONTACT PAGE ===== */

  .contact-address,
  .contact-contactinfo {
    width: 100%;
    margin-bottom: 15px;
  }

  address {
    font-size: 13px;
    line-height: 1.4;
  }

  .contact-name {
    display: block;
    font-size: 1.3em;
    margin-bottom: 10px;
  }

  /* ===== BREADCRUMB ===== */

  .breadcrumbs {
    font-size: 12px;
    margin: 10px 0;
  }

  /* ===== MENU STYLES ===== */

  .menu {
    width: 100%;
  }

  .menu li {
    display: block;
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
  }

  .menu a {
    display: block;
    padding: 8px 5px;
  }

  /* ===== SPACING ADJUSTMENTS ===== */

  .clearfix {
    clear: both;
  }

  /* Ensure touch targets are at least 44px */
  a,
  button {
    min-height: 44px;
    display: inline-block;
    padding: 10px 15px;
  }

  button.mobile-menu-toggle {
    padding: 12px 15px;
  }
}

/* ===================================================================
   MOBILE MENU STYLES
   =================================================================== */

/* Mobile menu button (hamburger) */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 60px;
  right: 15px;
  z-index: 1000;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  width: 50px;
  height: 50px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background-color: #333;
  margin: 4px 0;
  display: block;
  transition: 0.3s;
  border-radius: 3px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-menu-overlay.active {
  display: block;
}

/* Mobile menu drawer */
.mobile-menu-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background-color: white;
  z-index: 1001;
  overflow-y: auto;
  transition: right 0.3s ease-in-out;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

.mobile-menu-drawer.active {
  display: block;
  right: 0;
}

.mobile-menu-drawer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 70px;
}

.mobile-menu-drawer li {
  display: block;
  border-bottom: 1px solid #eee;
}

.mobile-menu-drawer a {
  display: block;
  padding: 15px 20px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s;
}

.mobile-menu-drawer a:active,
.mobile-menu-drawer a:hover {
  background-color: #f5f5f5;
  color: #0066cc;
}

/* ===================================================================
   EXTRA SMALL DEVICES (320px - 479px)
   =================================================================== */

@media screen and (max-width: 479px) {
  h1 {
    font-size: 1.4em;
  }

  h2 {
    font-size: 1.2em;
  }

  h3 {
    font-size: 1.1em;
  }

  body {
    font-size: 13px;
  }

  table.category {
    font-size: 11px;
  }

  .mobile-menu-drawer {
    right: -240px;
    width: 240px;
  }
}

/* ===================================================================
   LANDSCAPE MODE
   =================================================================== */

@media screen and (max-height: 600px) and (orientation: landscape) {
  body.bd .main {
    padding: 5px;
  }

  #ja-header {
    padding: 5px 0;
  }

  #ja-slideshow {
    max-height: 150px;
  }

  #ja-slideshow .ja-slide-main {
    max-height: 150px;
  }
}

/* ===================================================================
   READMORE LINK STYLING
   =================================================================== */

p.readmore {
  margin: 0;
  clear: both;
}

p.readmore a {
  background: url('../templates/ja_portfolio/images/check_alt_12x12.png') no-repeat 5px 5px;
  border: 1px solid transparent;
  color: #525253;
  display: block;
  float: right;
  font-size: 92%;
  text-transform: uppercase;
  padding: 3px 5px 3px 22px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

p.readmore a:hover,
p.readmore a:focus,
p.readmore a:active {
  background-color: #f0f0f0;
  border-color: #dedede;
  color: #525253;
  text-decoration: none;
  text-shadow: 0 1px 1px #fff;
}

/* Mobile readmore styling */
@media screen and (max-width: 767px) {
  p.readmore a {
    display: block;
    float: none;
    padding: 8px 5px 8px 25px;
    min-height: 44px;
    line-height: 1.6;
  }
}

/* ===================================================================
   UTILITY CLASSES
   =================================================================== */

@media screen and (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }

  .mobile-center {
    text-align: center;
  }

  .mobile-full-width {
    width: 100% !important;
  }
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */

@media print {
  .mobile-menu-toggle,
  .mobile-menu-overlay,
  .mobile-menu-drawer,
  .ja-megamenu {
    display: none !important;
  }

  body.bd .main {
    width: 100% !important;
    padding: 0 !important;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}
