:root {
    --primary-color: #ff6b00;
    --primary-dark: #e55a00;
    --secondary-color: #333333;
    --background-color: #f5f5f5;
    --card-color: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Auth Pages */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 5px;
}

.auth-container {
    background: var(--card-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-light);
}

.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background-color: #555;
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--error-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 1rem;
}

.auth-links {
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Client App */
.client-body {
    background-color: var(--background-color);
    min-height: 100vh;
    padding-bottom: 70px;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
}

.app-header h1 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.app-header p {
    opacity: 0.9;
}

.app-main {
    padding: 1rem;
}

.section {
    background: var(--card-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section h2 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.order-number {
    font-weight: bold;
    color: var(--primary-color);
}

.order-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.order-status.pending {
    background-color: var(--warning-color);
    color: var(--secondary-color);
}

.order-status.completed {
    background-color: var(--success-color);
    color: white;
}

.order-status.failed {
    background-color: var(--error-color);
    color: white;
}

.order-status.payment_received,
.order-status.courier_on_way,
.order-status.picked_up,
.order-status.route_to_destination,
.order-status.delivered {
    background-color: #17a2b8;
    color: white;
}

.order-details p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Order Form */
.order-form {
    margin-top: 1rem;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.calculation-info {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.calculation-info p {
    margin-bottom: 0.5rem;
}

.order-summary {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.order-summary p {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.order-summary p:last-child {
    border-bottom: none;
}

/* Profile */
.profile-info p {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-info p:last-child {
    border-bottom: none;
}

.message-form textarea {
    width: 100%;
    resize: vertical;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.message-card.unread {
    border-left: 4px solid var(--primary-color);
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content small {
    color: var(--text-light);
}

.admin-reply {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    border-left: 3px solid var(--primary-color);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-color);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.8rem;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item span {
    margin-top: 0.25rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .section {
        padding: 1rem;
    }
}

/* ---- Modern form refresh ---- */
.modern-form {
  --card: #ffffff;
  --bg: #f7fafc;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #ff6b00;
  --ring: rgba(255,107,0,.25);
  --border: #e5e7eb;
  --shadow: 0 10px 25px rgba(0,0,0,.05);
}

body.client-body, body.auth-body {
  background: var(--bg);
  color: var(--text);
}

/* Card wrapper */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}

/* Section headers */
.section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--text);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
}

/* Inputs */
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.order-form input[type="text"],
.order-form input[type="email"],
.order-form input[type="password"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease, transform .02s ease;
}
.auth-form input:focus,
.order-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

/* Labels */
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 6px 2px 6px;
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .2px;
  transition: transform .02s ease, box-shadow .2s ease, background .2s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255,107,0,.25);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { box-shadow: var(--shadow); }

/* Two-column grid (auto stacks on mobile) */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* Suggestions dropdown */
.suggestions-container {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 20px rgba(0,0,0,.06);
}
.suggestion-item {
  padding: 12px 10px;
}

/* Map blocks */
.map-container {
  border-radius: 16px !important;
  border: 1px solid var(--border) !important;
  overflow: hidden !important;
  background: #fff;
}
.map-instructions {
  background: #fff !important;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px !important;
  padding: 10px 12px !important;
}

.map-toggle-btn {
  background: var(--brand) !important;
  border-radius: 10px !important;
  height: 34px !important;
  padding: 0 10px !important;
}

/* Coordinates hint */
.location-coordinates {
  color: var(--muted) !important;
  margin: 6px 2px 0 !important;
}

/* Step containers */
.form-step.active .form-card { margin-top: 8px; }

/* Helper spacing for action rows */
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Order summary block */
.order-summary {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.6;
}

/* Calculation pill */
.calculation-info {
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  gap: 18px;
  background: #fff8f3;
  color: #7a3415;
  border: 1px solid #ffd7bd;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
}
.calculation-info strong { color: #7a3415; }

/* Alerts */
.alert.error, .alert.success {
  border-radius: 12px;
  padding: 10px 12px;
}

/* ============ MOBILE FULLSCREEN (NO PAGE SCROLL) ============ */
html, body {
  height: 100%;
}

body.auth-body {
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  overflow: hidden; /* no page scroll */
}

.auth-container {
  width: 100% !important;
  max-width: none !important;
  height: 100vh;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 16px !important;
  overflow: hidden; /* no internal container scroll */
  display: flex;
  flex-direction: column;
}

.auth-header {
  margin-bottom: 5px !important;
}

/* logo */
.brand-logo {
  height: 44px;
  width: auto;
  display: inline-block;
  margin-bottom: 6px;
}

/* Form should fill remaining height */
.auth-form {
  flex: 1;
  overflow: hidden; /* no scroll */
  display: flex;
  flex-direction: column;
}

/* Step screens occupy full height inside form */
.form-step {
  flex: 1;
  overflow: hidden;
}

/* Sub-steps inside Order Step (Pickup/Destination/Review) */
.sub-step {
  display: none;
  height: 100%;
  overflow: hidden;
}
.sub-step.active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Cards behave like screen sections */
.form-card {
  margin: 10px 0 !important;
}

/* Actions pinned at bottom of each screen */
.screen-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding-top: 10px;
}

.screen-actions .btn-primary,
.screen-actions .btn-secondary {
  width: 100%;
}

/* maps should not force page scroll */
.map-container {
  max-height: 260px;
}

/* ============ COMPACT BRAND HEADER ============ */
.auth-header {
  text-align: left !important;
  margin-bottom: 5px !important;
}

.brandbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brandbar .brand-logo {
  height: 40px;          /* smaller to save space */
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.brandbar .brandtext {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brandbar .brandtitle {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
}

.brandbar .brandtag {
  font-size: 12px;
  color: var(--text-light);
  margin: 2px 0 0;
}

/* ===========================
   REVERT: allow normal page scroll
=========================== */

.auth-body {
  height: auto !important;
  min-height: 100vh !important;
  overflow: auto !important;     /* allow page scroll */
}

.auth-container {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
}

.auth-form {
  overflow: visible !important;  /* don't scroll inside card */
  padding-bottom: 0 !important;
}

/* Make sure there is space below the last button */
.auth-container {
  padding-bottom: 24px;
}

/* Extra space at the bottom of the whole page */
.auth-body {
  padding-bottom: 90px; /* ensures last button is reachable */
}

/* Modern phones safe-area (gesture bar) */
@supports (padding: max(0px)) {
  .auth-body {
    padding-bottom: max(90px, env(safe-area-inset-bottom));
  }
}

/* ===========================
   Brand header (logo left, title right)
=========================== */
.app-header--brand {
  text-align: left;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 44px;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand-text p {
  margin: 3px 0 0;
  opacity: .92;
  font-size: 13px;
}

@media (max-width: 420px) {
  .brand-logo { width: 38px; height: 38px; flex-basis: 38px; }
  .brand-text h1 { font-size: 16px; }
  .brand-text p { font-size: 12px; }
}
