/* ===== Expo Console ===== */

/* Page wrapper */
.expo-page {
    min-height: 100vh;
    background: #f7f7f8;
    animation: expoFadeIn 0.4s ease;
}

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

/* Header */
.expo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: #fff;
    border-bottom: 3px solid #B71C1C;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.expo-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
}

.expo-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.expo-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.expo-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.expo-company-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #B71C1C;
    line-height: 1.2;
}

.expo-subtitle {
    font-size: 0.85rem;
    color: #888;
    font-weight: 400;
}

/* Controls bar */
.expo-controls {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
}

/* On desktop: show header search, hide controls search */
.expo-search-header {
    display: block;
    flex: 1;
    max-width: 600px;
}

.expo-search-controls {
    display: none;
}

.expo-search-input {
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #333;
    width: 100%;
    min-width: 350px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.expo-search-input::placeholder {
    color: #999;
}

.expo-search-input:focus {
    border-color: #B71C1C;
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.2);
}

/* Filter buttons */
.filter-buttons {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    text-align: center;
}

.filter-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.filter-btn.active {
    color: #fff;
    border-color: transparent;
    background: #B71C1C;
}

.filter-btn.filter-active.active { background: #B71C1C; }
.filter-btn.filter-received.active { background: #1d4ed8; }
.filter-btn.filter-in-progress.active { background: #92400e; }
.filter-btn.filter-completed.active { background: #166534; }
.filter-btn.filter-rejected.active { background: #991b1b; }

/* Order list */
.expo-order-list {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-orders {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
    font-size: 1rem;
}

/* ===== Order card (collapsible) ===== */
.order-card {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: expoFadeIn 0.3s ease;
}


/* Summary row (always visible, clickable) */
.order-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.order-summary-row:hover {
    background: #f9fafb;
}

.order-summary-left {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.order-summary-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.order-location-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #B71C1C;
}

.order-detail-line {
    font-size: 0.9rem;
    color: #222;
}

.order-label {
    font-weight: 600;
    color: #888;
}

.order-summary-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}


.order-item-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.order-elapsed {
    font-size: 0.8rem;
    color: #888;
}

.order-summary-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.expand-arrow {
    font-size: 0.7rem;
    color: #999;
    transition: transform 0.25s ease;
    display: inline-block;
}

.expand-arrow.open {
    transform: rotate(90deg);
}

/* Status badge */
.expo-status-badge {
    display: inline-block;
    padding: 0.25rem 0;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    width: 5.5rem;
    text-align: center;
}

.expo-status-badge.status-received { background: #dbeafe; color: #1d4ed8; }
.expo-status-badge.status-in-progress { background: #fef3c7; color: #92400e; }
.expo-status-badge.status-completed { background: #dcfce7; color: #166534; }
.expo-status-badge.status-rejected { background: #fee2e2; color: #991b1b; }

/* ===== Detail section (expanded) ===== */
.order-detail-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

.order-detail-wrapper.open {
    grid-template-rows: 1fr;
}

.order-detail-inner {
    overflow: hidden;
}

.order-detail {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
    opacity: 0;
    transition: opacity 0.25s ease 0.05s;
}

.order-detail-wrapper.open .order-detail {
    opacity: 1;
}

.order-note-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.order-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
}

.order-note-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    outline: none;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.order-note-input::placeholder {
    color: #aaa;
}

.order-note-input:focus {
    border-color: #B71C1C;
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.15);
    background: #fff;
}

.order-estimate-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.order-estimate-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.order-estimate-input {
    width: 64px;
    padding: 0.625rem 0.5rem;
    font-size: 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    text-align: center;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.order-estimate-input:focus {
    border-color: #B71C1C;
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.15);
    background: #fff;
}

.order-estimate-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}

/* Items list */
.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.item-row:last-child {
    border-bottom: none;
}

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

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #222;
}

.modifiers-list {
    list-style: none;
    padding: 0.15rem 0 0 0.75rem;
    margin: 0;
    font-size: 0.85rem;
}

.modifiers-list li {
    padding: 0.1rem 0;
}

.mod-added {
    color: #888;
}

.mod-added::before {
    content: "+ ";
    color: #B71C1C;
    font-weight: 600;
}

.mod-removed {
    color: #999;
}

.mod-removed::before {
    content: "- ";
    font-weight: 600;
}

.mod-removed-text {
    text-decoration: line-through;
}

/* Item cards */
.item-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.item-card-info {
    flex: 1;
    min-width: 0;
}

/* Item action buttons row */
.item-actions-row {
    display: flex;
    gap: 0.375rem;
}

.item-step-btn {
    flex: 1;
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 2px solid #d1d5db;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    color: #666;
    text-align: center;
}

.item-step-btn:hover:not(:disabled) {
    border-color: #B71C1C;
    color: #B71C1C;
}

.item-step-btn.active {
    border-color: #B71C1C;
    background: #B71C1C;
    color: #fff;
}

.item-step-btn.done {
    border-color: #d1d5db;
    background: #e5e7eb;
    color: #999;
    cursor: default;
}

.item-complete-btn {
    flex: 1;
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #dcfce7;
    color: #166534;
    text-align: center;
}

.item-complete-btn:hover:not(:disabled) {
    background: #bbf7d0;
}

.item-complete-btn.completed,
.item-complete-btn.completed:disabled {
    background: #166534;
    color: #fff;
    cursor: default;
    opacity: 1;
}

/* Order-level action buttons */
.btn-order-complete {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #dcfce7;
    color: #166534;
}

.btn-order-complete:hover:not(:disabled) {
    background: #bbf7d0;
}

.btn-order-complete:disabled {
    background: #e5e7eb;
    color: #999;
    cursor: not-allowed;
}

.btn-order-reject {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fee2e2;
    color: #991b1b;
}

.btn-order-reject:hover:not(:disabled) {
    background: #fecaca;
}

.btn-order-reject:disabled {
    background: #e5e7eb;
    color: #999;
    cursor: not-allowed;
}

/* Detail footer */
.order-detail-footer {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.order-detail-footer .btn-order-reject,
.order-detail-footer .btn-order-complete {
    flex: 1;
    text-align: center;
}

/* ===== Rejection modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlayFade 0.2s ease;
}

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

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #222;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: #888;
    margin: 0;
}

.modal-form-group {
    margin-top: 1rem;
}

.modal-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.modal-label .required {
    color: #B71C1C;
}

.modal-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    resize: vertical;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.modal-textarea::placeholder {
    color: #aaa;
}

.modal-textarea:focus {
    border-color: #B71C1C;
    box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.15);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.btn-modal-cancel {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-modal-cancel:hover {
    background: #f3f4f6;
}

.btn-modal-reject {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: #B71C1C;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-modal-reject:hover {
    background: #8b1515;
}

.btn-modal-reject:disabled {
    background: #e5e7eb;
    color: #888;
    cursor: not-allowed;
}

/* ===== Skeleton loading ===== */
.expo-skeleton {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-order-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.skeleton-block {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

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

.skeleton-badge { width: 80px; height: 28px; border-radius: 20px; }
.skeleton-text-lg { width: 200px; height: 18px; }
.skeleton-text-sm { width: 140px; height: 14px; }
.skeleton-input { height: 36px; flex: 1; border-radius: 8px; }
.skeleton-input-sm { width: 64px; height: 36px; border-radius: 8px; }

.skeleton-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.skeleton-item-card { height: 160px; border-radius: 0.5rem; }

/* ===== Settings menu ===== */
.settings-wrapper {
    position: relative;
}

.settings-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    padding: 0.375rem 0.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: #f3f4f6;
    color: #333;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.375rem;
    min-width: 140px;
    z-index: 100;
}

.settings-dropdown button {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    text-align: left;
    color: #333;
    border-radius: 6px;
    transition: background 0.15s;
}

.settings-dropdown button:hover {
    background: #f3f4f6;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .expo-header {
        padding: 0.75rem 1rem;
    }

    .expo-search-header {
        display: none;
    }

    .expo-search-controls {
        display: block;
    }

    .expo-controls {
        padding: 0.75rem;
    }


    .expo-order-list {
        padding: 0.75rem;
    }

    .order-summary-row {
        padding: 0.875rem 1rem;
    }

    .order-summary-meta {
        align-items: flex-start;
    }

    .order-detail {
        padding: 0.875rem 1rem;
    }

    .order-note-input {
        min-height: 80px;
    }

    .item-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .item-actions-row {
        flex-wrap: wrap;
    }

    .filter-buttons {
        width: 100%;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }
}
