/* ==========================================================================
   CP ACTION LOG STYLES - REFACTORED & CONSOLIDATED
   ========================================================================== */

/* Shared variables are loaded as a dependency via wp_enqueue_style */

/* Note: meetings-buttons.css, meetings-modals.css, and committee.css are enqueued via PHP to avoid duplicate loading */

/* Assignment button styles are handled in action-form.css */


/* ==========================================================================
   ACTION LOG SPECIFIC OVERRIDES AND EXTENSIONS
   ========================================================================== */

/* Action Log Container - extends committee.css patterns */
.cp-action-log {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--cp-spacing-md);
}

.cp-action-log h2 {
  text-align: center;
  margin-bottom: var(--cp-spacing-md);
  color: var(--cp-primary);
  font-size: 2em;
  font-weight: 600;
}

/* ==========================================================================
   ACTION LOG FILTERS - extends committee.css .cp-task-filters
   ========================================================================== */

/* Override base .cp-task-filters with enhanced styling */
.cp-action-log .cp-task-filters {
  background: var(--cp-gradient-subtle-blue);
  padding: var(--cp-spacing-lg);
  border: 1px solid var(--cp-border);
  box-shadow: var(--cp-shadow);
}

.cp-filter-row {
  display: flex;
  gap: var(--cp-spacing-lg);
  flex-wrap: wrap;
  align-items: end;
}

.cp-filter-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
}

.cp-filter-group label {
  font-weight: 600;
  margin-bottom: var(--cp-spacing-xs);
  color: var(--cp-primary);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cp-filter-select {
  padding: var(--cp-spacing-sm) var(--cp-spacing-md);
  border: var(--cp-input-border-width) solid var(--cp-input-border-color);
  border-radius: var(--cp-radius-sm);
  font-size: 14px;
  background: white;
  color: var(--cp-text);
  transition: var(--cp-transition-normal);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cp-filter-select:hover {
  border-color: var(--cp-input-border-color-hover);
  border-width: var(--cp-input-border-width-focus);
}

.cp-filter-select:focus {
  outline: none;
  border-color: var(--cp-input-border-color-focus);
  border-width: var(--cp-input-border-width-focus);
  box-shadow: var(--cp-input-focus-shadow);
}

/* Specific width for assignee dropdown */
#cp-filter-assignee {
  width: 270px;
}

/* ==========================================================================
   ACTION LOG BUTTONS - extends meetings-buttons.css
   ========================================================================== */

.cp-action-log-actions {
  margin-bottom: var(--cp-spacing-lg);
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Button styles are consolidated in action-form.css */

/* ==========================================================================
   FILTER LAYOUT - extends committee.css .cp-task-filters
   ========================================================================== */

/* Filter actions group - aligns Add Action button to the right */
.cp-filter-actions {
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
}

.cp-filter-actions .cp-meeting-btn {
  margin: 0 !important;
}

/* Dashicons in buttons */
.cp-meeting-btn .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 1;
  margin-right: 6px;
}

/* ==========================================================================
   TASKS TABLE - extends committee.css .cp-action-log-table
   ========================================================================== */

.cp-tasks-table {
  margin-top: var(--cp-spacing-lg);
  border-radius: var(--cp-radius-md);
  box-shadow: var(--cp-shadow);
  max-width: 100%;
}

.cp-tasks-table table {
  width: 100%;
  min-width: 600px; /* Minimum width to prevent cramping */
  border-collapse: collapse;
  background: white;
  border-radius: var(--cp-radius-md);
  overflow: hidden;
}

.cp-tasks-table th {
  background: linear-gradient(to bottom, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9em;
  letter-spacing: 0.5px;
  padding: var(--cp-spacing-md);
  text-align: left;
  border-bottom: 2px solid var(--cp-primary-dark);
}

.cp-tasks-table td {
  padding: var(--cp-spacing-md);
  border-bottom: 1px solid var(--cp-border);
  vertical-align: top;
  font-size: 14px;
}

.cp-tasks-table tbody tr:nth-child(even) {
  background-color: var(--cp-table-row-alt);
}

.cp-tasks-table tbody tr:hover {
  background-color: var(--cp-table-row-hover);
}

.cp-tasks-table tbody tr:last-child td {
  border-bottom: none;
}

/* Column width controls for better responsiveness */
.cp-tasks-table th:nth-child(1), .cp-tasks-table td:nth-child(1) { width: 10%; } /* Created Date */
.cp-tasks-table th:nth-child(2), .cp-tasks-table td:nth-child(2) { width: 30%; } /* Description */
.cp-tasks-table th:nth-child(3), .cp-tasks-table td:nth-child(3) { width: 10%; } /* Status */
.cp-tasks-table th:nth-child(4), .cp-tasks-table td:nth-child(4) { width: 10%; } /* Due Date */
.cp-tasks-table th:nth-child(5), .cp-tasks-table td:nth-child(5) { 
  width: 12%; 
  font-size: 0.85em;
  line-height: 1.3;
} /* Assignees */
.cp-tasks-table th:nth-child(6), .cp-tasks-table td:nth-child(6) { 
  width: 18%; 
  font-size: 0.85em;
  line-height: 1.3;
} /* Last Note */
.cp-tasks-table th:nth-child(7), .cp-tasks-table td:nth-child(7) { 
  width: 5%; 
  white-space: nowrap; /* Prevent action buttons from wrapping */
} /* Action */

/* Assignee styling */
.cp-tasks-table td .secondary-assignee {
  font-style: italic;
  color: #666;
  font-size: 0.9em;
}

/* Assignees bullet list styling */
.cp-tasks-table td ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cp-tasks-table td ul li {
  margin: 0 !important;
  padding: 0;
  position: relative;
  padding-left: 1.2em;
  font-size: 14px !important;
  font-family: inherit !important;
  color: inherit !important;
}

.cp-tasks-table td ul li:before {
  content: "•" !important;
  color: var(--cp-primary, #741f11) !important;
  font-weight: bold !important;
  position: absolute !important;
  left: 0.5em !important;
  top: 0.18em !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  bottom: auto !important;
  display: block !important;
  font-size: 1em !important;
  line-height: 1 !important;
  background: none !important;
  width: auto !important;
  height: auto !important;
}

.cp-tasks-table td ul li.secondary-assignee {
  font-style: italic;
  color: #666 !important;
  font-size: 0.9em !important;
}

/* Last Note column styling */
.cp-last-note {
  font-size: 0.9em;
  line-height: 1.3;
}

.cp-note-text {
  margin-bottom: 0.3em;
  color: #333;
}

.cp-note-meta {
  font-size: 0.8em;
  color: #666;
  font-style: italic;
}

/* Edit button styles are consolidated in action-form.css */

/* ==========================================================================
   ASSIGNEES STYLING
   ========================================================================== */

/* Style assignees column specifically (5th column) */
.cp-action-log .cp-tasks-table td:nth-child(5) {
  color: #333 !important;
  line-height: 1.4;
}

/* Remove bold from primary assignees (strong tags) */
.cp-action-log .cp-tasks-table td:nth-child(5) strong {
  font-weight: normal !important;
  color: #333 !important;
}

/* Style secondary assignees with grey and italic */
.cp-action-log .cp-tasks-table td:nth-child(5) .secondary-assignee {
  color: #666 !important;
  font-style: italic !important;
}

/* ==========================================================================
   CONSOLIDATED STATUS AND RAG INDICATORS - Base status patterns
   ========================================================================== */

/* Base status and RAG indicator styles - consolidated from all files */
.cp-status,
.cp-rag-status,
.cp-action-log .cp-status,
.cp-action-log .cp-rag-status,
.cp-action-form .cp-status,
.cp-action-form .cp-rag-status,
.cp-task-activity .cp-status,
.cp-task-activity .cp-rag-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  text-align: center;
  border: 1px solid;
}

.cp-status,
.cp-action-log .cp-status,
.cp-action-form .cp-status,
.cp-task-activity .cp-status {
  min-width: 60px;
}

.cp-rag-status,
.cp-action-log .cp-rag-status,
.cp-action-form .cp-rag-status,
.cp-task-activity .cp-rag-status {
  min-width: 40px;
}

/* Status colors - consolidated */
.cp-status-open,
.cp-action-log .cp-status-open,
.cp-action-form .cp-status-open,
.cp-task-activity .cp-status-open {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.cp-status-closed,
.cp-action-log .cp-status-closed,
.cp-action-form .cp-status-closed,
.cp-task-activity .cp-status-closed {
  background-color: #f3e5f5;
  color: #6a1b9a;
  border-color: #e1bee7;
}

.cp-status-cancelled,
.cp-action-log .cp-status-cancelled,
.cp-action-form .cp-status-cancelled,
.cp-task-activity .cp-status-cancelled {
  background-color: #f5f5f5;
  color: #424242;
  border-color: #e0e0e0;
}

/* RAG status colors - consolidated */
.cp-rag-red,
.cp-rag-status--red,
.cp-action-log .cp-rag-red,
.cp-action-form .cp-rag-red,
.cp-task-activity .cp-rag-red {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.cp-rag-amber,
.cp-rag-status--amber,
.cp-action-log .cp-rag-amber,
.cp-action-form .cp-rag-amber,
.cp-task-activity .cp-rag-amber {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

.cp-rag-green,
.cp-rag-status--green,
.cp-action-log .cp-rag-green,
.cp-action-form .cp-rag-green,
.cp-task-activity .cp-rag-green {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

/* RAG-based status colors - consolidated */
.cp-status-rag-r,
.cp-action-log .cp-status-rag-r,
.cp-action-form .cp-status-rag-r,
.cp-task-activity .cp-status-rag-r {
  background-color: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}

.cp-status-rag-a,
.cp-action-log .cp-status-rag-a,
.cp-action-form .cp-status-rag-a,
.cp-task-activity .cp-status-rag-a {
  background-color: #fff8e1;
  color: #f57c00;
  border-color: #ffecb3;
}

.cp-status-rag-g,
.cp-action-log .cp-status-rag-g,
.cp-action-form .cp-status-rag-g,
.cp-task-activity .cp-status-rag-g {
  background-color: #e8f5e8;
  color: #2e7d32;
  border-color: #c8e6c9;
}

/* ==========================================================================
   MODAL STYLES - extends modals.css
   ========================================================================== */

/* Modal styles are consolidated in action-form.css */

/* Form styles are consolidated in action-form.css */

/* Modal form styles are consolidated in action-form.css */

/* Filter toggle button - hidden by default on desktop */
.cp-filter-toggle {
  display: none;
}

/* Filter content - visible by default on desktop */
.cp-filter-content {
  display: flex;
  gap: 15px;
}

/* Desktop filter row layout */
.cp-filter-row {
  display: flex;
  align-items: center;
  gap: var(--cp-spacing-md);
  flex-wrap: wrap;
}

.cp-filter-group {
  flex: 1;
  min-width: 200px;
}

.cp-filter-actions {
  flex: 0 0 auto;
}

/* Make button group text larger */
.cp-action-log .cp-button-group-label,
.cp-modal .cp-button-group-label,
.cp-action-log-modal .cp-button-group-label {
  font-size: 1em !important;
}

/* RAG Status dropdown styling moved to action-form.css for consolidation */

/* Make small button text larger */
.cp-action-log .cp-meeting-btn-small,
.cp-action-log .cp-button-small,
.cp-modal .cp-meeting-btn-small,
.cp-modal .cp-button-small,
.cp-action-log-modal .cp-meeting-btn-small,
.cp-action-log-modal .cp-button-small {
  font-size: 0.9em !important;
}

/* Edit button icon-only style for action log */
.cp-edit-task-btn.cp-edit-btn-icon-only {
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%) !important;
  border: 1px solid rgba(116, 31, 17, 0.3) !important;
  color: var(--cp-primary) !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: var(--cp-radius-sm) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all var(--cp-transition-normal) !important;
  box-shadow: 0 2px 6px rgba(116, 31, 17, 0.15) !important;
  font-size: 0 !important;
  line-height: 1 !important;
}

.cp-edit-task-btn.cp-edit-btn-icon-only .cp-edit-icon {
  font-size: 14px !important;
  line-height: 1 !important;
  margin: 0 !important;
  color: var(--cp-primary) !important;
}

.cp-edit-task-btn.cp-edit-btn-icon-only .cp-edit-icon img.emoji {
  width: 1em !important;
  height: 1em !important;
}

.cp-edit-task-btn.cp-edit-btn-icon-only:hover {
  background: linear-gradient(to bottom, var(--cp-primary-light) 0%, var(--cp-primary) 100%) !important;
  border-color: var(--cp-primary) !important;
  color: white !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 2px 8px rgba(129, 35, 18, 0.3) !important;
}

.cp-edit-task-btn.cp-edit-btn-icon-only:hover .cp-edit-icon {
  color: white !important;
}

.cp-edit-task-btn.cp-edit-btn-icon-only:active {
  background: linear-gradient(to bottom, var(--cp-primary) 0%, var(--cp-primary-dark) 100%) !important;
  transform: translateY(0) !important;
  box-shadow: 0 1px 4px rgba(129, 35, 18, 0.2) !important;
}

/* Fix created-at-group to be full width on mobile only */
@media (max-width: 768px) {
  .cp-modal #cp-created-at-group,
  .cp-action-log-modal #cp-created-at-group {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin-bottom: var(--cp-spacing-md) !important;
  }
}

/* Move inline styles to CSS */
.cp-field-locked-notice {
  font-size: 0.8em !important;
  color: #666 !important;
  margin-top: 4px !important;
}

/* Form styling is consolidated in action-form.css */

.cp-action-log .cp-form-group textarea {
  resize: vertical;
  min-height: 80px;
  width: 95%;
}

/* Form row display - consolidated with high specificity */
.cp-action-log .cp-form-row,
div.cp-action-log div.cp-form-row {
  display: flex !important;
  gap: var(--cp-spacing-lg) !important;
  flex-wrap: wrap !important;
}

/* Form row styling is consolidated in action-form.css */

.cp-action-log .cp-form-row .cp-form-group {
  flex: 1;
  min-width: 200px;
}

.cp-action-log .cp-form-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #eee;
  padding-top: 20px;
  margin-top: 30px;
}

/* Assignment management styles are consolidated in action-form.css */

/* ==========================================================================
   MESSAGES AND STATES - extends committee.css message styles
   ========================================================================== */

/* Override base message styles with action log specific enhancements */
.cp-action-log .cp-no-tasks {
  text-align: center;
  padding: var(--cp-spacing-xl);
  color: var(--cp-text-muted);
  font-style: italic;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--cp-radius-md);
  border: 2px dashed var(--cp-border);
}

.cp-action-log .cp-loading {
  text-align: center;
  padding: var(--cp-spacing-xl);
  color: var(--cp-text-muted);
  font-style: italic;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--cp-radius-md);
  border: 2px solid var(--cp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--cp-spacing-sm);
}

.cp-action-log .cp-loading .cp-spinner {
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--cp-primary);
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Large tablet - all three dropdowns on same row */
@media (max-width: 778px) and (min-width: 771px) {
  .cp-filter-row {
    flex-wrap: nowrap;
  }
  
  .cp-filter-group {
    flex: 1;
    min-width: auto;
  }
  
  #cp-filter-assignee {
    width: 100%;
  }
  
  .cp-filter-actions {
    flex-shrink: 0;
  }
}

/* Medium tablet - Status & RAG on top row, Assignee & Add Action on bottom */
@media (max-width: 770px) and (min-width: 769px) {
  .cp-filter-row {
    flex-wrap: wrap;
    gap: var(--cp-spacing-md);
  }
  
  .cp-filter-group:not(.cp-filter-actions) {
    flex: 0 0 calc(50% - var(--cp-spacing-md)/2);
  }
  
  .cp-filter-actions {
    flex: 0 0 100%;
    margin-top: var(--cp-spacing-md);
    display: flex;
    justify-content: flex-start;
  }
  
  #cp-filter-assignee {
    width: 100%;
  }
}

/* Small tablet - Status & RAG 100% width, Assignee fixed width, Add Action centered */
@media (max-width: 768px) and (min-width: 767px) {
  .cp-filter-row {
    flex-direction: column;
    gap: var(--cp-spacing-md);
  }
  
  .cp-filter-group:not(.cp-filter-actions):not(:last-child) {
    width: 100%;
  }
  
  .cp-filter-group:last-child:not(.cp-filter-actions) {
    width: 270px; /* Keep assignee at fixed width */
  }
  
  .cp-filter-actions {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  #cp-filter-assignee {
    width: 270px !important;
  }
}

/* Mobile devices */
@media (max-width: 765px) {
  .cp-action-log {
    padding: var(--cp-spacing-xs);
  }
  
  /* Filter panel container with toggle button */
  .cp-filter-row {
    display: flex !important;
    align-items: center !important;
    gap: var(--cp-spacing-md) !important;
    flex-direction: row !important;
    position: relative;
  }
  
  /* Ensure perfect vertical alignment for all filter row children */
  .cp-filter-row > * {
    display: flex !important;
    align-items: center !important;
    vertical-align: top !important;
  }
  
  /* Filter toggle button - show on mobile */
  .cp-filter-toggle {
    display: flex !important;
    position: static !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    background: linear-gradient(to bottom, var(--cp-primary-light) 0%, var(--cp-primary) 100%);
    color: white;
    border: none;
    border-radius: var(--cp-radius-sm);
    cursor: pointer;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.2em;
    transition: all var(--cp-transition-normal);
    box-shadow: var(--cp-shadow-normal);
    flex-shrink: 0;
    flex: 0 0 auto !important;
    order: 1;
    line-height: 1 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
  }
  
  /* Override min-width for filter toggle specifically */
  .cp-filter-row .cp-filter-toggle.cp-filter-group {
    min-width: 40px !important;
    max-width: 40px !important;
    flex: 0 0 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .cp-filter-toggle:hover {
    background: linear-gradient(to bottom, #c44d3a 0%, var(--cp-primary-light) 100%);
    transform: translateY(-1px);
  }
  
  .cp-filter-toggle.active {
    background: linear-gradient(to bottom, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
  }
  
  /* Filter icon using CSS */
  .cp-filter-toggle::before {
    content: "⚙";
    font-size: 1.1em;
    transition: transform var(--cp-transition-normal);
  }
  
  .cp-filter-toggle.active::before {
    transform: rotate(90deg);
  }
  
  /* Collapsible filter content - hidden by default on mobile */
  .cp-filter-content {
    display: none !important;
    flex-direction: column;
    gap: var(--cp-spacing-sm);
    padding: var(--cp-spacing-md);
    width: 100%;
    position: absolute;
    top: 100%;
    left: -10px;
    right: 0;
    background: var(--cp-gradient-enhanced-blue);
    z-index: 10;
    box-shadow: var(--cp-shadow-normal);
    border-radius: var(--cp-radius-md);
    margin-top: var(--cp-spacing-xs);
  }
  
  .cp-filter-content.show {
    display: flex !important;
  }
  
  /* Filter actions positioning */
  .cp-filter-actions {
    display: flex !important;
    flex: 1 !important;
    justify-content: flex-end !important;
    align-items: center !important;
    flex-direction: row !important;
    order: 2;
    height: 40px !important;
  }
  
  /* Ensure Add Action button doesn't take full width and matches filter button height */
  .cp-filter-actions .cp-meeting-btn {
    /*width: auto !important;*/
    min-width: auto !important;
    max-width: none !important;
    flex-shrink: 0;
    height: 40px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* When filters are shown, reset Add Action button */
  .cp-filter-content.show ~ .cp-filter-actions {
    justify-content: flex-end;
    margin-top: 0 !important;
  }
  
  .cp-filter-group {
    min-width: 100%;
  }
  
  /* Override min-width for filter groups in dropdown content to be full width */
  .cp-filter-content .cp-filter-group {
    min-width: 100% !important;
    width: 100% !important;
  }
  
  /* But keep button row filter groups with auto width to prevent wrapping */
  .cp-filter-row > .cp-filter-group:not(.cp-filter-content) {
    min-width: auto !important;
  }
  
  /* But ensure filter toggle stays at 40px */
  .cp-filter-row .cp-filter-toggle {
    min-width: 40px !important;
    max-width: 40px !important;
    flex: 0 0 40px !important;
  }
  
  /* Override mobile.css button styles for filter toggle */
  .cp-filter-toggle {
    width: 40px !important;
    max-width: 40px !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
  }
  
  /* Override fixed width for assignee dropdown on mobile */
  #cp-filter-assignee {
    width: 100% !important;
  }
  
  .cp-form-row {
    flex-direction: column;
  }
  
  .cp-form-row .cp-form-group {
    min-width: 100%;
  }
  
  /* Quarter-width groups stack on mobile */
  .cp-form-row .cp-form-group.cp-form-group-quarter {
    flex: 0 0 100% !important;
    margin-right: 0;
  }
  
  .cp-action-log-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Form group width controls - consolidated */
.cp-form-row .cp-form-group.cp-form-group-half {
  flex: 0 0 48% !important;
  min-width: 200px;
  margin-right: 2%;
}

.cp-form-row .cp-form-group.cp-form-group-half:last-child {
  margin-right: 0;
}

.cp-form-row .cp-form-group.cp-form-group-quarter {
  flex: 0 0 23% !important;
  min-width: 150px !important;
  margin-right: 2% !important;
}

.cp-form-row .cp-form-group.cp-form-group-quarter:last-child {
  margin-right: 0 !important;
}

.cp-modal-large .cp-modal-content {
  width: 98%;
  margin: 1%;
}

.cp-tasks-table {
  font-size: 14px !important;
}

.cp-tasks-table th,
.cp-tasks-table td {
  padding: var(--cp-spacing-sm);
}

/* Mobile card layout for table - below 768px */
@media (max-width: 767px) {
  .cp-tasks-table {
    overflow-x: visible;
    box-shadow: none;
  }
  
  .cp-post {
    padding: 5px;
  }
  
  .cp-tasks-table table {
    min-width: auto !important;
    width: 100% !important;
    background: none !important;
  }
  
  .cp-tasks-table table,
  .cp-tasks-table thead,
  .cp-tasks-table tbody,
  .cp-tasks-table th,
  .cp-tasks-table td,
  .cp-tasks-table tr {
    display: block;
  }
  
  .cp-tasks-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .cp-tasks-table tr {
    border: none;
    border-radius: 8px;
    margin: var(--cp-spacing-sm) 5px var(--cp-spacing-md) 5px;
    padding: 0;
    background: #fff;
    box-shadow: var(--cp-shadow-normal);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }
  
  /* Override alternating row colors in mobile view */
  .cp-tasks-table tbody tr:nth-child(even) {
    background: inherit !important;
  }
  
  .cp-tasks-table tbody tr:nth-child(odd) {
    background: inherit !important;
  }
  
  /* RAG-based gradient backgrounds for Open actions */
  .cp-tasks-table tbody tr[data-status="Open"][data-rag="G"] { 
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important; 
  }
  .cp-tasks-table tbody tr[data-status="Open"][data-rag="A"] { 
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%) !important; 
  }
  .cp-tasks-table tbody tr[data-status="Open"][data-rag="R"] { 
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%) !important; 
  }
  .cp-tasks-table tbody tr[data-status="Open"]:not([data-rag]) { 
    background: #fff !important; 
  }
  
  /* Closed/Cancelled actions keep grey background */
  .cp-tasks-table tbody tr[data-status="Closed"],
  .cp-tasks-table tbody tr[data-status="Cancelled"] {
    background: #e9ecef !important;
  }
  
  /* Override all column width rules in mobile view */
  .cp-tasks-table th,
  .cp-tasks-table td {
    width: auto !important;
  }
  
  /* Hide Created Date in mobile view */
  .cp-tasks-table td:nth-child(1) {
    display: none !important;
  }
  
  /* Description as main title */
  .cp-tasks-table td:nth-child(2) {
    border: none;
    position: relative;
    padding: var(--cp-spacing-md) var(--cp-spacing-md) var(--cp-spacing-sm) var(--cp-spacing-md);
    padding-right: 60px; /* Make room for the edit button */
    display: flex;
    align-items: flex-start;
    gap: var(--cp-spacing-sm);
    width: 100% !important;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--cp-primary);
    line-height: 1.4;
  }
  
  .cp-tasks-table td:nth-child(2):before {
    display: none;
  }
  
  /* Edit button positioned where Created Date was */
  .cp-tasks-table td:nth-child(7) {
    position: absolute;
    top: var(--cp-spacing-md);
    right: var(--cp-spacing-md);
    padding: 0;
    background: none;
    border: none;
    z-index: 1;
    width: auto !important;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cp-tasks-table td:nth-child(7):before {
    display: none;
  }
  
  /* Icon button styling handled by .cp-edit-btn-icon-only */
  
  /* Hide Status and Due Date in mobile view */
  .cp-tasks-table td:nth-child(3),
  .cp-tasks-table td:nth-child(4) {
    display: none !important;
  }
  
  /* Content section - Assignees and Last Note only */
  .cp-tasks-table td:nth-child(5),
  .cp-tasks-table td:nth-child(6) {
    border: none;
    position: relative;
    padding: var(--cp-spacing-xs) var(--cp-spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--cp-spacing-sm);
    width: 100% !important;
  }
  
  .cp-tasks-table td:nth-child(5):before,
  .cp-tasks-table td:nth-child(6):before {
    display: none;
  }
  
  .cp-tasks-table td:nth-child(5) > *:not(:before),
  .cp-tasks-table td:nth-child(6) > *:not(:before) {
    flex: 1;
  }
  
  /* Fix bullet points positioning in mobile view */
  .cp-tasks-table td ul {
    margin: 0;
    padding: 0;
    padding-left: 0;
    list-style: none;
  }
  
  .cp-tasks-table td ul li {
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    padding-left: 1em !important;
    font-size: 14px !important;
    font-family: inherit !important;
    font-weight: bold !important;
    color: inherit !important;
  }
  
  .cp-tasks-table td ul li:before {
    content: "•" !important;
    color: var(--cp-primary, #741f11) !important;
    font-weight: bold !important;
    position: absolute !important;
    left: 5px !important;
    top: -5px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    bottom: auto !important;
    display: block !important;
    font-size: 1em !important;
    line-height: 1 !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
  }
  
}

/* Mobile devices */
@media (max-width: 480px) {
  .cp-action-log h2 {
    font-size: 1.5em;
  }
  
  .cp-task-filters {
    padding: var(--cp-spacing-md);
  }
  
  .cp-modal-body {
    padding: 0; /*var(--cp-spacing-md);*/
  }
  
  .cp-form-actions {
    flex-direction: column;
  }
  
  /* Larger modal close button for mobile */
  .cp-modal-close {
    top: -2px;
    right: -6px;
    width: 32px !important;
    height: 32px !important;
    font-size: 2em !important;
  }
  
  /* Make assignment elements 100% width on mobile */
  .cp-assignment-type-selector {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  .cp-assignment-role-group,
  .cp-assignment-person-group {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Override assignment select width constraints on mobile */
  .cp-modal .cp-assignment-role-group select,
  .cp-modal .cp-assignment-person-group select,
  .cp-action-log-modal .cp-assignment-role-group select,
  .cp-action-log-modal .cp-assignment-person-group select {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Make form action buttons 100% width on mobile */
  .cp-form-actions .cp-meeting-btn,
  .cp-form-actions .cp-button {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Make Add Action button 100% width on mobile */
  .cp-add-task-btn {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Make button group text larger on mobile */
  .cp-button-group-label {
    font-size: 1em !important;
  }
  
  /* Make small button text larger on mobile */
  .cp-meeting-btn-small,
  .cp-button-small {
    font-size: 1em !important;
  }
  
  .cp-tasks-table tr {
    padding: 2px;
    margin-bottom: var(--cp-spacing-sm);
  }
  
  .cp-tasks-table td:nth-child(2) {
    padding: var(--cp-spacing-sm) var(--cp-spacing-sm) var(--cp-spacing-xs) var(--cp-spacing-sm);
    padding-right: 80px;
    font-size: 1em;
  }
  
  .cp-tasks-table td:nth-child(7) {
    top: var(--cp-spacing-sm);
    right: var(--cp-spacing-sm);
  }
  
  /* Icon button styling handled by .cp-edit-btn-icon-only */
  
  .cp-tasks-table td:nth-child(5),
  .cp-tasks-table td:nth-child(6) {
    padding: var(--cp-spacing-xs) var(--cp-spacing-sm);
  }
  
  .cp-tasks-table td:nth-child(5):before,
  .cp-tasks-table td:nth-child(6):before {
    display: none;
  }
  
  .cp-status,
  .cp-rag-status {
    font-size: 10px;
    padding: 4px 8px;
  }
}

/* ==========================================================================
   MESSAGE STYLES
   ========================================================================== */

/* Message styles - consolidated */
.cp-message {
  padding: var(--cp-spacing-md);
  margin: var(--cp-spacing-sm) 0;
  border-radius: var(--cp-radius-sm);
  font-weight: 500;
  border-left: 4px solid;
}

.cp-message-success {
  background-color: #d4edda;
  color: #155724;
  border-left-color: #28a745;
}

.cp-message-error {
  background-color: #f8d7da;
  color: #721c24;
  border-left-color: #dc3545;
}

/* Modal message overrides */
.cp-modal .cp-message {
  margin: var(--cp-spacing-md);
}

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

.cp-button:focus,
.cp-modal-close:focus {
  outline: 2px solid var(--cp-primary);
  outline-offset: 2px;
}

/* Select focus styles moved to action-form.css for consolidation */
.cp-filter-select:focus {
  outline: 2px solid var(--cp-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .cp-status,
  .cp-rag-status {
    border-width: 2px;
  }
  
  .cp-button {
    border: 2px solid currentColor;
  }
}


/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .cp-button,
  .cp-modal-close,
  .cp-filter-select,
  .cp-form-group input,
  .cp-form-group textarea,
  /* Form select transition styles moved to action-form.css for consolidation */
  
  .cp-modal-content {
    animation: none;
  }
}

/* ==========================================================================
   CONSOLIDATED LOADING STATES - Base loading patterns
   ========================================================================== */

/* Loading spinner - consolidated from all files */
.cp-spinner,
.cp-action-log .cp-spinner,
.cp-action-form .cp-spinner,
.cp-task-activity .cp-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: cp-spin 1s ease-in-out infinite;
}

@keyframes cp-spin {
  to { transform: rotate(360deg); }
}

/* Button loading states - consolidated */
.cp-edit-task-btn.loading,
.cp-delete-task-btn.loading,
.cp-add-assignment-btn.loading,
.cp-remove-assignment-btn.loading,
.cp-action-log .cp-edit-task-btn.loading,
.cp-action-log .cp-delete-task-btn.loading,
.cp-action-form .cp-edit-task-btn.loading,
.cp-action-form .cp-delete-task-btn.loading,
.cp-task-activity .cp-edit-task-btn.loading,
.cp-task-activity .cp-delete-task-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.cp-edit-task-btn.loading .cp-btn-text,
.cp-delete-task-btn.loading .cp-btn-text,
.cp-add-assignment-btn.loading .cp-btn-text,
.cp-remove-assignment-btn.loading .cp-btn-text,
.cp-action-log .cp-edit-task-btn.loading .cp-btn-text,
.cp-action-log .cp-delete-task-btn.loading .cp-btn-text,
.cp-action-form .cp-edit-task-btn.loading .cp-btn-text,
.cp-action-form .cp-delete-task-btn.loading .cp-btn-text,
.cp-task-activity .cp-edit-task-btn.loading .cp-btn-text,
.cp-task-activity .cp-delete-task-btn.loading .cp-btn-text {
  display: inline-flex !important;
}

.cp-edit-task-btn.loading .cp-btn-loading,
.cp-delete-task-btn.loading .cp-btn-loading,
.cp-add-assignment-btn.loading .cp-btn-loading,
.cp-remove-assignment-btn.loading .cp-btn-loading,
.cp-action-log .cp-edit-task-btn.loading .cp-btn-loading,
.cp-action-log .cp-delete-task-btn.loading .cp-btn-loading,
.cp-action-form .cp-edit-task-btn.loading .cp-btn-loading,
.cp-action-form .cp-delete-task-btn.loading .cp-btn-loading,
.cp-task-activity .cp-edit-task-btn.loading .cp-btn-loading,
.cp-task-activity .cp-delete-task-btn.loading .cp-btn-loading {
  display: flex !important;
  align-items: center;
  margin-left: var(--cp-spacing-sm);
}

.cp-btn-text,
.cp-btn-loading,
.cp-action-log .cp-btn-text,
.cp-action-log .cp-btn-loading,
.cp-action-form .cp-btn-text,
.cp-action-form .cp-btn-loading,
.cp-task-activity .cp-btn-text,
.cp-task-activity .cp-btn-loading {
  flex-shrink: 0 !important;
}

.cp-btn-loading,
.cp-action-log .cp-btn-loading,
.cp-action-form .cp-btn-loading,
.cp-task-activity .cp-btn-loading {
  display: none;
  align-items: center;
  gap: var(--cp-spacing-sm);
  font-size: 0.9em;
  opacity: 0.9;
}

/* Form loading state - consolidated */
.cp-form-loading,
.cp-action-log .cp-form-loading,
.cp-action-form .cp-form-loading,
.cp-task-activity .cp-form-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.cp-form-loading::after,
.cp-action-log .cp-form-loading::after,
.cp-action-form .cp-form-loading::after,
.cp-task-activity .cp-form-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  border-top-color: var(--cp-primary);
  animation: cp-spin 1s ease-in-out infinite;
  z-index: 1000;
}

/* Table loading state - consolidated */
.cp-tasks-table.loading,
.cp-action-log .cp-tasks-table.loading,
.cp-action-form .cp-tasks-table.loading,
.cp-task-activity .cp-tasks-table.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.cp-tasks-table.loading::after,
.cp-action-log .cp-tasks-table.loading::after,
.cp-action-form .cp-tasks-table.loading::after,
.cp-task-activity .cp-tasks-table.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid rgba(0,0,0,0.1);
  border-radius: 50%;
  border-top-color: var(--cp-primary);
  animation: cp-spin 1s ease-in-out infinite;
  z-index: 1000;
}
