/* styles.css
   Controls how every page looks. Change the colors in :root to restyle the whole site. */

   :root {
    --brand: #1d4e89;
    --brand-dark: #14375f;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #6b7785;
    --border: #d9e0e7;
    --error: #b42318;
    --success: #067647;
  }
  
  * { box-sizing: border-box; }
  
  body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
  }
  
  main { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
  
  .site-header {
    background: var(--brand);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .site-header h1 { margin: 0; font-size: 1.3rem; display: flex; align-items: center; gap: 8px; }
  .site-header h1 img { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55); }
  .site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
  .site-header a { color: #fff; text-decoration: none; font-weight: 500; }
  .site-header a:hover { text-decoration: underline; }
  .site-header .muted { color: #cbd8e8; font-size: 0.85rem; }
  
  .site-footer {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
    color: var(--muted);
    font-size: 0.85rem;
  }
  
  .panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
  }
  
  .muted { color: var(--muted); }
  
  /* Buttons */
  .btn {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 1rem;
    cursor: pointer;
  }
  .btn:hover { background: var(--brand-dark); }
  .btn:disabled { opacity: 0.6; cursor: not-allowed; }
  .btn-secondary { background: #e4e9ef; color: var(--text); }
  .btn-secondary:hover { background: #d3dae2; }
  .btn-link { background: none; color: #fff; padding: 0; text-decoration: underline; }
  .btn-link:hover { background: none; }
  
  /* Forms */
  label { display: block; font-weight: 600; margin-bottom: 14px; }
  input[type="text"], input[type="date"], input[type="number"], input[type="tel"], select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-weight: 400;
  }
  fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 14px; padding: 10px 14px; }
  legend { font-weight: 600; padding: 0 6px; }
  .check { display: inline-block; font-weight: 400; margin: 4px 16px 4px 0; }
  .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  
  .filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
  .filters label { margin-bottom: 0; flex: 1 1 180px; }
  
  /* Messages */
  .message { padding: 10px 12px; border-radius: 8px; }
  .message.error { background: #fde8e6; color: var(--error); }
  .message.success { background: #e3f6ec; color: var(--success); }
  
  /* Request cards */
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
  }
  .card h3 { margin: 0 0 8px; color: var(--brand); }
  .card p { margin: 4px 0; }
  .card .btn { margin-top: 10px; }
  
  /* Type-or-pick fields (text box with an arrow button that opens a list) */
  .field { margin-bottom: 14px; }
  .field > label { margin-bottom: 4px; }
  .combo { position: relative; }
  .combo input[type="text"] { margin-top: 0; padding-right: 44px; }
  .combo-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 40px;
    border: none;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
  }
  .combo-toggle:hover { background: #eef3f9; color: var(--brand); }
  .combo-list {
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    max-height: 240px;
    overflow-y: auto;
  }
  .combo-list li { padding: 9px 12px; cursor: pointer; font-weight: 400; }
  .combo-list li:hover { background: #eef3f9; }
  
  /* ---- Step 4: accept dialog, ride page, My rides, chat ---- */
  a.btn { display: inline-block; text-decoration: none; }
  main a:not(.btn) { color: var(--brand); }
  .btn-danger { background: var(--error); }
  .btn-danger:hover { background: #8f1c12; }
  
  .hint { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
  .message.info { background: #e8f0fb; color: var(--brand-dark); }
  
  .dialog {
    border: none;
    border-radius: 12px;
    padding: 22px;
    width: min(480px, calc(100vw - 32px));
    background: var(--card);
    color: var(--text);
  }
  .dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
  .dialog h2 { margin-top: 0; }
  .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
  
  .badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
  .badge-open { background: #fff4d6; color: #8a5a00; }
  .badge-accepted { background: #e3f6ec; color: var(--success); }
  .badge-completed { background: #e8f0fb; color: var(--brand-dark); }
  .badge-cancelled { background: #eceff3; color: var(--muted); }
  .card.dim { opacity: 0.65; }
  
  .contact-name { font-size: 1.1rem; font-weight: 600; }
  .payment-form .check { margin-right: 18px; }
  .payment-form label:not(.check) { margin-top: 12px; }
  
  .chat-log {
    height: 320px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .msg {
    max-width: 80%;
    padding: 8px 11px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    align-self: flex-start;
    overflow-wrap: anywhere;
  }
  .msg.mine { align-self: flex-end; background: var(--brand); border-color: var(--brand); color: #fff; }
  .msg p { margin: 0; white-space: pre-wrap; }
  .msg small { display: block; opacity: 0.7; font-size: 0.75rem; margin-top: 2px; }
  .reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
  .chip {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    cursor: pointer;
  }
  .chip:hover { background: #eef3f9; }
  .chip.active { background: #dbe8f8; border-color: var(--brand); }
  .chip-add { opacity: 0.75; font-weight: 600; }
  .picker { display: none; }
  .reactions.open .picker {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 6px;
  }
  .picker .chip { border: none; background: transparent; font-size: 1.05rem; padding: 0 3px; }
  .card-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
  .link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
  }
  .link-btn:hover { color: var(--error); }
  .blocked-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
  }
  .blocked-row .btn { padding: 6px 12px; font-size: 0.9rem; }
  .dialog label { margin-bottom: 14px; }
  .chat-form { display: flex; gap: 8px; margin-top: 10px; }
  .chat-form input { flex: 1; margin-top: 0; }
  
  /* Round trip / One-way tabs */
  .tabs { display: flex; gap: 6px; margin-bottom: 6px; }
  .tab {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }
  .tab:hover { background: #eef3f9; }
  .tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
  input[type="time"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
  }
  .setting-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; font-weight: 400; }
  .setting-row input { margin-top: 5px; }
  
  [hidden] { display: none !important; }
  
  @media (max-width: 560px) {
    .row { grid-template-columns: 1fr; }
  }