/* src/css/styles.css */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: 100%;
  max-width: 500px;
  min-height: 100vh;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  position: relative;
}

.app-header {
  padding: 16px;
  background: #2c3e50;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.global-timer {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: bold;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 20px;
}

.hidden {
  display: none !important;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 70px; /* Space for bottom nav */
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: white;
  display: flex;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 100;
}

.tab-button {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #888;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-button.active {
  color: #2c3e50;
  font-weight: 600;
}

.tab-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

/* Lists */
.protocol-list, .history-list {
  list-style: none;
  margin-top: 12px;
}

.list-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
}

.list-item:active {
  background: #f0f0f0;
}

.list-item .item-info {
  flex: 1;
}

.list-item .item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.list-item .item-meta {
  font-size: 0.8rem;
  color: #666;
}

.icon-button {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:active {
  background: rgba(0,0,0,0.1);
}

.full-width {
  width: 100%;
}

.text-input {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin: 8px 0;
}

.secondary-button {
  background: #e0e0e0;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin: 8px 0;
}

.danger-button {
  background: #ff5252;
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin: 8px 0;
}

.section-title {
  font-weight: 700;
  margin: 16px 0 8px;
  color: #555;
}

/* Action edit items */
.action-edit-item {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.action-edit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.drag-handle {
  cursor: grab;
  font-size: 1.2rem;
  color: #999;
}

.action-name-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.photo-select {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 0.8rem;
}

.checklist-edit {
  margin-left: 28px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.checklist-item input {
  flex: 1;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.delete-item-btn {
  background: none;
  border: none;
  color: #ff5252;
  font-size: 1rem;
  cursor: pointer;
}

/* Execution states */
.action-execution-item {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  touch-action: pan-y; /* Allows vertical scrolling, swipe handled by JS */
  position: relative;
  overflow: hidden;
  user-select: none;
}

.action-execution-item.pending {
  border-left: 6px solid #f1c40f;
}

.action-execution-item.done {
  border-left: 6px solid #2ecc71;
  background: #f0faf5;
}

.action-execution-item.failed {
  border-left: 6px solid #e74c3c;
  background: #fdf0ef;
}

.action-execution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.action-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.action-timer {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: 600;
}

.action-status-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.done .action-status-badge {
  background: #2ecc71;
  color: white;
}

.failed .action-status-badge {
  background: #e74c3c;
  color: white;
}

.pending .action-status-badge {
  background: #f1c40f;
  color: #333;
}

.checklist-execution {
  margin: 8px 0;
  padding-left: 20px;
  font-size: 0.9rem;
  color: #444;
}

.photo-attach-area {
  margin-top: 8px;
}

.attach-photo-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.photo-thumb {
  max-width: 80px;
  max-height: 80px;
  border-radius: 8px;
  margin-left: 8px;
}

.execution-comments {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
}

.comments-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.comments-text {
  white-space: pre-wrap;
  margin-top: 4px;
}

.execution-footer {
  margin-top: 16px;
}

.finish-button {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  background: #bdc3c7;
  color: white;
}

.finish-button:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

.finish-button.all-done {
  background: #2ecc71;
}

.finish-button.has-failed {
  background: #e74c3c;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 40px;
  font-style: italic;
}

.import-export-bar {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.view-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.view-header h2 {
  flex: 1;
}

.detail-content {
  margin-bottom: 16px;
}

.detail-footer {
  margin-top: 16px;
}

/* Dragging over */
.drag-over {
  border-top: 3px solid #3498db;
}

/* src/css/styles.css - Add or update these styles */
.action-execution-item {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  touch-action: pan-y;
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: pointer; /* Make it obvious it's clickable */
}

.action-timer {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: 600;
  color: #2c3e50;
  margin: 8px 0;
  text-align: right;
}

.action-execution-item.timer-active {
  background: #fffef0;
  border-color: #f1c40f;
}

.global-timer {
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  min-width: 100px;
  text-align: center;
}
