/* --- MOBILE FIRST CUSTOM STYLES --- */
@media (max-width: 767.98px) {

  /* klasy dla /pv */
  .table-counter {
    border-radius: 15px;
  }

  .table-body-counter td {
    max-height: 50px;
    color: black;
  }

  .table-striped tbody tr:nth-of-type(odd) {
    background-color: transparent !important;
    color: black;
  }

  .glass-panel-chart-energy {
    min-height: 450px;
  }
  /* koniec klas dla /pv */

  .go-to-top {
    right: 10px;
  }

  body,
  html {
    padding: 0;
    margin: 0;
    background: #181c1f;
  }

  .container {
    max-width: 100vw;
    padding: 0 2vw;
  }

  .odstep {
    padding: 20px;
  }

  .glass-panel {
    border-radius: 0;
    box-shadow: none;
    padding: 1rem 0.5rem;
    margin: 0 -2vw;
    background: rgba(30, 34, 40, 0.97);
  }

  .cogeneration-mobile {
    margin: 4px;
    border-radius: 15px;
  }

  .value-card {
    border-radius: 10px;
    margin-bottom: 1.2rem;
    padding: 1.2rem 1rem;
    font-size: 1.05rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
  }

  .value-title {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
  }

  .value-number {
    font-size: 1.5rem;
    font-weight: bold;
  }

  .main-content {
    padding: 0;
    padding-top: 40px;
  }

  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 80vw;
    max-width: 350px;
    height: 100vh;
    background: rgba(30, 34, 40, 0.97);
    z-index: 2000;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    transform: translateX(-100%);
    pointer-events: none;
    opacity: 0;
  }

  .sidebar.active {
    transform: translateX(0);
    pointer-events: auto;
    opacity: 1;
  }

  .sidebar-toggle {
    position: fixed;
    top: 4px;
    margin-top: 10px;
    left: 8px;
    z-index: 2100;
    background: #222;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
  }

  .page-title,
  h1,
  .main-title {
    margin-top: 10px;
  }

  .d-flex.align-items-center.justify-content-between.mb-4 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.7rem;
    margin-bottom: 1.2rem !important;
  }

  .chart-container {
    min-height: 350px;
    background: #222;
    border-radius: 10px;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
  }

  button.btn {
    width: 100%;
    font-size: 0.83rem;
    margin-bottom: 0.5rem;
    padding: 4px 6px;
  }

  .button-mobile {
    font-size: 0.9rem;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1999;
  }

  .sidebar.active~.sidebar-backdrop {
    display: block;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .value-chart {
    font-size: large;
  }

  .data-input-mobile {
    min-width: 250px;
  }

  /* Tabele responsywne na mobile (harmonogram baterii i tabela przegladów) */
  #schedule-table th,
  #schedule-table td,
  .table th,
  .table td {
    min-width: 120px;
    vertical-align: middle;
  }

  #tableFilters .btn {
    border-radius: 5px;
  }

  .ui-dialog {
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  @media (max-width: 575.98px) {

    #schedule-table thead,
    .table-responsive .table thead {
      display: none;
    }

    #schedule-table tr,
    .table-responsive .table tr {
      display: flex;
      flex-direction: column;
      border-bottom: 1px solid #444;
      margin-bottom: 12px;
      background: rgba(40, 44, 52, 0.5);
      border-radius: 8px;
      padding: 10px;
    }

    #schedule-table td,
    .table-responsive .table td {
      display: flex;
      width: 100%;
      min-width: 0;
      padding: 8px 0;
      align-items: center;
      border: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .cogeneration-mobile-table td {
      max-height: 50px;
      display: flex;
      align-items: center;
    }

    #records-body {
      border: 0;
    }

    .maintance-td {
      max-height: 50px;
    }

    .maintance-mobile-table .table .maintance-td:before,
    .maintance-mobile-table .table .maintance-td-description:before,
    .table #charging-history .maintance-td:before,
    .table .table-body-counter .maintance-td:before {
      color: var(--accent-color);
    }

    .table #charging-history .maintance-td:before {
      padding-left: 10px;
    }

    .cogeneration-table-input {
      width: 110px;
    }

    .table #charging-history .history-td-buttons:before,
    .cogeneration-mobile-table .table .generators-td-button:before {
      display: none;
    }

    .cogeneration-mobile-table .generators-td-button {
      display: flex;
      flex-direction: column;
      max-height: 70px;
    }

    #schedule-table td:last-child,
    .table-responsive .table td:last-child {
      border-bottom: none;
    }

    .table-responsive .table td,
    .table-responsive .table td:before,
    .cogeneration-mobile-table .table td:before {
      content: attr(data-label);
      flex: 0 0 120px;
      font-weight: 600;
      color: #aaa;
      margin-right: 12px;
      font-size: 0.95em;
    }

    .cogeneration-mobile-thead {
      display: block;
      width: 110px;
      padding-left: 8px;
      margin: 0;
      color: var(--accent-color);
    }

    /* Agent AI */
    
  .agent-page {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 10px;
  }
  
  .chat-history {
    width:100%;
    max-height: 40vh;
    overflow-y: auto;
    border: 0.5px solid white;
  }

  .chat-container {
    max-width: 100%;
    height: 95vh;
    overflow-y: auto;
    border: 0.5px solid white;
  }

    form #submit-button {
      padding-left: 6px;
      padding-right: 6px;
      min-width: 80px;
    }

    .message-input input {
      min-width: 190px;
    }

    .ai-message .message-content {
      max-width: 80%;
    }
  }
}