/* =========================================
   GLOBAL LAYOUT RESPONSIVE (TABLET + MOBILE)
   ========================================= */

@media (max-width: 1200px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  /* Lewy panel -> gorny pasek na tablet/mobile */
  header {
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
    height: 84px;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    padding: 0 12px;
    background-color: rgba(18, 20, 29, 0.95);
    backdrop-filter: blur(10px);
  }

  header .container,
  header .nav {
    height: 100%;
  }

  header .nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
  }

  header .nav a.interact {
    width: 86px;
    min-width: 86px;
    flex: 0 0 86px;
    height: auto;
    border-radius: 10px;
    padding: 6px 4px 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }

  header .nav a.interact img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  header .nav a .info,
  header .nav a .info.hidden {
    display: block !important;
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    line-height: 1.1;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.02em;
  }

  header .nav a.active .info,
  header .nav a.active .info.hidden {
    color: #d9f6ff;
  }

  header .nav a.to_bottom {
    margin: 0;
  }

  header .nav a.active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: -7px;
    width: auto;
    height: 3px;
    border-radius: 8px;
  }

  /* Srodek */
  main {
    width: 100%;
    flex: 1;
    overflow: visible;
    padding: 26px 18px 22px;
  }

  /* Prawy panel -> sekcja pod trescia */
  footer {
    display: block;
    width: 100%;
    flex: 0 0 auto;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    padding: 16px 14px 22px;
    overflow: visible;
  }

  .sidebar-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }

  .legal-info {
    grid-column: 1 / -1;
    margin-top: 0;
    padding-top: 8px;
    text-align: center;
  }

  .profile-widget,
  .server-widget {
    margin: 0;
    width: 100%;
  }

  /* Ogolne komponenty */
  .ticket-system-container,
  .conversation-wrapper,
  .chat,
  .top,
  .top-nav-info {
    width: 100%;
    max-width: 100%;
  }

  .ticket-filter-form {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .ticket-filter-form label {
    margin-right: 0;
  }

  .ticket-filter-form select {
    min-width: 170px;
  }

  .ticket-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message-card,
  .user-info-card {
    width: 100%;
    max-width: 100%;
  }

  .admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  header {
    height: 86px;
    padding: 0 8px;
    justify-content: center;
  }

  header .nav {
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  header .nav a.interact {
    width: 74px;
    min-width: 74px;
    flex: 0 0 74px;
    height: auto;
    border-radius: 10px;
    padding: 6px 2px 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
  }

  header .nav a.interact img {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  header .nav a.active::before {
    left: 8px;
    right: 8px;
    bottom: 0;
    top: auto;
    width: auto;
    height: 3px;
    border-radius: 6px;
  }

  header .nav a .info,
  header .nav a .info.hidden {
    display: block !important;
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    line-height: 1.1;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.02em;
  }

  header .nav a.active .info,
  header .nav a.active .info.hidden {
    color: #d9f6ff;
  }

  main {
    padding: 22px 12px 16px;
  }

  footer {
    padding: 12px 10px 18px;
  }

  .sidebar-wrapper {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .user-card-simple {
    gap: 10px;
  }

  .mini-avatar {
    width: 40px;
    height: 40px;
  }

  .ticket-grid {
    grid-template-columns: 1fr;
  }

  .ticket-card,
  .ticket-card-body,
  .message-card,
  .user-info-card {
    border-radius: 14px;
  }

  .message-card,
  .user-info-card {
    padding: 14px;
  }

  .user-info-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .user-info-card .round-img {
    width: 56px;
    height: 56px;
  }

  .ticket-filter-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ticket-filter-form select,
  input,
  textarea,
  button {
    font-size: 16px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}
