/* ============================================================
   Transfer Status Dashboard
   Mobile-first responsive design
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ---- HEADER ---- */

header {
    background: #1a1a2e;
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
}

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

.user-name {
    font-size: 13px;
    opacity: 0.8;
}

/* ---- BUTTONS ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

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

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 13px;
    padding: 6px 12px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
}

.btn-refresh {
    background: #1a1a2e;
    color: white;
    font-size: 13px;
}

.btn-refresh:hover {
    background: #2a2a4e;
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-otw {
    background: #e67e22;
    color: white;
    font-size: 13px;
}

.btn-otw:hover {
    background: #d35400;
}

.btn-deliver {
    background: #27ae60;
    color: white;
    font-size: 13px;
}

.btn-deliver:hover {
    background: #219a52;
}

.btn-details {
    background: #ecf0f1;
    color: #555;
    font-size: 13px;
}

.btn-details:hover {
    background: #dde4e6;
}

/* ---- LOGIN ---- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-card h2 {
    font-size: 15px;
    color: #888;
    font-weight: 400;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.login-card input:focus {
    border-color: #1a1a2e;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #1a1a2e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.login-card button:hover {
    background: #2a2a4e;
}

.login-hint {
    font-size: 12px;
    color: #999;
    margin-top: 16px;
}

.alert.error {
    background: #fdecea;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* ---- SUMMARY ROW ---- */

.summary-row {
    display: flex;
    gap: 12px;
    padding: 16px 20px 0;
    overflow-x: auto;
}

.summary-card {
    flex: 1;
    min-width: 80px;
    background: white;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.summary-card.active {
    border-color: #1a1a2e;
}

.summary-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.summary-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card.status-ready .summary-number { color: #2980b9; }
.summary-card.status-otw .summary-number { color: #e67e22; }
.summary-card.status-delivered .summary-number { color: #27ae60; }

/* ---- TOOLBAR ---- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.filter-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    outline: none;
}

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

.cache-age {
    font-size: 12px;
    color: #999;
}

/* ---- EMPTY STATE ---- */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #666;
}

/* ---- TRANSFER LIST ---- */

.transfer-list {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transfer-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    border-left: 4px solid #ccc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.transfer-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.transfer-card.status-ready {
    border-left-color: #2980b9;
}

.transfer-card.status-on_the_way {
    border-left-color: #e67e22;
}

.transfer-card.status-delivered {
    border-left-color: #27ae60;
}

/* ---- TRANSFER HEADER ---- */

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

.transfer-route {
    font-size: 16px;
    font-weight: 600;
}

.from-store {
    color: #555;
}

.arrow {
    color: #bbb;
    margin: 0 6px;
}

.to-store {
    color: #1a1a2e;
}

.transfer-date {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
}

/* ---- TRANSFER BODY ---- */

.transfer-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.transfer-meta {
    display: flex;
    gap: 16px;
}

.meta-item {
    font-size: 14px;
    color: #666;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-ready {
    background: #ebf5fb;
    color: #2980b9;
}

.badge-on_the_way {
    background: #fef5e7;
    color: #e67e22;
}

.badge-delivered {
    background: #eafaf1;
    color: #27ae60;
}

/* ---- STATUS TIMELINE ---- */

.status-timeline {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    margin-bottom: 8px;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    min-width: 80px;
}

.step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ddd;
    border: 2px solid #ddd;
    margin-bottom: 6px;
    transition: background 0.3s;
}

.timeline-step.completed .step-dot {
    background: #27ae60;
    border-color: #27ae60;
}

.step-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.timeline-step.completed .step-label {
    color: #333;
}

.step-time {
    font-size: 10px;
    color: #bbb;
    margin-top: 2px;
}

.step-by {
    font-size: 10px;
    color: #999;
    font-style: italic;
}

.timeline-line {
    flex: 1;
    height: 2px;
    background: #ddd;
    margin-top: 6px;
    min-width: 20px;
}

.timeline-line.completed {
    background: #27ae60;
}

/* ---- TRANSFER ACTIONS ---- */

.transfer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.delivered-check {
    font-size: 13px;
    color: #27ae60;
    font-weight: 600;
}

.wa-badge {
    display: inline-block;
    background: #25D366;
    color: white;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 2px;
}

/* ---- MODAL ---- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}

.modal-close:hover {
    color: #333;
}

.item-list {
    padding: 16px 20px;
}

.item-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.item-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #eee;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.item-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f5f5f5;
}

.item-table tr:last-child td {
    border-bottom: none;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 600px) {
    .summary-row {
        padding: 12px 12px 0;
        gap: 8px;
    }

    .summary-card {
        padding: 12px 8px;
    }

    .summary-number {
        font-size: 22px;
    }

    .transfer-list {
        padding: 0 12px 12px;
    }

    .transfer-card {
        padding: 12px;
    }

    .transfer-header {
        flex-direction: column;
        gap: 4px;
    }

    .transfer-route {
        font-size: 14px;
    }

    .toolbar {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: space-between;
    }

    .transfer-actions {
        flex-wrap: wrap;
    }

    .status-timeline {
        overflow-x: auto;
    }
}
