/**
 * Joro Trans - Modern 2026 Design System
 * app.css — Shared design tokens and component styles
 */

/* ===================================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   =================================================== */
:root {
    /* Brand colors */
    --brand-1: #667eea;
    --brand-2: #764ba2;
    --grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Header — frosted glass */
    --header-bg: rgba(255, 255, 255, 0.88);
    --header-blur: blur(16px);
    --header-border: rgba(102, 126, 234, 0.15);

    /* Backgrounds */
    --bg: #f5f4fe;
    --surface: #ffffff;
    --surface-2: #f8f7ff;
    --border: #ede9fe;

    /* Text */
    --text-1: #1e1b4b;
    --text-2: #6b7280;
    --text-3: #a78bfa;

    /* Status colors */
    --green: #10b981;
    --amber: #f59e0b;
    --blue: #3b82f6;
    --red: #ef4444;

    /* Border radius */
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(102, 126, 234, 0.12);
    --shadow-lg: 0 8px 32px rgba(102, 126, 234, 0.18);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 58px;
    --bottom-nav-height: 66px;
    --page-max-width: 600px;
}

/* ===================================================
   2. CSS RESET + BASE
   =================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
        Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-1);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-1);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--brand-2);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ===================================================
   3. APP HEADER
   =================================================== */
.app-header {
    background: var(--header-bg);
    backdrop-filter: var(--header-blur);
    -webkit-backdrop-filter: var(--header-blur);
    border-bottom: 1px solid var(--header-border);
    color: var(--text-1);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(102, 126, 234, 0.08);
    padding: 0 16px;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.app-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    gap: 10px;
}

.app-header h1,
.app-header .header-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-1);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.app-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ===================================================
   4. HEADER CONTENT (max-width wrapper)
   =================================================== */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--page-max-width);
    margin: 0 auto;
    width: 100%;
    gap: 10px;
}

/* ===================================================
   5. BTN-ICON (header icon buttons)
   =================================================== */
.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    color: var(--text-1);
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    -webkit-appearance: none;
}

.btn-icon:hover {
    background: rgba(102, 126, 234, 0.15);
    color: var(--brand-1);
}

.btn-icon:active {
    background: rgba(102, 126, 234, 0.22);
    transform: scale(0.94);
}

/* ===================================================
   6. CARD
   =================================================== */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 18px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:last-child {
    margin-bottom: 0;
}

/* ===================================================
   7. CARD TITLE
   =================================================== */
.card-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: 0.8px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===================================================
   8. BADGES
   =================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 1.2;
}

/* Status badges */
.badge-accepted {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-in_transit {
    background: #fef3c7;
    color: #b45309;
}

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

.badge-planned {
    background: #ede9fe;
    color: #5b21b6;
}

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

.badge-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* Type badges */
.badge-sender {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-receiver {
    background: #f3e8ff;
    color: #6d28d9;
}

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

/* Generic semantic badges */
.badge-primary {
    background: #ede9fe;
    color: #5b21b6;
}

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

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

/* ===================================================
   9. BUTTONS
   =================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    -webkit-appearance: none;
    touch-action: manipulation;
    user-select: none;
    min-height: 44px;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary — gradient */
.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #fff;
    filter: brightness(1.06);
}

.btn-primary:active {
    filter: brightness(0.97);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Secondary — white / outlined */
.btn-secondary {
    background: var(--surface);
    color: var(--brand-1);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    border-color: var(--brand-1);
    background: var(--surface-2);
    color: var(--brand-1);
}

/* Danger */
.btn-danger {
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    filter: brightness(1.07);
    color: #fff;
}

/* Success */
.btn-success {
    background: var(--green);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    filter: brightness(1.07);
    color: #fff;
}

/* Ghost / outline */
.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1.5px solid var(--border);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

/* Full width helper */
.btn-block {
    width: 100%;
}

/* ===================================================
   10. FORM ELEMENTS
   =================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.form-label-required::after {
    content: ' *';
    color: var(--red);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-1);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    min-height: 48px;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-2);
    opacity: 0.7;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--brand-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: var(--surface);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
    background: var(--surface-2);
    color: var(--text-2);
    cursor: not-allowed;
    opacity: 0.75;
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--red);
}

.form-input.error:focus,
.form-textarea.error:focus,
.form-select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    margin-top: 5px;
}

.form-error {
    display: block;
    font-size: 12px;
    color: var(--red);
    margin-top: 5px;
    font-weight: 500;
}

/* ===================================================
   11. SEARCH BAR
   =================================================== */
.search-bar {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    position: relative;
    border: 1.5px solid var(--border);
    overflow: hidden;
}

.search-bar .search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-1);
    background: transparent;
    border: none;
    outline: none;
    min-height: 48px;
}

.search-bar .search-input::placeholder {
    color: var(--text-2);
}

.search-bar:focus-within {
    border-color: var(--brand-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-2);
    pointer-events: none;
    line-height: 1;
}

.search-bar .clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--border);
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    transition: var(--transition);
}

.search-bar .clear-search:hover {
    background: var(--brand-1);
    color: #fff;
}

.search-bar .clear-search.show {
    display: flex;
}

/* ===================================================
   12. BOTTOM NAVIGATION
   =================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--surface);
    border-top: 1.5px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(102, 126, 234, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===================================================
   13. NAV ITEMS
   =================================================== */
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.nav-item .nav-item-icon,
.nav-item-icon {
    font-size: 22px;
    line-height: 1;
    transition: var(--transition);
}

.nav-item .nav-item-label,
.nav-item-label {
    font-size: 10.5px;
    line-height: 1;
    font-weight: 500;
}

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

.nav-item.active .nav-item-icon {
    transform: translateY(-1px);
}

/* Active indicator dot */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--brand-1);
    border-radius: 50%;
}

.nav-item:active {
    opacity: 0.6;
}

/* ===================================================
   14. FAB (Floating Action Button)
   =================================================== */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 14px);
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--grad);
    color: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 300;
    text-decoration: none;
    cursor: pointer;
    z-index: 90;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.fab:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.35);
    transform: scale(1.05);
    color: #fff;
}

.fab:active {
    transform: scale(0.94);
    box-shadow: var(--shadow-md);
}

/* ===================================================
   15. TOAST NOTIFICATION
   =================================================== */
.toast {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    background: rgba(30, 27, 75, 0.93);
    color: #fff;
    padding: 11px 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-width: 88%;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-error {
    background: rgba(153, 27, 27, 0.95);
}

.toast.toast-success {
    background: rgba(6, 95, 70, 0.95);
}

/* ===================================================
   16. MODAL BACKDROP + BOTTOM SHEET
   =================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 27, 75, 0.45);
    z-index: 150;
    display: none;
    align-items: flex-end;
    justify-content: center;
    animation: backdropFadeIn 0.22s ease forwards;
}

.modal-backdrop.show {
    display: flex;
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-sheet {
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: var(--page-max-width);
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 20px 32px;
    animation: sheetSlideUp 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    position: relative;
}

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

/* Handle bar at top of sheet */
.modal-sheet::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 18px;
}

/* Classic centered modal (confirm dialogs) */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30, 27, 75, 0.45);
    z-index: 150;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 340px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal h3, .modal .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 8px;
}

.modal p, .modal .modal-body {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 20px;
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
}

/* ===================================================
   17. SKELETON LOADER
   =================================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-2) 25%,
        var(--border) 50%,
        var(--surface-2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 55%;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Legacy name used in dashboard.css */
.skeleton-loader {
    height: 32px;
    width: 64px;
    border-radius: var(--radius-sm);
    background: linear-gradient(
        90deg,
        var(--surface-2) 25%,
        var(--border) 50%,
        var(--surface-2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===================================================
   18. STATUS TAB BAR
   =================================================== */
.status-tab-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.status-tab-bar::-webkit-scrollbar {
    display: none;
}

/* ===================================================
   19. STATUS TABS
   =================================================== */
.status-tab {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    text-decoration: none;
    flex-shrink: 0;
}

.status-tab:hover {
    border-color: var(--brand-1);
    color: var(--brand-1);
}

.status-tab.active,
.status-tab[aria-selected="true"] {
    background: var(--grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.28);
}

/* ===================================================
   20. PAGE CONTENT WRAPPER
   =================================================== */
.page-content {
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

/* ===================================================
   21. EMPTY STATE
   =================================================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-2);
}

.empty-state-icon {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 14px;
    opacity: 0.65;
    display: block;
}

.empty-state h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ===================================================
   22. LIST ITEM (clickable row)
   =================================================== */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.list-item:hover {
    border-color: var(--brand-1);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.list-item:active {
    transform: scale(0.985);
    box-shadow: var(--shadow-sm);
}

.list-item:last-child {
    margin-bottom: 0;
}

/* ===================================================
   23. PHONE LINK
   =================================================== */
.phone-link {
    color: var(--brand-1);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.phone-link:hover {
    color: var(--brand-2);
    text-decoration: underline;
}

.phone-link:active {
    opacity: 0.75;
}

/* ===================================================
   24. SECTION HEADING
   =================================================== */
.section-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-1);
    margin: 16px 0 8px;
    letter-spacing: 0.1px;
}

/* Legacy alias */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 12px;
}

/* ===================================================
   25. STAT CARD
   =================================================== */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.25);
}

.stat-card-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.stat-card-content {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.1;
    margin-bottom: 2px;
}

.stat-card-value strong {
    color: var(--brand-1);
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
}

/* ===================================================
   26. ROUTE ARROW
   =================================================== */
.route-arrow {
    color: var(--brand-1);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

/* ===================================================
   27. ACTION GRID
   =================================================== */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ===================================================
   28. ACTION CARD
   =================================================== */
.action-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--border);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-1);
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.action-card:hover {
    border-color: var(--brand-1);
    box-shadow: var(--shadow-md);
    color: var(--text-1);
}

.action-card:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-sm);
}

.action-card-icon {
    font-size: 32px;
    line-height: 1;
}

.action-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.3;
}

/* ===================================================
   29. LOADING SPINNER
   =================================================== */
.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--brand-1);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 44px;
    height: 44px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    color: var(--text-2);
    font-size: 14px;
}

/* ===================================================
   30. FORM FILE UPLOAD
   =================================================== */
.form-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-1);
    background: var(--surface);
    border: 1.5px solid var(--brand-1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.form-file-label:hover {
    background: var(--grad);
    color: #fff;
    border-color: transparent;
}

/* ===================================================
   31. INFO GRID (detail pages)
   =================================================== */
.info-grid {
    display: flex;
    flex-direction: column;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    flex-shrink: 0;
}

.info-value {
    font-size: 14px;
    color: var(--text-1);
    text-align: right;
    word-break: break-word;
    max-width: 62%;
}

/* ===================================================
   32. ALERT BANNERS
   =================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-content {
    flex: 1;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger, .alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ===================================================
   33. PARCEL / COURSE CARDS (dashboard lists)
   =================================================== */
.parcel-card,
.course-card {
    display: block;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.parcel-card:hover,
.course-card:hover {
    border-color: var(--brand-1);
    box-shadow: var(--shadow-md);
    color: inherit;
    transform: translateX(3px);
}

.parcel-card:last-child,
.course-card:last-child {
    margin-bottom: 0;
}

.parcel-card-header,
.course-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.parcel-tracking {
    font-weight: 700;
    color: var(--brand-1);
    font-size: 14px;
}

.parcel-card-body,
.course-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.parcel-route,
.course-route {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-1);
    font-weight: 500;
}

.parcel-meta,
.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-2);
    gap: 8px;
}

.course-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
}

.parcel-date, .course-date,
.parcel-course, .course-parcels {
    white-space: nowrap;
}

/* ===================================================
   34. CLIENT CARDS
   =================================================== */
.client-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-md);
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.client-card:hover {
    border-color: var(--brand-1);
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.client-card:active {
    transform: scale(0.985);
    box-shadow: var(--shadow-sm);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.client-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 2px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.client-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.client-info-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.3;
}

.client-info-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.client-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-2);
}

/* Delete button on card */
.btn-delete-card {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 17px;
    line-height: 1;
    color: var(--text-2);
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-delete-card:hover,
.btn-delete-card:active {
    color: var(--red);
    background: #fef2f2;
}

/* Client type badge */
.client-type-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* ===================================================
   35. ADDRESS AUTOCOMPLETE + GPS + NAVIGATION
   =================================================== */

/* Wrapper adds GPS button inside the input */
.address-input-wrap {
    position: relative;
}
.address-input-wrap .form-input {
    padding-right: 42px;
}

/* GPS crosshairs button inside input */
.btn-gps {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--brand-1);
    font-size: 17px;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
    z-index: 2;
}
.btn-gps:hover { color: var(--brand-2); }
.btn-gps:disabled { opacity: 0.5; cursor: default; }

/* Suggestions dropdown */
.address-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--brand-1);
    border-radius: var(--radius-sm);
    max-height: 230px;
    overflow-y: auto;
    z-index: 300;
    box-shadow: var(--shadow-lg);
}
.address-dropdown.show { display: block; }

.address-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 13px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-1);
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
    transition: background 0.12s;
}
.address-dropdown-item:last-child { border-bottom: none; }
.address-dropdown-item:hover,
.address-dropdown-item:active { background: #f0effe; }
.address-dropdown-item i {
    color: var(--brand-1);
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 13px;
}

/* Navigation button (green, pill) */
.btn-navigate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 13px 16px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
    -webkit-tap-highlight-color: transparent;
}
.btn-navigate:hover { filter: brightness(1.08); color: #fff; }
.btn-navigate:active { transform: scale(0.97); }

/* ===================================================
   36. MEDIA QUERY — small screens (≤ 380px)
   =================================================== */
@media (max-width: 380px) {
    body {
        font-size: 15px;
    }

    .app-header h1,
    .app-header .header-title {
        font-size: 17px;
    }

    .page-content {
        padding: 12px;
    }

    .card {
        padding: 14px;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .stat-card-value {
        font-size: 22px;
    }

    .section-title {
        font-size: 14px;
    }

    .action-card-label {
        font-size: 11px;
    }
}

/* ===================================================
   36. UTILITY CLASSES
   =================================================== */
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.text-sm      { font-size: 13px; }
.text-xs      { font-size: 11px; }
.text-base    { font-size: 15px; }
.text-lg      { font-size: 17px; }

.text-muted   { color: var(--text-2); }
.text-brand   { color: var(--brand-1); }
.text-danger  { color: var(--red); }
.text-success { color: var(--green); }

.fw-bold      { font-weight: 700; }
.fw-semibold  { font-weight: 600; }
.fw-medium    { font-weight: 500; }
.fw-normal    { font-weight: 400; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.d-none       { display: none; }
.d-block      { display: block; }
.d-flex       { display: flex; }

.flex-1       { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.gap-4        { gap: 16px; }

.w-full       { width: 100%; }
.rounded      { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 999px; }

.shadow-sm    { box-shadow: var(--shadow-sm); }
.shadow-md    { box-shadow: var(--shadow-md); }

/* Empty message (used in dashboard) */
.empty-message {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-2);
    font-size: 14px;
}

/* ===================================================
   38. FORM STEPPER (multi-step progress dots)
   =================================================== */
.form-stepper {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px 0 8px;
}

.form-stepper-dot {
    height: 8px;
    width: 24px;
    border-radius: 4px;
    background: var(--border);
    transition: var(--transition);
}

.form-stepper-dot.active {
    width: 36px;
    background: var(--brand-1);
}

.form-stepper-dot.done {
    background: var(--green);
}

/* ===================================================
   39. STATUS TRACK (parcel progress bar)
   =================================================== */
.status-track {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 16px 0;
}

.status-track-step {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-2);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.step-dot.done {
    background: var(--brand-1);
    border-color: var(--brand-1);
    color: #fff;
}

.step-dot.current {
    background: var(--brand-1);
    border-color: var(--brand-1);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.18);
}

.step-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}

.step-label.active {
    color: var(--brand-1);
}

.status-track-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    transition: var(--transition);
    margin-bottom: 22px;
}

.status-track-line.done {
    background: var(--brand-1);
}

/* ===================================================
   40. AVATAR (initials)
   =================================================== */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 24px;
}

/* ===================================================
   41. INFO ROW (detail pages with icons)
   =================================================== */
.info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-row-icon {
    color: var(--brand-1);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 15px;
}

.info-row-content {
    flex: 1;
    min-width: 0;
}

.info-row-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.info-row-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-1);
    margin-top: 2px;
    word-break: break-word;
}

/* ===================================================
   42. TOGGLE BUTTONS (client type selector)
   =================================================== */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.toggle-btn {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    -webkit-tap-highlight-color: transparent;
}

.toggle-btn:hover {
    border-color: var(--brand-1);
    color: var(--brand-1);
}

.toggle-btn.selected {
    border-color: var(--brand-1);
    background: rgba(102, 126, 234, 0.08);
    color: var(--brand-1);
}

.toggle-btn i {
    font-size: 20px;
}

/* ===================================================
   43. SECTION HEADER (with action link)
   =================================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header .section-title {
    margin-bottom: 0;
}

.section-action {
    font-size: 13px;
    color: var(--brand-1);
    font-weight: 600;
    text-decoration: none;
}

.section-action:hover {
    color: var(--brand-2);
}

/* ===================================================
   44. PARCEL ICON THUMB (FA icon instead of image)
   =================================================== */
.parcel-icon-thumb {
    width: 72px;
    min-width: 72px;
    background: rgba(102, 126, 234, 0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
    color: var(--brand-1);
    font-size: 24px;
}

/* ===================================================
   45. LOGIN INPUT ICON
   =================================================== */
.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-2);
    font-size: 16px;
    pointer-events: none;
}

.login-input-wrap .form-input {
    padding-left: 42px;
}

/* ===================================================
   37. iOS SAFE AREA + PWA SUPPORT
   =================================================== */
@supports (-webkit-touch-callout: none) {
    .form-input,
    .form-select,
    .form-textarea,
    .search-bar .search-input {
        font-size: 16px; /* prevent zoom on iOS */
    }

    .app-header {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    }

    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }
}
