/* ============================================
   OCCASIO OPS - MOBILE-FIRST STYLES
   ============================================ */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8f9fa;
  color: #212529;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 100px;
  min-height: 100vh;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
}

.header h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.connection-status::before {
  content: '●';
  font-size: 12px;
  animation: pulse 2s infinite;
}

.connection-status.connected::before {
  color: #4ade80;
}

.connection-status.error::before {
  color: #f87171;
  animation: none;
}

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

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.back-button:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
  transform: translateX(-4px);
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* ============================================
   SEARCH BAR
   ============================================ */

.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  font-size: 16px;
  background: white;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.search-bar input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 4px 16px rgba(102,126,234,0.15);
}

.search-bar input::placeholder {
  color: #9ca3af;
}

/* ============================================
   EVENT CARDS (List View)
   ============================================ */

.event-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.event-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

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

.event-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: #667eea;
}

.event-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #1f2937;
}

.event-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.event-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #6b7280;
}

.event-meta-item .icon {
  font-size: 16px;
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.confirmed {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.in_progress {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.completed,
.status-badge.complete {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.packed {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.loaded {
  background: #fde68a;
  color: #78350f;
}

.status-badge.delivered {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.returned {
  background: #e5e7eb;
  color: #374151;
}

.status-badge.ordered {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.picked_up {
  background: #fde68a;
  color: #78350f;
}

/* ============================================
   EVENT DETAILS HEADER
   ============================================ */

.event-header {
  background: white;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 2px solid #f3f4f6;
}

.event-header h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 16px;
  color: #111827;
  line-height: 1.2;
}

.event-header-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.event-header-meta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: #4b5563;
}

.event-header-meta-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.crew-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #f3f4f6;
}

.crew-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.crew-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crew-chip {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.add-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.add-button:active {
  transform: translateY(0);
}

/* ============================================
   ITEM CARDS
   ============================================ */

.item-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 2px solid #f3f4f6;
  transition: all 0.2s;
}

.item-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.item-info h4 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  color: #4b5563;
}

.item-detail-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-detail-row strong {
  color: #1f2937;
  min-width: 80px;
}

.item-timestamp {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 4px;
}

/* ============================================
   STATUS BUTTONS
   ============================================ */

.status-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.status-button {
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  color: #6b7280;
}

.status-button:hover {
  background: #f9fafb;
  border-color: #667eea;
}

.status-button:active {
  transform: scale(0.96);
}

.status-button.active {
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.status-button.packed.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.status-button.loaded.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.status-button.delivered.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.status-button.returned.active {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.status-button.ordered.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.status-button.picked_up.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal h3 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #111827;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: white;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102,126,234,0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-top: 28px;
}

.btn-primary,
.btn-secondary {
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

/* ============================================
   STATES (Empty, Loading, Error)
   ============================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.empty-state .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 12px;
}

.empty-state .hint {
  font-size: 14px;
  color: #d1d5db;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.loading::after {
  content: '...';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.error-box {
  background: #fee2e2;
  border: 2px solid #fca5a5;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  color: #991b1b;
}

.error-box strong {
  display: block;
  margin-bottom: 4px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (min-width: 768px) {
  .modal {
    border-radius: 24px;
    max-height: 90vh;
    animation: fadeIn 0.2s ease-out;
  }
  
  .modal-overlay {
    align-items: center;
  }
  
  .status-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .event-meta {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 22px;
  }
  
  .event-card h3 {
    font-size: 18px;
  }
  
  .event-header h2 {
    font-size: 22px;
  }
  
  .status-buttons {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 16px;
  }
}
