/* ============================================================
   TiTrack — app.css
   Pure CSS only — NO @apply, works with Tailwind CDN on WAMP
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body { font-family: 'Inter', system-ui, sans-serif; }

/* ---- Safe area (iPhone notch) ---- */
.safe-top    { padding-top:    env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ---- Border utility ---- */
.border-3 { border-width: 3px; }

/* ================================================================
   CARD
   ================================================================ */
.card {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-sea     { background: #dbeafe; color: #1d4ed8; }
.badge-port    { background: #fef3c7; color: #b45309; }
.badge-inland  { background: #ffedd5; color: #c2410c; }
.badge-factory { background: #ede9fe; color: #6d28d9; }
.badge-done    { background: #d1fae5; color: #065f46; }
.badge-booked  { background: #f1f5f9; color: #475569; }
.badge-danger  { background: #F6CECE; color: #E70D0D; }


/* ================================================================
   STAGE LEFT BORDERS
   ================================================================ */
.stage-sea     { border-left: 3px solid #3b82f6; }
.stage-port    { border-left: 3px solid #f59e0b; }
.stage-inland  { border-left: 3px solid #f97316; }
.stage-factory { border-left: 3px solid #8b5cf6; }
.stage-done    { border-left: 3px solid #10b981; }

/* ================================================================
   MATERIAL COLOUR DOTS
   ================================================================ */
.mat-cp-solids   { background-color: #3b82f6; }
.mat-cp-turnings { background-color: #06b6d4; }
.mat-64-solids   { background-color: #f97316; }
.mat-64-turnings { background-color: #f59e0b; }
.mat-grade2      { background-color: #10b981; }
.mat-mixed       { background-color: #94a3b8; }

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.form-row { }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
}
.form-input {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15);
}
.form-input::placeholder { color: #94a3b8; }
.form-input:disabled     { background: #f8fafc; color: #64748b; cursor: not-allowed; }

.form-select {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    font-size: 0.875rem;
    color: #0f172a;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.75rem center / 12px;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
    cursor: pointer;
}
.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15);
}

.form-file {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #64748b;
    background: #ffffff;
    box-sizing: border-box;
    font-family: inherit;
    cursor: pointer;
}
.form-file::-webkit-file-upload-button {
    margin-right: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: #f1f5f9;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
}
.form-file::-webkit-file-upload-button:hover { background: #e2e8f0; }

.form-textarea {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    font-family: inherit;
}
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15);
}
.form-textarea::placeholder { color: #94a3b8; }

.form-hint  { font-size: 0.75rem; color: #94a3b8; margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: #ef4444; margin-top: 0.25rem; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.25;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus    { outline: none; }

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:focus { box-shadow: 0 0 0 3px rgb(59 130 246 / 0.35); }

.btn-secondary {
    background: #f1f5f9;
    color: #334155;
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-success {
    background: #059669;
    color: #ffffff;
}
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}
.btn-icon {
    padding: 0.5rem;
    border-radius: 0.75rem;
}

/* ================================================================
   MATERIAL ROW
   ================================================================ */
.material-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #f8fafc;
    transition: background 0.15s;
    cursor: pointer;
}
.material-row:hover { background: #f1f5f9; }

/* ================================================================
   KPI CARDS
   ================================================================ */
.kpi-card {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.kpi-value {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #0f172a;
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border: 1px solid;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 24rem;
    animation: slideIn 0.2s ease;
}
.toast-success { background: #ffffff; border-color: #a7f3d0; color: #065f46; }
.toast-error   { background: #ffffff; border-color: #fecaca; color: #991b1b; }
.toast-info    { background: #ffffff; border-color: #bfdbfe; color: #1e40af; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   SECTION LABEL
   ================================================================ */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    background: #2563eb;
    padding: 0.5rem;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

/* ================================================================
   DETAIL ROW (shipment details)
   ================================================================ */
.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.15rem 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.875rem;
    gap: 1rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #64748b; font-weight: 500; flex-shrink: 0; }
.detail-value { color: #0f172a; font-weight: 600; text-align: right; }

/* ================================================================
   WEEK ROW
   ================================================================ */
.week-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
    cursor: pointer;
}
.week-row:last-child { border-bottom: none; }
.week-row:hover { background: #f8fafc; }

/* ================================================================
   TIMELINE
   ================================================================ */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    bottom: 0;
    width: 2px;
    background: #f1f5f9;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

/* ================================================================
   SHIMMER LOADING
   ================================================================ */
.shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 400px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.75rem;
}
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
}
.empty-state i    { font-size: 3rem; color: #e2e8f0; margin-bottom: 1rem; display: block; }
.empty-state h3   { font-size: 1rem; font-weight: 600; color: #94a3b8; }
.empty-state p    { font-size: 0.875rem; color: #cbd5e1; margin-top: 0.25rem; }

/* ================================================================
   MOBILE BOTTOM NAV SPACING
   ================================================================ */
@media (max-width: 1023px) {
    #mainContent { padding-bottom: 5rem; }
}

/* ================================================================
   TAB BUTTONS (settings page)
   ================================================================ */
.tab-btn { white-space: nowrap; }

/* ================================================================
   ANIMATE SPIN (for loading states)
   ================================================================ */
.animate-spin {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
