/* PawzoChat — Desktop / Landscape Adaptive Layout
 *
 * Activated at >=768px viewport width.
 * Mobile layout remains unchanged below this breakpoint.
 */

@media (min-width: 768px) {

  :root {
    --bar-h-top: 52px;
    --bar-h-bottom: 52px;
  }

  /* ================================================================
   * Shell: floating desktop window
   * ================================================================ */
  #phone-shell {
    width: 96vw;
    max-width: 1100px;
    height: 92vh;
    max-height: 900px;
    border-radius: 12px;
    flex-direction: row;
    box-shadow:
      0 20px 60px rgba(78, 58, 46, 0.10),
      0 4px 16px rgba(78, 58, 46, 0.06);
  }

  /* ================================================================
   * Sidebar
   * ================================================================ */
  #sidebar {
    display: flex;
    flex-direction: column;
    width: 300px;
    min-width: 300px;
    background: var(--card);
    border-right: 1px solid var(--divider);
  }

  /* ---- Sidebar tab navigation (pinned to bottom) ---- */
  #sidebar-tabs {
    display: flex;
    order: 3;
    height: var(--bar-h-bottom);
    min-height: var(--bar-h-bottom);
    border-top: 1px solid var(--divider);
  }
  #sidebar-header { order: 1; }
  #sidebar-body { order: 2; }
  #sidebar-tabs .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    color: var(--text-3);
    transition: color 0.2s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  #sidebar-tabs .tab svg, #sidebar-tabs .tab .ui-icon { width: 18px; height: 18px; }
  #sidebar-tabs .tab span { font-size: 10px; }
  #sidebar-tabs .tab.active {
    color: var(--primary);
    background: var(--primary-light);
  }
  #sidebar-tabs .tab:hover:not(.active) {
    background: rgba(176, 137, 104, 0.06);
  }

  /* ---- Sidebar header ---- */
  #sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: var(--bar-h-top);
    min-height: var(--bar-h-top);
    border-bottom: 1px solid var(--divider);
  }
  #sidebar-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    color: var(--text-1);
  }
  #sidebar-actions {
    display: flex;
    gap: 4px;
  }

  /* ---- Sidebar body ---- */
  #sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* ================================================================
   * Main Panel
   * ================================================================ */
  #main-panel {
    background: var(--bg);
  }

  /* Hide top-bar when no page is open */
  #top-bar.desktop-hidden { display: none; }

  /* ---- Hide mobile tab bar ---- */
  #tab-bar { display: none !important; }

  /* ================================================================
   * Desktop welcome / empty state
   * ================================================================ */
  .desktop-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-3);
    gap: 8px;
    user-select: none;
  }
  .desktop-welcome .welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 8px;
  }
  .desktop-welcome .welcome-icon img { width: 100%; height: 100%; object-fit: cover; }
  .desktop-welcome .welcome-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-2);
  }
  .desktop-welcome .welcome-hint {
    font-size: 13px;
  }

  /* ================================================================
   * Content adjustments
   * ================================================================ */

  /* Constrain form/settings pages in the wide main panel */
  #content-area > .page {
    max-width: 640px;
    margin: 0 auto;
  }

  /* Chat window should use full width */
  #content-area > .chat-container {
    max-width: none;
  }

  /* Wider chat bubbles */
  .msg-row > div:not(.avatar) { max-width: 65%; }
  .chat-messages { padding: 12px 24px 16px; }
  .chat-input-bar { padding: 8px 20px; min-height: var(--bar-h-bottom); }

  /* ================================================================
   * Hover effects (desktop pointer)
   * ================================================================ */
  .conv-item:hover { background: rgba(176, 137, 104, 0.06); }
  .card-row:hover { background: rgba(176, 137, 104, 0.06); }
  .sheet-item:hover:not(.disabled) { background: rgba(176, 137, 104, 0.06); }
  .emoji-thumb:hover { background: var(--divider); }
  .top-btn:hover { background: var(--primary-light); }

  /* Sidebar active conversation highlight */
  .conv-item.active { background: var(--primary-light); }
  .conv-item.active:hover { background: var(--primary-light); }

  /* ================================================================
   * Overlay / Sheet → centered floating dialog on desktop
   * ================================================================ */
  #action-sheet {
    bottom: auto;
    top: 50%;
    width: min(400px, 90vw);
    max-height: 60vh;
    border-radius: var(--radius-card);
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow:
      0 12px 40px rgba(78, 58, 46, 0.14),
      0 2px 8px rgba(78, 58, 46, 0.06);
  }
  #action-sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .sheet-handle { display: none; }
  #sheet-content { padding-bottom: 12px; }
  .sheet-cancel { border-top: 1px solid var(--divider); }
}

/* ================================================================
 * Progressive: wider desktops get more window-like feel
 * ================================================================ */
@media (min-width: 1200px) {
  #phone-shell {
    width: 78vw;
    border-radius: 16px;
  }
}

@media (min-width: 1600px) {
  #phone-shell {
    width: 65vw;
    max-width: 1200px;
  }
}
