/* 
 * ChatBiz Responsive Stylesheet - Optimized
 * Consolidated from responsive.css and mobile_responsive.css
 * Removes duplicates and optimizes media queries
 */

/* ========== Global Responsive Variables ========== */
:root {
  --mobile-padding: 12px;
  --mobile-margin: 10px;
  --mobile-border-radius: 8px;
  --mobile-font-size-base: 14px;
  --mobile-font-size-heading: 18px;
  --mobile-transition-speed: 0.2s;
  --tablet-padding: 15px;
  --tablet-font-size-base: 15px;
}

/* ========== Mobile Viewport Settings (Small Phones) ========== */
@media (max-width: 576px) {
  /* Typography */
  body {
    font-size: var(--mobile-font-size-base);
  }

  h1, .h1 {
    font-size: 1.75rem;
  }

  h2, .h2 {
    font-size: 1.5rem;
  }

  h3, .h3 {
    font-size: 1.25rem;
  }

  /* Layout & Containers */
  .container {
    padding-left: var(--mobile-padding);
    padding-right: var(--mobile-padding);
  }

  .card {
    margin-bottom: var(--mobile-margin);
  }

  /* Forms & Buttons */
  .form-control, 
  .form-select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    height: 42px;
  }

  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    min-height: 42px;
  }

  textarea.form-control {
    height: auto;
  }

  /* Tables */
  .table-responsive {
    border: 0;
  }

  .table th, 
  .table td {
    padding: 0.5rem;
  }

  /* Modals */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
}

/* ========== Tablet Viewport Settings ========== */
@media (min-width: 577px) and (max-width: 991px) {
  /* Typography */
  body {
    font-size: var(--tablet-font-size-base);
  }

  /* Layout & Containers */
  .container {
    padding-left: var(--tablet-padding);
    padding-right: var(--tablet-padding);
  }

  /* Forms & Buttons */
  .form-control, 
  .form-select, 
  .btn {
    min-height: 38px;
  }
}

/* ========== Navbar Responsive Styles ========== */
@media (max-width: 992px) {
  .navbar-brand {
    font-size: 1.2rem;
  }

  .navbar .nav-link {
    font-size: 1rem;
    padding: 0.5rem 0.75rem !important;
  }

  .navbar-collapse {
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }

  .navbar-nav .dropdown-menu {
    border: none;
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: none;
    padding-left: 1rem;
  }

  .navbar-nav .dropdown-item {
    padding: 0.5rem 0.75rem;
  }
}

/* ========== Dashboard Responsive Styles ========== */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 10px 0;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
  }

  .dashboard-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .dashboard-widgets {
    grid-template-columns: 1fr;
  }

  .dashboard-widget {
    margin-bottom: 15px;
  }

  /* Widget content adjustments */
  .widget-content {
    padding: 12px;
  }

  .widget-chart-container {
    height: 200px;
  }
}

/* ========== Chatbot Responsive Styles ========== */
@media (max-width: 768px) {
  /* Chatbot container */
  #aibiz-chatbot-container, 
  #chatbiz-chatbot-container {
    width: 100% !important;
    max-width: 100% !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  /* Chatbot header */
  .chatbot-header {
    padding: 10px 15px;
  }

  /* Chatbot messages */
  .chat-messages {
    height: calc(100% - 110px);
  }

  .chat-message {
    padding: 8px 12px;
    margin-bottom: 8px;
  }

  /* Chatbot input */
  .chat-input-container {
    padding: 10px;
  }
}

/* ========== Search Responsive Styles ========== */
@media (max-width: 768px) {
  .search-form .input-group {
    flex-direction: column;
  }
  
  .search-form .input-group > .form-control {
    border-radius: 0.375rem 0.375rem 0 0;
  }
  
  .search-form .input-group > .btn {
    border-radius: 0 0 0.375rem 0.375rem;
    margin-top: -1px;
  }
  
  .search-filters .row > div {
    margin-bottom: 1rem;
  }
  
  .search-results .row > div {
    margin-bottom: 1rem;
  }
}

/* ========== Form Responsive Styles ========== */
@media (max-width: 768px) {
  .form-section {
    padding: 15px;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}

/* ========== Table Responsive Styles ========== */
@media (max-width: 768px) {
  .table-responsive-card .table {
    border: 0;
  }
  
  .table-responsive-card .table thead {
    display: none;
  }
  
  .table-responsive-card .table tr {
    margin-bottom: 10px;
    display: block;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
  }
  
  .table-responsive-card .table td {
    display: block;
    text-align: right;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    padding-left: 50%;
  }
  
  .table-responsive-card .table td:before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-left: 15px;
    font-weight: bold;
    text-align: left;
  }
  
  .table-responsive-card .table td:last-child {
    border-bottom: 0;
  }
}

/* ========== Print Styles ========== */
@media print {
  body {
    background-color: #fff !important;
  }
  
  .navbar, 
  .footer, 
  .no-print {
    display: none !important;
  }
  
  .container {
    width: 100%;
    padding: 0;
    margin: 0;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  
  .page-break {
    page-break-before: always;
  }
}
