/* Farmer-specific styles */

/* === SIDEBAR ITEMS === */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-neutral-700);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  min-height: var(--touch-min);
  background: none;
}
.sidebar-item:hover { background: var(--color-neutral-100); color: var(--color-neutral-900); text-decoration: none; }
.sidebar-item.active {
  background: var(--color-primary-50);
  color: var(--color-primary);
  font-weight: var(--font-semibold);
  border-right: 3px solid var(--color-primary);
}
.sidebar-item svg, .sidebar-item i { width: 20px; height: 20px; flex-shrink: 0; }

/* === SIDEBAR GROUPS (collapsible) === */
.sidebar-group { margin-bottom: 2px; }
.sidebar-group-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.sidebar-group-summary::-webkit-details-marker { display: none; }
.sidebar-group-summary:hover { color: var(--color-primary); background: var(--color-neutral-50); }
.sidebar-group[open] > .sidebar-group-summary { color: var(--color-primary); }
.sidebar-group[open] > .sidebar-group-summary .sidebar-group-chevron { transform: rotate(90deg); }
.sidebar-group-items {
  padding-left: var(--space-2);
  animation: sidebarGroupSlide 0.15s ease-out;
}
.sidebar-group-items .sidebar-item {
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
  min-height: 38px;
}
@keyframes sidebarGroupSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === BOTTOM NAV ITEMS === */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-2);
  color: var(--color-neutral-600);
  text-decoration: none;
  min-width: 60px;
  min-height: var(--bottom-nav-height);
  transition: color var(--transition-fast);
  position: relative;
}
.bottom-nav-item:hover { color: var(--color-primary); text-decoration: none; }
.bottom-nav-item.active {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
}
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* === REGISTER PAGE === */
.register-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 50%, #f0f9ff 100%);
}
.register-container {
  max-width: 480px;
  width: 100%;
}
.register-header {
  text-align: center;
  margin-bottom: var(--space-6);
}
.register-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #15803d 100%);
  border-radius: 16px;
  margin-bottom: var(--space-3);
  box-shadow: 0 4px 12px rgba(27, 122, 74, 0.3);
}
.register-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-neutral-900);
  margin-bottom: 4px;
}
.register-subtitle {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
}
.register-card {
  background: white;
  border-radius: 20px;
  padding: var(--space-7) var(--space-6);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.register-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-neutral-100);
  text-align: center;
}
.register-footer p {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
}
.register-footer a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}
.register-footer a:hover {
  text-decoration: underline;
}

/* === ROLE SELECTION CARDS === */
.register-roles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.role-option input { display: none; }
.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px 14px;
  border: 2px solid var(--color-neutral-200);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  background: white;
}
.role-card:hover {
  border-color: var(--color-primary-light);
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(27, 122, 74, 0.1);
}
.role-card.selected {
  border-color: var(--color-primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(27, 122, 74, 0.15);
}
.role-card.selected .role-card-icon {
  transform: scale(1.05);
}
.role-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: transform 0.2s ease;
}
.role-card-icon--farmer {
  background: #fef3c7;
  color: #d97706;
}
.role-card-icon--vet {
  background: #dbeafe;
  color: #2563eb;
}
.role-card-icon--vendor {
  background: #f3e8ff;
  color: #7c3aed;
}
.role-card.selected .role-card-icon--farmer { background: #fde68a; }
.role-card.selected .role-card-icon--vet { background: #bfdbfe; }
.role-card.selected .role-card-icon--vendor { background: #e9d5ff; }
.role-card-icon--inseminateur {
  background: #ede9fe;
  color: #6d28d9;
}
.role-card.selected .role-card-icon--inseminateur { background: #ddd6fe; }
.role-card-icon--petowner {
  background: #ccfbf1;
  color: #0d9488;
}
.role-card.selected .role-card-icon--petowner { background: #99f6e4; }
.role-card-icon--breeder {
  background: #fce7f3;
  color: #be185d;
}
.role-card.selected .role-card-icon--breeder { background: #fbcfe8; }
.role-card-text {
  min-height: 36px;
}
.role-card-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--color-neutral-800);
  line-height: 1.2;
}
.role-card.selected .role-card-title {
  color: var(--color-primary);
}
.role-card-desc {
  font-size: 0.6875rem;
  color: var(--color-neutral-500);
  margin-top: 2px;
  line-height: 1.2;
}
@media (max-width: 480px) {
  .register-roles {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .role-card {
    flex-direction: row;
    padding: 12px 16px;
    gap: 12px;
    text-align: left;
  }
  .role-card-icon { margin-bottom: 0; }
  .register-card { padding: var(--space-5) var(--space-4); }
}

/* === ANIMAL LIST === */
.animal-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}
.animal-card:hover { box-shadow: var(--shadow-card-hover); border-color: var(--color-primary-light); transform: translateY(-2px); }
.animal-card:active { transform: translateY(0); transition-duration: 80ms; }
.animal-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, var(--color-neutral-100), var(--color-neutral-200));
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.animal-info { flex: 1; min-width: 0; }
.animal-name { font-weight: var(--font-semibold); font-size: var(--text-base); }
.animal-id { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-neutral-600); }
.animal-meta { font-size: var(--text-sm); color: var(--color-neutral-600); margin-top: var(--space-1); }

/* === SYMPTOM WIZARD === */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  padding: var(--space-2) 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.wizard-step-number {
  width: 32px; height: 32px;
  border-radius: var(--radius-circle);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  background: var(--color-neutral-200);
  color: var(--color-neutral-600);
  flex-shrink: 0;
}
.wizard-step.active .wizard-step-number { background: var(--color-primary); color: white; }
.wizard-step.completed .wizard-step-number { background: var(--color-success); color: white; }
.wizard-step-label { font-size: var(--text-sm); color: var(--color-neutral-600); }
.wizard-step.active .wizard-step-label { color: var(--color-primary); font-weight: var(--font-semibold); }
.wizard-connector { width: 24px; height: 2px; background: var(--color-neutral-300); flex-shrink: 0; }
.wizard-step.completed + .wizard-connector { background: var(--color-success); }

/* === PHOTO CAPTURE === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-3);
}
.photo-placeholder {
  aspect-ratio: 1;
  border: 2px dashed var(--color-neutral-400);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
  color: var(--color-neutral-500);
  font-size: var(--text-xs);
  transition: all var(--transition-fast);
}
.photo-placeholder:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-50); }

/* === EMERGENCY === */
.emergency-btn {
  width: 100%;
  min-height: 80px;
  background: var(--color-error);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-lg);
}
.emergency-btn:hover { background: var(--color-error-dark); transform: scale(1.02); }
.emergency-btn:active { transform: scale(0.98); }
.emergency-pulse {
  animation: emergencyPulse 2s ease-in-out infinite;
}
@keyframes emergencyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(220, 38, 38, 0); }
}

/* === TIMELINE === */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}
.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-neutral-300);
}
.timeline-item {
  position: relative;
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
}
.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + 8px);
  top: var(--space-5);
  width: 16px;
  height: 16px;
  border-radius: var(--radius-circle);
  background: var(--color-primary);
  border: 3px solid var(--color-surface);
}
.timeline-dot.vaccination { background: var(--color-secondary); }
.timeline-dot.treatment { background: var(--color-accent); }
.timeline-dot.examination { background: var(--color-primary); }
.timeline-dot.emergency { background: var(--color-error); }
.timeline-dot.prescription { background: #8b5cf6; }
.timeline-date { font-size: var(--text-xs); color: var(--color-neutral-600); }
.timeline-title { font-weight: var(--font-semibold); margin-top: var(--space-1); }
.timeline-body { font-size: var(--text-sm); color: var(--color-neutral-700); margin-top: var(--space-2); }

/* === HEALTH TIMELINE COMPONENT === */
.ht-event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.ht-expandable { cursor: default; }
.ht-expand-btn {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-primary);
  padding: var(--space-1) var(--space-2);
}
.ht-details {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-neutral-200);
}
.ht-details-section {
  margin-bottom: var(--space-3);
}
.ht-med-item {
  font-size: var(--text-sm);
  padding: var(--space-1) 0;
  border-bottom: 1px dashed var(--color-neutral-200);
}
.ht-med-item:last-child { border-bottom: none; }
.ht-order-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}
.badge-purple {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

/* === CHAT / MESSAGING === */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-height: 800px;
  margin: calc(-1 * var(--space-4, 16px));
  background: #f8f9fa;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-neutral-200);
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--color-neutral-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}
.chat-header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-neutral-700);
  text-decoration: none;
  transition: background 0.15s;
  flex-shrink: 0;
}
.chat-header-back:hover {
  background: var(--color-neutral-100);
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #15803d);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.chat-header-info {
  flex: 1;
  min-width: 0;
}
.chat-header-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-neutral-900);
  line-height: 1.3;
}
.chat-header-subject {
  font-size: 12px;
  color: var(--color-neutral-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-animal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--color-primary-50, #f0fdf4);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-header-animal:hover {
  background: #dcfce7;
  text-decoration: none;
}

/* Message List */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f0f2f5;
  scroll-behavior: smooth;
}

/* Bubble Rows */
.chat-bubble-row {
  display: flex;
  padding: 2px 0;
}
.chat-bubble-row--me {
  justify-content: flex-end;
}
.chat-bubble-row--them {
  justify-content: flex-start;
}

/* Bubbles */
.chat-bubble {
  max-width: 75%;
  padding: 8px 12px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.45;
}
.chat-bubble--me {
  background: #1B7A4A;
  color: white;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.chat-bubble--them {
  background: white;
  color: var(--color-neutral-900);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Consecutive messages tighten radius */
.chat-bubble-row--me + .chat-bubble-row--me .chat-bubble--me {
  border-radius: 18px 4px 4px 18px;
}
.chat-bubble-row--them + .chat-bubble-row--them .chat-bubble--them {
  border-radius: 4px 18px 18px 4px;
}

/* Bubble Content */
.chat-bubble-text {
  font-size: 14px;
  line-height: 1.45;
}
.chat-bubble-time {
  font-size: 11px;
  margin-top: 4px;
  text-align: right;
  line-height: 1;
}
.chat-bubble--me .chat-bubble-time {
  color: rgba(255, 255, 255, 0.65);
}
.chat-bubble--them .chat-bubble-time {
  color: var(--color-neutral-400);
}

/* Bubble Attachments */
.chat-bubble-image {
  margin-bottom: 4px;
  border-radius: 12px;
  overflow: hidden;
}
.chat-bubble-image img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  display: block;
}
.chat-bubble-file {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 8px;
  background: var(--color-neutral-100);
  border-radius: 8px;
}
.chat-bubble-file--me {
  background: rgba(255, 255, 255, 0.15);
}
.chat-bubble-file-name {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.chat-bubble-file-size {
  font-size: 11px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Attachment Preview Bar */
.chat-attachment-preview {
  padding: 8px 16px;
  border-top: 1px solid var(--color-neutral-200);
  background: white;
  flex-shrink: 0;
}
.chat-attachment-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-attachment-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

/* Message Input Area */
.chat-input-area {
  padding: 10px 12px;
  background: white;
  border-top: 1px solid var(--color-neutral-200);
  flex-shrink: 0;
}
.chat-input-form {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f5;
  border-radius: 24px;
  padding: 4px 4px 4px 8px;
}
.chat-input-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.chat-input-action:hover {
  color: var(--color-primary);
  background: rgba(27, 122, 74, 0.08);
}
.chat-input-field {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 4px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  color: var(--color-neutral-900);
  min-width: 0;
}
.chat-input-field::placeholder {
  color: var(--color-neutral-400);
}
.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #1B7A4A;
  color: white;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.chat-send-btn:hover {
  background: #15803d;
  transform: scale(1.05);
}
.chat-send-btn:active {
  transform: scale(0.95);
}

/* Mobile adjustments for chat */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 140px);
    margin: calc(-1 * var(--space-3, 12px));
    border-radius: 0;
    border: none;
  }
  .chat-bubble {
    max-width: 85%;
  }
  .chat-header-animal {
    display: none;
  }
}
