/**
 * Mobile-Optimized Table Styles
 * 
 * Responsive table layouts that transform into card views on mobile devices
 * Following mobile-first approach with touch-friendly targets
 * 
 * @package SGLE_Theme
 * @version 1.0.0
 */

/* ========================================
   RESPONSIVE TABLE UTILITIES
   ======================================== */

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

  .table-responsive-mobile tbody,
  .table-responsive-mobile tr {
    display: block;
    width: 100%;
  }

  .table-responsive-mobile tr {
    margin-bottom: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  }

  .table-responsive-mobile td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: right;
  }

  .table-responsive-mobile td:last-child {
    border-bottom: none;
  }

  .table-responsive-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.875rem;
    color: #64748b;
    text-align: left;
    flex: 1;
  }

  /* Actions column special styling */
  .table-responsive-mobile td.mobile-actions {
    justify-content: center;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
    border-bottom: none;
  }

  .table-responsive-mobile td.mobile-actions::before {
    display: none;
  }
}

/* ========================================
   MOBILE CARD VIEW COMPONENTS
   ======================================== */

/* Card-based table alternative */
.mobile-card-list {
  display: none;
}

@media (max-width: 767px) {
  .mobile-card-list {
    display: block;
  }

  .desktop-table {
    display: none;
  }
}

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

  .desktop-table {
    display: block;
  }
}

/* Mobile equipment card */
.mobile-equipment-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: all 0.2s ease;
}

.mobile-equipment-card:active {
  transform: scale(0.98);
  box-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.15);
}

.mobile-equipment-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.mobile-equipment-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  background: #f1f5f9;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.mobile-equipment-card-title {
  flex: 1;
  min-width: 0;
}

.mobile-equipment-card-title h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-equipment-card-title p {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.125rem 0 0;
}

.mobile-equipment-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mobile-equipment-card-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-equipment-card-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.mobile-equipment-card-field-value {
  font-size: 0.875rem;
  color: #0f172a;
  font-weight: 500;
}

.mobile-equipment-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.mobile-equipment-card-actions button {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

/* ========================================
   MOBILE CLIENT CARD
   ======================================== */

.mobile-client-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  transition: all 0.2s ease;
}

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

.mobile-client-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mobile-client-card-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mobile-client-card-info {
  flex: 1;
  min-width: 0;
}

.mobile-client-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem;
}

.mobile-client-card-contact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-client-card-contact-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: #64748b;
}

.mobile-client-card-contact-item .material-symbols-outlined {
  font-size: 1rem;
}

.mobile-client-card-stats {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.75rem;
}

.mobile-client-card-stat {
  flex: 1;
  text-align: center;
}

.mobile-client-card-stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.mobile-client-card-stat-label {
  display: block;
  font-size: 0.6875rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-top: 0.125rem;
}

.mobile-client-card-actions {
  display: flex;
  gap: 0.5rem;
}

.mobile-client-card-actions button {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

/* ========================================
   MOBILE EVENT CARD
   ======================================== */

.mobile-event-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  position: relative;
  overflow: hidden;
}

.mobile-event-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

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

.mobile-event-card-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.mobile-event-card-date-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: #eff6ff;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-event-card-date-day {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e40af;
  line-height: 1;
}

.mobile-event-card-date-month {
  font-size: 0.625rem;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mobile-event-card-date-text {
  flex: 1;
}

.mobile-event-card-date-text-primary {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.mobile-event-card-date-text-secondary {
  font-size: 0.75rem;
  color: #64748b;
}

.mobile-event-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
  padding-left: 0.75rem;
}

.mobile-event-card-client {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.mobile-event-card-client-icon {
  font-size: 1.125rem;
  color: #64748b;
}

.mobile-event-card-client-name {
  font-size: 0.875rem;
  color: #64748b;
}

.mobile-event-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid #f1f5f9;
  margin-top: 0.75rem;
}

.mobile-event-card-status {
  /* Status badge styles */
}

.mobile-event-card-actions {
  display: flex;
  gap: 0.375rem;
}

.mobile-event-card-action-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

/* ========================================
   MOBILE SERVICE ORDER CARD
   ======================================== */

.mobile-service-order-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.mobile-service-order-card:active {
  transform: scale(0.98);
}

.mobile-service-order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mobile-service-order-card-id {
  font-size: 0.875rem;
  font-weight: 700;
  color: #3b82f6;
}

.mobile-service-order-card-status {
  /* Status badge styles */
}

.mobile-service-order-card-event {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
}

.mobile-service-order-card-client {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mobile-service-order-card-client-icon {
  font-size: 1rem;
  color: #64748b;
}

.mobile-service-order-card-client-name {
  font-size: 0.875rem;
  color: #64748b;
}

.mobile-service-order-card-equipment {
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

.mobile-service-order-card-equipment-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.375rem;
}

.mobile-service-order-card-equipment-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.mobile-service-order-card-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.75rem;
}

.mobile-service-order-card-date {
  text-align: center;
}

.mobile-service-order-card-date-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.25rem;
}

.mobile-service-order-card-date-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.mobile-service-order-card-actions {
  display: flex;
  gap: 0.5rem;
}

.mobile-service-order-card-actions button {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

/* ========================================
   TOUCH TARGETS
   ======================================== */

/* Ensure all interactive elements meet 44x44px minimum */
@media (max-width: 767px) {
  button,
  a.btn,
  input[type="button"],
  input[type="submit"],
  .mobile-card-list button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Icon buttons */
  .icon-button,
  [class*="icon-btn"] {
    min-width: 44px;
    min-height: 44px;
    padding: 0.625rem;
  }

  /* Filter dropdowns and selects */
  select,
  .filter-button,
  [class*="filter-"] button {
    min-height: 44px;
  }

  /* Pagination controls */
  .pagination button,
  [id*="btn-prev"],
  [id*="btn-next"] {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ========================================
   MOBILE FILTERS
   ======================================== */

@media (max-width: 767px) {
  .filters-bar {
    flex-direction: column;
    gap: 0.75rem;
  }

  .filter-button,
  .filters-bar button {
    width: 100%;
    justify-content: space-between;
  }

  .category-pills {
    display: none;
  }

  /* Filter dropdown menus */
  [id*="filter-menu"] {
    left: 0;
    right: 0;
    width: auto;
    margin: 0 1rem;
  }
}

/* ========================================
   MOBILE PAGINATION
   ======================================== */

@media (max-width: 767px) {
  #pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  #pagination-info {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }
}

/* ========================================
   LOADING STATES MOBILE
   ======================================== */

@media (max-width: 767px) {
  .skeleton-card-mobile {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .skeleton-card-mobile-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .skeleton-circle {
    width: 2.5rem;
    height: 2.5rem;
    background: #e2e8f0;
    border-radius: 0.5rem;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .skeleton-text {
    flex: 1;
  }

  .skeleton-line {
    height: 1rem;
    background: #e2e8f0;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
  }

  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.5;
    }
  }
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Hide on mobile */
.hide-mobile {
  display: none !important;
}

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

/* Show only on mobile */
.show-mobile {
  display: block !important;
}

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

/* Mobile spacing adjustments */
@media (max-width: 767px) {
  .mobile-px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mobile-py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .mobile-gap-4 {
    gap: 1rem;
  }
}
