/* ======================================
   RESPONSIVE DESIGN DEEPNOTES CHATGPT
   ====================================== */

/* ======================================
   TABLET - 768px to 991px
   ====================================== */

@media (max-width: 991px) {
  .content-wrapper {
    padding: var(--spacing-lg);
  }

  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ======================================
   MOBILE LARGE - 576px to 767px
   ====================================== */

@media (max-width: 767px) {
  .top-bar {
    padding: 0 var(--spacing-md);
  }

  .top-bar-title {
    font-size: 1rem;
  }

  .top-bar-search-wrapper {
    max-width: 300px;
    margin: 0 var(--spacing-xs);
  }

  .search-input {
    font-size: 14px;
    height: 40px;
    padding: 0 55px 0 50px;
  }

  .search-input::placeholder {
    font-size: 0.75rem;
  }

  .search-icon-wrapper {
    width: 36px;
    left: 10px;
    font-size: 20px;
  }

  .search-clear-btn {
    width: 40px;
    right: 5px;
  }

  .content-wrapper {
    padding: var(--spacing-md);
  }

  .welcome-title {
    font-size: 1.75rem;
  }

  .welcome-subtitle {
    font-size: 1rem;
  }

  .suggestions-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions-area {
    padding: var(--spacing-md);
  }

  /* Dashboard */
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  /* Groups */
  .groups-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================
   MOBILE - up to 575px
   ====================================== */

@media (max-width: 575px) {
  .top-bar {
    height: 56px;
    padding: 0 var(--spacing-sm);
  }

  .top-bar-title {
    display: none;
  }

  .top-bar-search-wrapper {
    max-width: 200px;
    margin: 0 var(--spacing-xs);
  }

  .search-input {
    font-size: 12px;
    height: 36px;
    padding: 0 45px 0 40px;
  }

  .search-input::placeholder {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search-icon-wrapper {
    width: 30px;
    left: 8px;
    font-size: 16px;
  }

  .search-clear-btn {
    width: 36px;
    right: 4px;
    font-size: 12px;
  }

  .search-glow-layer-1,
  .search-glow-layer-2,
  .search-glow-layer-3 {
    display: none;
  }

  .search-results {
    max-height: 400px;
    left: -10px;
    right: -10px;
    width: calc(100vw - 40px);
  }

  .search-suggestions {
    max-height: 300px;
    left: -10px;
    right: -10px;
    width: calc(100vw - 40px);
  }

  .logo {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    font-size: 1rem;
  }

  .welcome-title {
    font-size: 1.5rem;
  }

  .welcome-subtitle {
    font-size: 0.9375rem;
  }

  .suggestion-card {
    padding: var(--spacing-md);
  }

  .suggestion-card i {
    font-size: 1.25rem;
  }

  .suggestion-card h3 {
    font-size: 0.9375rem;
  }

  .suggestion-card p {
    font-size: 0.8125rem;
  }

  .feature-card {
    padding: var(--spacing-lg);
  }

  .feature-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .feature-card h3 {
    font-size: 1.125rem;
  }

  .quick-actions-area {
    padding: var(--spacing-sm);
  }

  .quick-actions-container {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .quick-search-input {
    font-size: 1rem;
    min-height: 36px;
    padding: var(--spacing-sm);
  }

  .btn-icon {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }

  .btn-icon i {
    font-size: 1.125rem;
    height: 36px;
  }

  /* Hide voice button on very small screens */
  #voice-btn {
    display: none;
  }

  /* Sidebar adjustments */
  .sidebar-header {
    padding: var(--spacing-sm);
    position: relative;
    gap: var(--spacing-sm);
  }

  .sidebar-header-top {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
  }

  .sidebar-header-top .nav-brand {
    flex: 1;
    min-width: 0;
  }

  /* Ajustements pour les éléments dans le header sur mobile */
  .sidebar-header {
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .sidebar-header .sidebar-theme-section,
  .sidebar-header .sidebar-user-status {
    width: 100%;
    flex-shrink: 0;
    min-width: 0;
  }
  
  
  .sidebar-header .sidebar-theme-btn {
    font-size: 0.8125rem;
    padding: 0.625rem 0.75rem;
    min-height: 38px;
    gap: 0.5rem;
  }
  
  .sidebar-header .sidebar-theme-btn i {
    font-size: 1rem;
  }
  
  .sidebar-header .sidebar-theme-btn span {
    font-size: 0.8125rem;
  }
  
  .sidebar-header .sidebar-user-status {
    padding: 0.625rem 0.75rem;
    min-height: 38px;
    gap: 0.5rem;
  }
  
  .sidebar-header .sidebar-user-status .status-dot {
    width: 8px;
    height: 8px;
  }
  
  .sidebar-header .sidebar-user-status .status-text {
    font-size: 0.8125rem;
  }
  
  .sidebar-header .sidebar-user-status .status-email {
    font-size: 0.6875rem;
  }

  .sidebar-actions {
    padding: var(--spacing-sm);
  }
  
  .groups-main-btn,
  .groups-add-btn {
    font-size: 0.8125rem;
  }
  
  .groups-add-btn {
    min-width: 44px;
    padding: var(--spacing-sm);
  }

  .sidebar-footer {
    padding: var(--spacing-sm);
  }
}

/* ======================================
   MOBILE VERY SMALL - up to 360px
   ====================================== */

@media (max-width: 360px) {
  .content-wrapper {
    padding: var(--spacing-sm);
  }

  .welcome-title {
    font-size: 1.375rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .suggestion-card {
    padding: var(--spacing-sm);
  }
}

/* ======================================
   LANDSCAPE MOBILE
   ====================================== */

@media (max-height: 500px) and (orientation: landscape) {
  .chat-welcome {
    min-height: auto;
    padding: var(--spacing-lg) 0;
  }

  .welcome-header {
    margin-bottom: var(--spacing-lg);
  }

  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ======================================
   TOUCH DEVICES
   ====================================== */

@media (hover: none) and (pointer: coarse) {
  .suggestion-card:hover {
    transform: none;
  }

  .suggestion-card:active {
    transform: scale(0.98);
  }

  .feature-card:hover {
    transform: none;
  }

  .feature-card:active {
    transform: scale(0.99);
  }

  .nav-item,
  .chat-item,
  .btn-icon {
    min-height: 44px;
  }
}

/* ======================================
   SIDEBAR OVERLAY FOR MOBILE
   ====================================== */

@media (max-width: 991px) {
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .sidebar {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }
}

/* ======================================
   DASHBOARD RESPONSIVE
   ====================================== */

@media (max-width: 767px) {
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .stat-card {
    padding: var(--spacing-md);
  }

  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }
}

@media (max-width: 575px) {
  .stat-card {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-sm);
  }

  .stat-icon {
    margin: 0 auto;
  }

  .content-tabs {
    gap: 0;
  }

  .tab-btn {
    flex: 1;
    padding: var(--spacing-sm);
    font-size: 0.8125rem;
  }
}

/* ======================================
   GROUPS RESPONSIVE
   ====================================== */

@media (max-width: 767px) {
  .groups-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .group-card {
    padding: var(--spacing-lg);
  }

  .group-card-header {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .group-actions {
    flex-direction: column;
  }
}

@media (max-width: 575px) {
  .group-stats {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
}

/* ======================================
   PRINT STYLES
   ====================================== */

@media print {
  .sidebar,
  .top-bar,
  .chat-input-area,
  .top-bar-toggle {
    display: none !important;
  }

  .main-container {
    margin: 0;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* ======================================
   REDUCED MOTION
   ====================================== */

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