/* ============================================
   PAQ EXPRESS - Estilos minimalistas
   Plataforma colaborativa de paquetes
   ============================================ */

:root {
  --primary: #2D6A4F;
  --primary-light: #40916C;
  --primary-dark: #1B4332;
  --secondary: #E9C46A;
  --accent: #F4A261;
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --border: #E5E7EB;
  --success: #2D6A4F;
  --warning: #E9C46A;
  --danger: #E76F51;
  --grey: #9CA3AF;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header .logo svg { width: 24px; height: 24px; fill: var(--primary); }

.app-header nav { display: flex; align-items: center; gap: 4px; }

.app-header nav a {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.app-header nav a:hover, .app-header nav a.active { background: var(--bg); color: var(--text); text-decoration: none; }

.app-header .user-menu { display: flex; align-items: center; gap: 12px; }
.app-header .user-menu .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border); object-fit: cover;
}
.app-header .user-menu .user-name { font-size: 13px; font-weight: 500; color: var(--text); }

.app-main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.4px; color: var(--text); }
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: var(--font);
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); outline: none;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  border: none; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ===== GRID ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ===== ALERTS ===== */
.alert { padding: 14px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: var(--success); border: 1px solid #BBF7D0; }
.alert-info { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
  max-width: 640px;
  margin: 0 auto;
}
.hero h1 { font-size: 36px; font-weight: 700; letter-spacing: -0.8px; color: var(--primary-dark); line-height: 1.2; }
.hero p { color: var(--text-secondary); font-size: 16px; margin-top: 12px; line-height: 1.7; }

/* ===== SEARCH SECTION (HOME) ===== */
.search-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.search-section .form-row { margin-bottom: 0; }
.search-bar { display: flex; gap: 12px; align-items: end; }
.search-bar .form-group { flex: 1; margin-bottom: 0; }

/* ===== TRACKING BOX (HOME) ===== */
.tracking-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto 32px;
}
.tracking-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.tracking-box p { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.tracking-input { display: flex; gap: 8px; }
.tracking-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.tracking-input input:focus { border-color: var(--primary); outline: none; }

/* ===== TRIP LIST ===== */
.trip-card {
  display: flex; gap: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
  cursor: pointer;
}
.trip-card:hover { box-shadow: var(--shadow-md); }
.trip-card .trip-info { flex: 1; }
.trip-card .trip-route { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.trip-card .trip-route .point { font-weight: 600; font-size: 15px; }
.trip-card .trip-route .arrow { color: var(--text-secondary); font-size: 13px; }
.trip-card .trip-date { font-size: 13px; color: var(--text-secondary); display: flex; gap: 16px; }
.trip-card .trip-user { display: flex; align-items: center; gap: 10px; }
.trip-card .trip-user .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--border); }
.trip-card .trip-user .name { font-size: 13px; font-weight: 500; }
.trip-card .trip-space { font-size: 13px; color: var(--text-secondary); }
.trip-card .trip-rating { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--warning); }
.trip-card .trip-price { font-size: 18px; font-weight: 700; color: var(--primary); }

/* ===== SHIPMENT LIST ===== */
.shipment-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--grey);
  transition: box-shadow 0.2s;
  display: flex; justify-content: space-between; align-items: center;
}
.shipment-card:hover { box-shadow: var(--shadow-md); }
.shipment-card.shipment-done { border-left-color: var(--success); }
.shipment-card.shipment-issue { border-left-color: var(--warning); }
.shipment-card.shipment-pending { border-left-color: var(--grey); }
.shipment-card .shipment-info { flex: 1; }
.shipment-card .shipment-route { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.shipment-card .shipment-route strong { font-size: 15px; }
.shipment-card .shipment-meta { display: flex; gap: 16px; margin-top: 4px; font-size: 13px; color: var(--text-secondary); }
.shipment-card .shipment-status { font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 20px; background: var(--bg); }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ''; position: absolute; left: 11px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .dot {
  position: absolute; left: -24px; top: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
}
.timeline-item.active .dot { background: var(--primary); }
.timeline-item.completed .dot { background: var(--success); }
.timeline-item .tl-content { font-size: 14px; }
.timeline-item .tl-content strong { display: block; }
.timeline-item .tl-content .tl-date { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== PROFILE ===== */
.profile-header { display: flex; gap: 24px; align-items: center; margin-bottom: 32px; }
.profile-header .profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: var(--border); }
.profile-header .profile-name h2 { font-size: 22px; font-weight: 600; }
.profile-header .profile-name p { color: var(--text-secondary); font-size: 14px; }
.profile-stats { display: flex; gap: 24px; margin-top: 8px; }
.profile-stats .stat { text-align: center; }
.profile-stats .stat .num { font-size: 18px; font-weight: 600; color: var(--primary); }
.profile-stats .stat .label { font-size: 12px; color: var(--text-secondary); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
}
.modal { background: var(--surface); border-radius: var(--radius); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.modal h2 { font-size: 20px; font-weight: 600; margin-bottom: 20px; }
.modal .close-btn { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }

/* ===== DETAIL PAGE ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.detail-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.detail-row .label { color: var(--text-secondary); }

/* ===== PHOTO GRID ===== */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid .photo-item { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.photo-grid .photo-item img { width: 100%; height: 130px; object-fit: cover; display: block; }
.photo-grid .photo-item .photo-caption { padding: 8px; font-size: 12px; color: var(--text-secondary); text-align: center; }

/* ===== MAP ===== */
.map-container { height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-main { padding: 20px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .search-bar { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
  .app-header nav { display: none; }
  .app-header .user-menu .user-name { display: none; }
  .trip-card { flex-direction: column; }
  .shipment-card { flex-direction: column; gap: 12px; }
}

/* ===== STATUS COLORS ===== */
.status-pendiente { color: var(--grey); }
.status-recibido_transportista { color: var(--primary-light); }
.status-en_transito { color: var(--accent); }
.status-entregado_destinatario { color: var(--primary); }
.status-completado { color: var(--success); }
.status-incidencia { color: var(--danger); }

/* ===== MISC ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.tag-green { background: #F0FDF4; color: var(--success); }
.tag-yellow { background: #FEFCE8; color: #A16207; }
.tag-grey { background: #F3F4F6; color: var(--text-secondary); }
.tag-red { background: #FEF2F2; color: var(--danger); }

/* Autocomplete */
.autocomplete-wrap { position:relative; }
.autocomplete-dropdown {
  position:absolute; top:100%; left:0; right:0; z-index:100;
  background:#fff; border:1px solid #ddd; border-radius:0 0 6px 6px;
  max-height:250px; overflow-y:auto; display:none;
  box-shadow:0 4px 12px rgba(0,0,0,0.1);
}
.autocomplete-item {
  padding:8px 12px; cursor:pointer; font-size:14px;
  border-bottom:1px solid #f0f0f0;
  transition:background 0.15s;
}
.autocomplete-item:last-child { border-bottom:none; }
.autocomplete-item:hover,
.autocomplete-item.highlighted { background:#f0f7ff; color:var(--primary); }
.autocomplete-item .prov { font-size:11px; color:#999; margin-top:1px; }
