/*
 * WiseLeaf Professional OJS Theme - Responsive Fixes
 * Critical responsive improvements for mobile and tablet devices
 * Compatible with OJS 3.x theme architecture
 */

/* Fix OJS Container Responsiveness */
.pkp_site_name_wrapper,
.pkp_navigation_primary_wrapper,
.pkp_navigation_user,
.pkp_search_mobile,
.pkp_structure_content,
.pkp_structure_footer {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Enhanced Mobile Navigation */
@media (max-width: 767px) {
  .pkp_structure_head {
    padding: 0;
  }
  
  .pkp_site_name_wrapper {
    height: auto;
    min-height: 60px;
  }
  
  .pkp_site_name {
    position: relative;
    left: auto;
    right: auto;
    padding: 1rem;
    text-align: center;
    white-space: normal;
    font-size: 1.1rem !important;
  }
  
  .pkp_site_name .is_text {
    line-height: 1.4;
    font-size: 1.1rem !important;
  }
  
  .pkp_site_name .is_img img {
    max-height: 50px;
    display: block;
    margin: 0 auto;
  }
  
  /* Mobile Navigation Menu Improvements */
  .pkp_site_nav_menu {
    position: relative;
    top: auto;
    padding: 1rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
  }
  
  .pkp_nav_list a {
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .pkp_nav_list ul {
    margin-left: 1rem;
  }
  
  .pkp_navigation_user {
    margin-top: 1rem;
    padding-top: 1rem;
  }
  
  .pkp_navigation_search_wrapper {
    margin-top: 1rem;
    padding-top: 1rem;
  }
}

/* Tablet Responsive Improvements */
@media (min-width: 768px) and (max-width: 1023px) {
  .pkp_site_name_wrapper,
  .pkp_navigation_primary_wrapper,
  .pkp_structure_content {
    width: 100%;
    max-width: 750px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  .pkp_site_name .is_text {
    font-size: 1.5rem;
  }
  
  .pkp_navigation_primary > li > a {
    margin: 0.5rem 0.25rem 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Fix Article Content Responsiveness */
.pkp_structure_main {
  padding: 1rem;
  overflow-x: hidden;
}

@media (max-width: 767px) {
  .pkp_structure_main {
    padding: 1rem 0.5rem;
  }
  
  /* Fix article content overflow */
  .obj_article_details,
  .article-details-block,
  .item.article {
    overflow-x: hidden;
    word-wrap: break-word;
  }
  
  /* Responsive tables in articles */
  .obj_article_details table,
  .article-details-block table {
    width: 100%;
    font-size: 0.875rem;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  
  .obj_article_details table th,
  .obj_article_details table td,
  .article-details-block table th,
  .article-details-block table td {
    padding: 0.5rem 0.25rem;
    min-width: 80px;
  }
}

/* Fix Form Responsiveness */
.pkp_form input[type="text"],
.pkp_form input[type="email"],
.pkp_form input[type="password"],
.pkp_form textarea,
.pkp_form select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .pkp_form .section {
    margin-bottom: 1.5rem;
  }
  
  .pkp_form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
  }
  
  .pkp_form input,
  .pkp_form textarea,
  .pkp_form select {
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
  }
  
  .pkp_form .buttons {
    text-align: center;
    margin-top: 1.5rem;
  }
  
  .pkp_form .buttons .pkp_button {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }
}

/* Fix Search Form Responsiveness */
.cmp_search {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 767px) {
  .cmp_search .search_controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .cmp_search input[type="search"] {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
  }
  
  .cmp_search .search_prompt {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }
}

/* Fix Sidebar Responsiveness */
@media (max-width: 991px) {
  .pkp_structure_sidebar {
    float: none;
    width: 100%;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
  }
  
  .pkp_structure_main {
    float: none;
    width: 100%;
  }
  
  .pkp_structure_main:first-child:last-child {
    margin-top: 0;
  }
}

/* Fix Issue Grid/List Responsiveness */
.cmp_issue_list .obj_issue_summary {
  margin-bottom: 2rem;
  overflow: hidden;
}

@media (max-width: 767px) {
  .cmp_issue_list .obj_issue_summary {
    text-align: center;
  }
  
  .obj_issue_summary .cover {
    float: none;
    margin: 0 auto 1rem;
    display: block;
  }
  
  .obj_issue_summary .description {
    float: none;
    width: 100%;
  }
}

/* Fix Article Lists */
.cmp_article_list .obj_article_summary {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

@media (max-width: 767px) {
  .cmp_article_list .obj_article_summary .title {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
  
  .cmp_article_list .obj_article_summary .meta {
    font-size: 0.875rem;
  }
  
  .cmp_article_list .obj_article_summary .summary {
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

/* Fix Footer Responsiveness */
.pkp_structure_footer {
  margin-top: 2rem;
  padding: 2rem 1rem;
}

@media (max-width: 767px) {
  .pkp_structure_footer {
    text-align: center;
    padding: 1.5rem 1rem;
  }
  
  .pkp_structure_footer .pkp_brand_footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
  }
}

/* Touch-friendly Improvements */
@media (max-width: 767px) {
  /* Larger touch targets */
  .pkp_navigation_primary a,
  .pkp_navigation_user a,
  .cmp_button,
  .pkp_button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Improved spacing for touch interfaces */
  .obj_article_summary .authors,
  .obj_article_summary .doi,
  .obj_article_summary .pages {
    margin-bottom: 0.5rem;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus improvements for mobile navigation */
.pkp_site_nav_toggle:focus,
.pkp_nav_list a:focus,
.pkp_navigation_user a:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Print optimizations */
@media print {
  .pkp_structure_head,
  .pkp_navigation_primary_wrapper,
  .pkp_navigation_user_wrapper,
  .pkp_site_nav_toggle,
  .cmp_search {
    display: none !important;
  }
  
  .pkp_structure_main {
    padding: 0 !important;
    float: none !important;
    width: 100% !important;
  }
  
  .pkp_structure_sidebar {
    display: none !important;
  }
}

/* Fix OJS-specific responsive images */
.obj_article_summary .cover img,
.obj_issue_summary .cover img,
.cmp_article_details .cover img {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 767px) {
  .obj_article_summary .cover img,
  .obj_issue_summary .cover img {
    max-width: 150px;
    margin: 0 auto;
  }
}