/**
 * Global Mobile Table Styles
 * 
 * Consistent styling for all mobile table-like card layouts across the application.
 * Usage: Apply these classes to create table-like mobile views that match the desktop experience.
 * 
 * Structure:
 * <div class="mobile-table">
 *   <div class="mobile-table-header">Header Text</div>
 *   <div class="mobile-table-row">
 *     <div class="mobile-row-content">
 *       <div class="mobile-row-icon">icon/badge</div>
 *       <div class="mobile-row-details">content</div>
 *     </div>
 *   </div>
 * </div>
 */

/* Mobile Table Container - Single bordered container */
.mobile-table {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    margin-top: 1rem;
}

/* Mobile Table Header - Dark header bar */
.mobile-table-header {
    background: #374151;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

/* Mobile Table Row - Each row in the table */
.mobile-table-row {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-table-row:hover {
    background: #f9fafb;
}

.mobile-table-row:active {
    background: #f3f4f6;
}

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

/* Mobile Row Content - Flexbox layout for icon + details */
.mobile-row-content {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Mobile Row Icon - Left side icon/badge area */
.mobile-row-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
}

/* Mobile Row Details - Right side content area */
.mobile-row-details {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

/* Title - Main heading in each row */
.mobile-row-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 0.15rem;
}

/* Subtitle - Secondary info below title */
.mobile-row-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.4rem;
}

/* Metrics Row - Two-column layout for key metrics */
.mobile-row-metrics {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.mobile-row-metrics > div {
    flex: 1;
}

.mobile-row-metrics > div:last-child {
    text-align: right;
}

.mobile-row-metric-label {
    color: #6b7280;
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.mobile-row-metric-value {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.9rem;
}

/* Actions Row - Buttons at bottom of row */
.mobile-row-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.mobile-row-actions button {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
}

/* Badge Styles */
.mobile-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.mobile-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.mobile-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.mobile-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.mobile-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.mobile-badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

/* Progress Bar */
.mobile-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.mobile-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width 0.3s ease;
}

/* Icon Gradients - Consistent colors for different types */
.mobile-icon-gradient-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.mobile-icon-gradient-blue {
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

.mobile-icon-gradient-orange {
    background: linear-gradient(135deg, #f59e42, #d97706);
}

.mobile-icon-gradient-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.mobile-icon-gradient-purple {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.mobile-icon-gradient-cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.mobile-icon-gradient-gray {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* ── AI-usage panel: "example of each kind of ask" on phones ─────────────
   Four columns crush to a few characters each at phone width — collapse each
   row into a card. Global because the panel renders in the AI-usage modal AND
   on the Knowledge page (same component, ai_usage_panel.js). */
@media (max-width: 767px) {
  .aiu-examples-tbl thead { display: none; }
  .aiu-examples-tbl, .aiu-examples-tbl tbody { display: block; width: 100%; }
  .aiu-examples-tbl tbody tr {
    display: block;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 0 0 .65rem;
    padding: .55rem .7rem;
    background: #fff;
  }
  .aiu-examples-tbl tbody td {
    display: block;
    border: none !important;
    padding: .15rem 0 !important;
    white-space: normal !important;
  }
  .aiu-examples-tbl tbody td:nth-child(2) { display: inline-block; color: #94a3b8; }
  .aiu-examples-tbl tbody td:nth-child(3)::before,
  .aiu-examples-tbl tbody td:nth-child(4)::before {
    display: block;
    font-size: .62rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: #64748b; margin-top: .3rem;
  }
  .aiu-examples-tbl tbody td:nth-child(3)::before { content: 'Asked'; }
  .aiu-examples-tbl tbody td:nth-child(4)::before { content: 'Causal-D responded'; }
}
