/* TorFoods Driver Mobile Portal - Mobile-first */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.driver-body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: #f3f4f6;
    color: #111827;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ----- HEADER ----- */
.driver-header {
    position: sticky; top: 0; z-index: 50;
    background: #fff;
    padding: 14px 16px calc(14px + env(safe-area-inset-top)) 16px;
    padding-top: calc(14px + env(safe-area-inset-top));
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #e5e7eb;
    gap: 12px;
}
.driver-header-left { display: flex; align-items: center; gap: 12px; }
.driver-header-right { display: flex; align-items: center; gap: 6px; }
.driver-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: #e85d04; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
}
.driver-greeting { font-weight: 700; font-size: 16px; }
.driver-icon-btn {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: #f3f4f6;
    border: none;
    color: #111827;
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

/* ----- MAIN ----- */
.driver-main {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ----- CARD ----- */
.driver-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.driver-card-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.driver-section-title {
    margin: 18px 16px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.driver-card-list { display: flex; flex-direction: column; gap: 8px; }

/* ----- AVAILABILITY TOGGLE ----- */
.driver-availability {
    display: flex; justify-content: space-between; align-items: center;
}
.driver-toggle {
    width: 56px; height: 32px;
    border: none;
    background: #d1d5db;
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.driver-toggle.on { background: #16a34a; }
.driver-toggle-slider {
    position: absolute; top: 3px; left: 3px;
    width: 26px; height: 26px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.driver-toggle.on .driver-toggle-slider { transform: translateX(24px); }

/* ----- STATUS PILLS ----- */
.driver-status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 700;
    background: #e5e7eb; color: #6b7280;
    margin-top: 4px;
}
.driver-status-pill .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor;
}
.driver-status-pill.driver-status-available { background: #d1fae5; color: #065f46; }
.driver-status-pill.driver-status-on_delivery { background: #ffedd5; color: #9a3412; }
.driver-status-pill.driver-status-offline { background: #e5e7eb; color: #6b7280; }

.driver-status-tag {
    display: inline-block; padding: 3px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    background: #e5e7eb; color: #374151;
}
.driver-status-tag.driver-status-ready { background: #fef3c7; color: #78350f; }
.driver-status-tag.driver-status-out_for_delivery { background: #ffedd5; color: #9a3412; }
.driver-status-tag.driver-status-delivered { background: #d1fae5; color: #065f46; }
.driver-status-tag.driver-status-completed { background: #d1fae5; color: #065f46; }

/* ----- ACTIVE ORDER CARD ----- */
.driver-active-order { border-left: 5px solid #e85d04; }
.driver-active-num { font-size: 26px; font-weight: 800; margin: 6px 0; }
.driver-active-customer { font-size: 16px; color: #374151; }
.driver-active-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.driver-active-meta span:first-child { font-weight: 700; font-size: 18px; }

/* ----- EMPTY ----- */
.driver-empty {
    text-align: center;
    padding: 48px 16px;
    color: #6b7280;
}
.driver-empty i { font-size: 48px; color: #d1d5db; margin-bottom: 12px; }
.driver-empty h3 { margin: 8px 0 4px; color: #374151; }
.driver-empty p { margin: 0; }

/* ----- BUTTONS ----- */
.driver-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 20px;
    font-size: 16px; font-weight: 600;
    border: none; border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    min-height: 50px;
}
.driver-btn:active { transform: scale(.98); }
.driver-btn:disabled { opacity: .5; cursor: wait; }
.driver-btn-block { width: 100%; }
.driver-btn-primary { background: #e85d04; color: #fff; }
.driver-btn-primary:hover { background: #c44d03; }
.driver-btn-success { background: #16a34a; color: #fff; }
.driver-btn-success:hover { background: #15803d; }
.driver-btn-outline { background: #f9fafb; color: #111827; border: 1px solid #e5e7eb; }
.driver-btn-outline:hover { background: #f3f4f6; }

/* ----- FORM ----- */
.driver-form .form-group { margin-bottom: 14px; }
.driver-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}
.driver-form input,
.driver-form select,
.driver-form textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-family: inherit;
    min-height: 48px;
}
.driver-form input:focus,
.driver-form select:focus,
.driver-form textarea:focus {
    outline: none;
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232,93,4,.1);
}

/* ----- ALERTS ----- */
.driver-alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}
.driver-alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.driver-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* ----- AUTH (LOGIN) ----- */
.driver-auth-body { background: #0f1117; min-height: 100vh; }
.driver-auth-wrap {
    max-width: 400px;
    margin: 0 auto;
    padding: 60px 20px;
    color: #fff;
}
.driver-brand { text-align: center; margin-bottom: 30px; }
.driver-logo {
    width: 80px; height: 80px;
    background: #e85d04;
    border-radius: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 36px; color: #fff;
    margin-bottom: 14px;
}
.driver-brand h1 { margin: 0; font-size: 28px; }
.driver-subtitle { color: #9ca3af; margin: 4px 0 0; }
.driver-auth-body .driver-card { background: #1e2230; color: #f3f4f6; }
.driver-auth-body .driver-form label { color: #d1d5db; }
.driver-auth-body .driver-form input {
    background: #0f1117;
    border-color: #374151;
    color: #fff;
}
.driver-help-text { text-align: center; color: #6b7280; font-size: 13px; margin-top: 20px; }

/* ----- ORDER ITEMS ----- */
.driver-item-line {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
}
.driver-item-line:last-child { border-bottom: none; }
.driver-item-qty {
    background: #fff7ed;
    color: #c2410c;
    text-align: center;
    border-radius: 6px;
    padding: 2px 4px;
    font-weight: 700;
    font-size: 14px;
}
.driver-item-name { font-weight: 500; }
.driver-item-price { color: #6b7280; font-size: 14px; }
.driver-item-note {
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    margin: 4px 0 8px 46px;
}

.driver-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px solid #e5e7eb;
    font-weight: 700;
    font-size: 18px;
}
.driver-total-val { color: #e85d04; font-size: 22px; }
.driver-instructions { background: #fef3c7; border: 1px solid #fde68a; }

/* ----- RECENT LIST ----- */
.driver-recent {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* ----- LIVE LOCATION BANNER ----- */
.driver-loc-banner {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex !important;
    align-items: center;
    gap: 12px;
    color: #92400e;
}
.driver-loc-banner.granted {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}
.driver-loc-banner.denied {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ----- PUSH STATUS / BADGE ----- */
.driver-push-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    vertical-align: middle;
}
.driver-push-badge.on  { background: #d1fae5; color: #065f46; }
.driver-push-badge.off { background: #fee2e2; color: #991b1b; }
.driver-push-status {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}
.driver-push-status.driver-push-success { background: #d1fae5; color: #065f46; }
.driver-push-status.driver-push-error   { background: #fee2e2; color: #991b1b; }
.driver-push-status.driver-push-info    { background: #fef3c7; color: #78350f; }

/* ----- STICKY ACTION BAR ----- */
.driver-action-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 60;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom)) 16px;
    box-shadow: 0 -4px 12px rgba(0,0,0,.08);
}
