/* ========================================
   MOBILE RESPONSIVE STYLES
   ========================================
   DO NOT EDIT COLORS HERE!
   Edit /static/css/site-theme.css instead.
   ======================================== */

/* ========================================
   1. GLOBAL MOBILE UTILITIES
   ======================================== */

/* Hide desktop-only elements on mobile */
@media (max-width: 767.98px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  /* Full-width on mobile */
  .mobile-full-width {
    width: 100% !important;
  }

  /* Stack vertically */
  .mobile-stack {
    flex-direction: column !important;
  }

  /* Reduce container padding on mobile */
  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Adjust main content padding */
  main.container-fluid {
    padding-top: 1rem !important;
    padding-bottom: 80px !important; /* Space for bottom nav */
  }

  /* Smaller headings on mobile */
  h1 { font-size: 1.75rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
  h4 { font-size: 1.1rem !important; }
  h5 { font-size: 1rem !important; }
}

@media (min-width: 768px) {
  .mobile-only {
    display: none !important;
  }
}

/* ========================================
   2. MOBILE NAVIGATION
   ======================================== */

/* Top Mobile Navbar - uses site-theme.css variables */
.navbar-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--ds-color-surface) !important;
  border-bottom: 1px solid var(--theme-border-light, rgba(0, 0, 0, 0.06));
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: var(--theme-shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.04));
}

.navbar-mobile .navbar-brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--ds-color-text-primary) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 10000 !important;
  position: relative !important;
  display: inline-block !important;
  padding: 8px 12px !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
}

.navbar-mobile .navbar-toggler {
  border: none;
  background: transparent;
  color: var(--ds-color-text-primary);
  padding: 0.5rem;
}

.navbar-mobile .navbar-toggler-icon {
  width: 24px;
  height: 2px;
  background-color: var(--ds-color-text-primary);
  display: block;
  position: relative;
}

.navbar-mobile .navbar-toggler-icon::before,
.navbar-mobile .navbar-toggler-icon::after {
  content: '';
  width: 24px;
  height: 2px;
  background-color: var(--ds-color-text-primary);
  position: absolute;
  left: 0;
  transition: all 0.3s ease;
}

.navbar-mobile .navbar-toggler-icon::before {
  top: -8px;
}

.navbar-mobile .navbar-toggler-icon::after {
  bottom: -8px;
}

.btn-notifications {
  background: transparent;
  border: none;
  color: var(--ds-color-text-primary);
  font-size: 20px;
  padding: 0.5rem;
}

/* Off-canvas Menu (Mobile Sidebar) - uses site-theme.css variables */
.offcanvas {
  background: var(--ds-color-surface) !important;
  color: var(--ds-color-text-primary) !important;
}

.offcanvas-header {
  border-bottom: 1px solid var(--theme-border-light, rgba(0, 0, 0, 0.06));
}

.offcanvas-body {
  padding: 1rem;
}

.offcanvas .nav-link {
  color: var(--ds-color-text-secondary) !important;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link.active {
  background: var(--ds-color-bg-secondary);
  color: var(--ds-color-text-primary) !important;
}

.offcanvas .nav-link i {
  margin-right: 0.75rem;
  width: 20px;
}

/* Bottom Navigation - uses site-theme.css variables */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--ds-color-surface);
  border-top: 1px solid var(--theme-border-light, rgba(0, 0, 0, 0.06));
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding: 0.25rem 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ds-color-text-tertiary);
  font-size: 11px;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 60px;
}

.bottom-nav-item i {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-nav-item.active {
  color: var(--theme-accent, var(--ds-color-accent));
}

.bottom-nav-item:hover {
  color: var(--ds-color-text-primary);
  background: var(--ds-color-bg-secondary);
}

@media (max-width: 767.98px) {
  body {
    padding-bottom: 60px; /* Space for bottom nav */
  }

  body.has-mobile-nav {
    padding-top: 56px; /* Space for top nav */
  }
}

/* ========================================
   3. TOUCH-FRIENDLY BUTTONS & FORMS
   ======================================== */

/* Minimum 44x44px tap target (Apple HIG) */
@media (max-width: 767.98px) {
  .btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .btn-sm {
    min-width: 36px;
    min-height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  .btn-lg {
    min-width: 48px;
    min-height: 48px;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
  }

  /* Larger form inputs */
  .form-control,
  .form-select {
    height: 48px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 0.75rem;
  }

  .form-control-lg {
    height: 56px;
    font-size: 18px;
  }

  .form-control-sm {
    height: 40px;
    font-size: 14px;
  }

  /* Spacing between clickable elements */
  .btn + .btn {
    margin-left: 0.5rem;
  }

  /* Full-width buttons on mobile */
  .btn-mobile-full {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* ========================================
   4. MOBILE TABLES → CARDS
   ======================================== */

@media (max-width: 767.98px) {
  /* Hide desktop table */
  .table-responsive-mobile {
    display: none !important;
  }

  /* Show mobile cards */
  .cards-view-mobile {
    display: block !important;
  }

  /* Hide table headers on very small screens */
  .table-responsive thead {
    display: none;
  }

  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
  }

  .table-responsive tr {
    margin-bottom: 1rem;
    border: 1px solid var(--ds-border-color);
    border-radius: 8px;
    padding: 1rem;
  }

  .table-responsive td {
    border: none;
    padding: 0.5rem 0;
  }

  .table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    color: var(--ds-color-text-tertiary);
    font-size: 0.875rem;
  }
}

@media (min-width: 768px) {
  .cards-view-mobile {
    display: none !important;
  }
}

/* Mobile Card Components */
.client-card,
.workflow-card,
.document-card,
.email-card {
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-bg-tertiary);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

.client-card:active,
.workflow-card:active,
.document-card:active,
.email-card:active {
  background: var(--ds-color-bg-secondary);
  transform: scale(0.98);
}

.client-card-header,
.workflow-card-header,
.document-card-header,
.email-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ds-color-info);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-color-text-inverse);
  font-weight: 600;
  font-size: 14px;
  margin-right: 0.75rem;
}

.client-info h5,
.workflow-card h5,
.document-card h5,
.email-card h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.client-info p,
.workflow-client,
.document-card small,
.email-card small {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ds-color-text-tertiary);
}

.client-details,
.workflow-progress,
.document-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.client-meta,
.workflow-meta,
.document-meta,
.email-meta {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ds-border-color);
  font-size: 0.75rem;
  color: var(--ds-color-text-tertiary);
}

.client-actions,
.workflow-actions,
.document-actions,
.email-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--ds-color-text-tertiary);
  font-size: 20px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: var(--ds-color-text-inverse);
}

/* ========================================
   5. DASHBOARD MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Stack KPI cards vertically */
  .kpi-card {
    margin-bottom: 0.75rem;
  }

  /* Stack widgets vertically */
  .widget {
    margin-bottom: 1rem;
  }

  /* Simplify charts on mobile */
  .chart-complex {
    display: none;
  }

  .chart-simple {
    display: block;
  }

  /* Dashboard header */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .dashboard-header .btn-group {
    margin-top: 0.75rem;
    width: 100%;
  }

  .dashboard-header .btn {
    flex: 1;
  }
}

@media (min-width: 768px) {
  .chart-simple {
    display: none;
  }

  .chart-complex {
    display: block;
  }
}

/* ========================================
   6. CLIENTS LIST MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Header with search */
  .clients-header {
    flex-direction: column;
    align-items: stretch !important;
  }

  .clients-header .search-box {
    width: 100% !important;
    margin-bottom: 0.75rem;
  }

  .clients-header .btn {
    width: 100%;
  }

  /* Filters - collapsible on mobile */
  .filters-mobile {
    margin-bottom: 1rem;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-row > * {
    margin-bottom: 0.5rem;
  }

  /* Stats - collapsible */
  #statsCollapse {
    margin-bottom: 1rem;
  }

  .stat-card {
    font-size: 0.875rem;
  }

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

/* ========================================
   7. CLIENT DETAIL MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Client header */
  .client-detail-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .client-detail-header .btn-group {
    margin-top: 0.75rem;
    width: 100%;
  }

  /* Sidebar → Accordion on mobile */
  .client-sidebar {
    order: -1; /* Move to top */
    margin-bottom: 1rem;
  }

  /* Tabs - horizontal scroll */
  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--ds-border-color);
  }

  .nav-tabs .nav-item {
    white-space: nowrap;
  }

  .nav-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  /* Timeline - simplified */
  .timeline-mobile {
    padding-left: 1rem;
  }

  .timeline-item {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    border-left: 2px solid var(--ds-border-color);
  }

  .timeline-item::before {
    left: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ds-color-info);
  }
}

/* Floating Action Button (Mobile) */
.fab {
  position: fixed;
  bottom: 80px; /* Above bottom nav */
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ds-color-info);
  color: var(--ds-color-text-inverse);
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  z-index: 999;
  transition: all 0.3s;
}

.fab:active {
  transform: scale(0.9);
}

.fab-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-bg-tertiary);
  border-radius: 8px;
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fab.open .fab-menu {
  display: flex;
}

.fab-menu button {
  background: transparent;
  border: none;
  color: var(--ds-color-text-primary);
  padding: 0.75rem 1rem;
  text-align: left;
  border-radius: 4px;
  transition: all 0.2s;
}

.fab-menu button:hover {
  background: var(--ds-color-bg-secondary);
}

@media (max-width: 767.98px) {
  .fab {
    display: flex;
  }
}

/* ========================================
   8. WORKFLOWS MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Workflow list */
  .workflow-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Workflow card */
  .workflow-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
  }

  .workflow-card h5 {
    font-size: 1rem;
    margin: 0;
  }

  .workflow-progress {
    margin: 0.75rem 0;
  }

  .workflow-progress .progress {
    height: 8px;
    background: var(--ds-border-color);
    border-radius: 4px;
    overflow: hidden;
  }

  .workflow-progress .progress-bar {
    background: var(--ds-color-info);
    height: 100%;
    transition: width 0.3s;
  }

  .workflow-meta {
    font-size: 0.75rem;
    color: var(--ds-color-text-tertiary);
  }

  /* Workflow Progress Indicator (Household Detail Page) */
  .workflow-progress-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .workflow-progress-header h6 {
    font-size: 0.9rem;
  }

  .workflow-progress-meta {
    font-size: 0.75rem;
  }

  .workflow-steps-container {
    padding: 0.5rem 0;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .workflow-steps {
    padding: 0 0.5rem;
    gap: 0;
  }

  .workflow-step {
    min-width: 60px;
    max-width: 100px;
  }

  .workflow-step-circle {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }

  .workflow-step-connector {
    top: 14px;
    height: 2px;
  }

  .workflow-step-label {
    font-size: 0.65rem;
    margin-top: 6px;
    max-width: 70px;
  }

  .workflow-progress-summary {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .workflow-progress-summary .progress-bar-container {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }

  .workflow-progress-bar {
    height: 5px;
  }

  #workflowProgressCard .card-body {
    padding: 1rem;
  }
}

/* ========================================
   9. EMAIL MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Single view (folder/list/detail) */
  .email-mobile {
    position: relative;
  }

  .email-view {
    display: none;
  }

  .email-view.active {
    display: block;
  }

  /* Folder list */
  .folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .folder-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--ds-color-bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
  }

  .folder-list li:active {
    background: var(--ds-color-bg-secondary);
  }

  /* Email list */
  .email-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .email-list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--ds-color-bg-tertiary);
    cursor: pointer;
    transition: all 0.2s;
  }

  .email-list-item:active {
    background: var(--ds-color-bg-secondary);
  }

  .email-list-item.unread {
    background: rgba(var(--ds-accent-rgb), 0.05);
  }

  .email-list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
  }

  .email-from {
    font-weight: 600;
    font-size: 0.875rem;
  }

  .email-time {
    font-size: 0.75rem;
    color: var(--ds-color-text-tertiary);
  }

  .email-subject {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--ds-color-text-inverse);
  }

  .email-preview {
    font-size: 0.75rem;
    color: var(--ds-color-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Email detail */
  .email-detail {
    padding: 1rem;
  }

  .email-detail-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--ds-color-bg-tertiary);
  }

  .email-detail-subject {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }

  .email-detail-from {
    font-size: 0.875rem;
    color: var(--ds-color-text-secondary);
  }

  .email-detail-body {
    line-height: 1.6;
  }

  /* Compose - full screen */
  .email-compose-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ds-color-bg-primary);
    z-index: 1050;
    display: none;
  }

  .email-compose-mobile.active {
    display: flex;
    flex-direction: column;
  }

  .email-compose-header {
    padding: 1rem;
    border-bottom: 1px solid var(--ds-color-bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .email-compose-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
  }

  .email-compose-footer {
    padding: 1rem;
    border-top: 1px solid var(--ds-color-bg-tertiary);
  }
}

/* ========================================
   10. CALENDAR MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* View toggle */
  .calendar-view-toggle {
    width: 100%;
    margin-bottom: 1rem;
  }

  .calendar-view-toggle .btn {
    flex: 1;
  }

  /* Month view - simplified */
  .calendar-month-mobile {
    font-size: 0.75rem;
  }

  .calendar-day {
    min-height: 60px;
    padding: 0.25rem;
  }

  .calendar-day-number {
    font-size: 0.875rem;
  }

  .calendar-event {
    font-size: 0.625rem;
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 2px;
  }

  /* Agenda view (mobile-friendly) */
  .calendar-agenda {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .agenda-day {
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
  }

  .agenda-day h6 {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: var(--ds-color-text-secondary);
  }

  .agenda-event {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--ds-color-bg-secondary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
  }

  .event-time {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--theme-accent, var(--ds-color-accent));
    min-width: 70px;
    margin-right: 1rem;
  }

  .event-title {
    font-size: 0.875rem;
    flex: 1;
  }

  .event-icon {
    margin-left: 0.5rem;
    color: var(--ds-color-text-tertiary);
  }
}

/* ========================================
   11. DOCUMENTS MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Grid → List on mobile */
  .documents-grid {
    display: none;
  }

  .documents-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .document-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-bg-tertiary);
    border-radius: 8px;
    transition: all 0.2s;
  }

  .document-item:active {
    background: var(--ds-color-bg-secondary);
    transform: scale(0.98);
  }

  .document-icon {
    font-size: 2rem;
    margin-right: 1rem;
    width: 48px;
    text-align: center;
  }

  .document-info {
    flex: 1;
  }

  .document-info h6 {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 600;
  }

  .document-info small {
    font-size: 0.75rem;
    color: var(--ds-color-text-tertiary);
  }

  /* Upload area - full screen on mobile */
  .upload-area-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ds-color-bg-primary);
    z-index: 1050;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
  }

  .upload-area-mobile.active {
    display: flex;
  }
}

@media (min-width: 768px) {
  .documents-list-mobile {
    display: none;
  }

  .documents-grid {
    display: grid;
  }
}

/* ========================================
   12. LOGIN/REGISTER MOBILE LAYOUT
   ======================================== */

@media (max-width: 767.98px) {
  /* Auth pages */
  .auth-form-mobile {
    padding: 1rem;
  }

  .logo-mobile {
    max-width: 150px;
    margin: 2rem auto;
    display: block;
  }

  .auth-card {
    border: none;
    background: transparent;
  }

  .auth-card .card-body {
    padding: 1rem;
  }

  /* Social login buttons - stack on mobile */
  .social-login-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .social-login-mobile .btn {
    width: 100%;
  }
}

/* ========================================
   13. MOBILE-SPECIFIC COMPONENTS
   ======================================== */

/* Pull to refresh indicator (optional) */
.pull-to-refresh {
  display: none;
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-bg-tertiary);
  border-radius: 20px;
  font-size: 0.875rem;
  z-index: 999;
}

.pull-to-refresh.active {
  display: block;
}

/* Swipe indicators */
.swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--ds-color-text-tertiary);
  opacity: 0;
  transition: all 0.3s;
}

.swipe-indicator-left {
  left: 1rem;
}

.swipe-indicator-right {
  right: 1rem;
}

.swipeable.swiping .swipe-indicator {
  opacity: 1;
}

/* Loading skeleton (mobile) */
.skeleton-mobile {
  background: linear-gradient(90deg, var(--ds-color-bg-tertiary) 25%, var(--ds-color-bg-secondary) 50%, var(--ds-color-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ========================================
   14. MOBILE PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Reduce animations on mobile for better performance */
@media (max-width: 767.98px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
  }

  /* Hardware acceleration */
  .bottom-nav,
  .navbar-mobile,
  .fab {
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* ========================================
   15. MOBILE ACCESSIBILITY
   ======================================== */

@media (max-width: 767.98px) {
  /* Larger focus indicators for touch */
  *:focus {
    outline: 2px solid var(--ds-color-info);
    outline-offset: 2px;
  }

  /* Skip to content link */
  .skip-to-content {
    position: fixed;
    top: -100px;
    left: 0;
    background: var(--ds-color-info);
    color: var(--ds-color-text-inverse);
    padding: 0.75rem 1rem;
    z-index: 2000;
    transition: top 0.3s;
  }

  .skip-to-content:focus {
    top: 0;
  }
}

/* ========================================
   16. LANDSCAPE ORIENTATION
   ======================================== */

@media (max-width: 767.98px) and (orientation: landscape) {
  /* Reduce header sizes in landscape */
  .navbar-mobile {
    height: 48px;
  }

  .bottom-nav {
    height: 50px;
  }

  .bottom-nav-item {
    font-size: 10px;
  }

  .bottom-nav-item i {
    font-size: 18px;
  }

  body {
    padding-bottom: 50px;
  }

  body.has-mobile-nav {
    padding-top: 48px;
  }
}

/* ========================================
   17. TABLET-SPECIFIC STYLES
   ======================================== */

@media (min-width: 768px) and (max-width: 991.98px) {
  /* Tablet - 2 column layout for cards */
  .client-card,
  .workflow-card,
  .document-card {
    width: calc(50% - 0.5rem);
    display: inline-block;
    vertical-align: top;
  }

  /* Adjust sidebar width */
  .client-sidebar {
    width: 300px;
  }

  /* Keep some desktop features */
  .bottom-nav {
    display: none;
  }
}

/* ========================================
   18. PRINT STYLES
   ======================================== */

@media print {
  .navbar-mobile,
  .bottom-nav,
  .fab,
  .btn,
  .dropdown,
  .offcanvas {
    display: none !important;
  }

  body {
    padding: 0 !important;
  }

  .cards-view-mobile,
  .table-responsive-mobile {
    display: block !important;
  }
}

/* ============================================================================
   MOBILE FEATURE PAGES ENHANCEMENTS
   ============================================================================ */

/* Analytics Mobile Styles */
@media (max-width: 767px) {
    .chart-container-mobile {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .chart-container-mobile canvas {
        min-width: 300px;
        max-width: 100%;
        height: 250px !important;
    }
}

/* Teams Mobile Styles */
.members-list-mobile {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ds-color-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Floating Action Button (FAB) */
.btn-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s ease;
}

.btn-fab:hover {
    transform: scale(1.1);
}

/* Mobile Actions - Additional padding helper */
.has-mobile-actions {
    padding-bottom: 80px;
}

/* Responsive Tables */
.table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    /* Hide desktop table, show mobile cards */
    .table-desktop {
        display: none;
    }

    .table-mobile-cards {
        display: block;
    }
}

@media (min-width: 768px) {
    .table-desktop {
        display: table;
    }

    .table-mobile-cards {
        display: none;
    }
}

/* Utility Classes */
.min-w-0 {
    min-width: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Swipe Indicators - See lines 858-893 for main styles */

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--ds-color-bg-tertiary) 25%, var(--ds-color-text-tertiary) 50%, var(--ds-color-bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .card {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Accessibility - Visually Hidden but Screen Reader Accessible */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Mobile-specific button sizing */
@media (max-width: 767px) {
    .btn-icon-mobile .btn-text {
        display: none;
    }

    .btn-icon-mobile i {
        font-size: 1.2rem;
    }

    /* Make modals fullscreen on mobile */
    .modal-fullscreen-sm-down {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: 100%;
        border: 0;
        border-radius: 0;
    }
}
