/* Order Management System - Mobile First CSS (Compact) */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #007AFF;
    --primary-dark: #0056b3;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-500: #adb5bd;
    --gray-700: #495057;
    --gray-900: #212529;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
    --radius: 10px;
    --radius-sm: 6px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.4;
    min-height: 100vh;
    padding-bottom: 40px;
}

/* Header - Compact */
.header {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
}

.header-date {
    font-size: 11px;
    opacity: 0.9;
}

.header-logout {
    font-size: 16px;
    text-decoration: none;
}

/* Stats Bar - Compact */
.stats-bar {
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 6px 8px;
    box-shadow: var(--shadow);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 9px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Tabs - Compact */
.tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 36px;
    z-index: 99;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 4px;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 9px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-icon {
    font-size: 16px;
    margin-bottom: 1px;
}

.tab-label {
    font-weight: 500;
}

/* Content - Compact */
.content {
    padding: 8px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}

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

/* Cards - Compact */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.card.selected {
    border-color: var(--primary);
    background: #f0f7ff;
}

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

.card-ref {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

.card-amount {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-900);
}

.card-customer {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.card-details {
    font-size: 12px;
    color: var(--gray-700);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.card-status {
    font-size: 11px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 6px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-synced { background: #E8F5E9; color: #2E7D32; }
.badge-rejected { background: #FFEBEE; color: #C62828; }
.badge-score { background: var(--success); color: white; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 24px;
    min-width: 32px;
    min-height: 32px;
    line-height: 1;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 6px;
    min-width: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    outline: none;
}

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

/* File Input - Compact */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-button {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    color: var(--gray-500);
    text-align: center;
    transition: all 0.2s;
}

.file-input-button.has-file {
    border-color: var(--success);
    border-style: solid;
    background: #E8F5E9;
    color: var(--success);
}

.file-input-icon {
    font-size: 22px;
}

.file-input-text {
    font-size: 14px;
    font-weight: 500;
}

/* Preview */
.preview {
    margin-top: 8px;
    text-align: center;
}

.preview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 0;
}

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

.modal {
    background: white;
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-100);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
}

.modal-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-900);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1001;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px 16px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
}

/* Order Detail */
.order-section {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.order-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.order-customer-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.order-customer-name {
    font-size: 14px;
    font-weight: 600;
}

.order-customer-address {
    font-size: 12px;
    color: var(--gray-700);
    margin-top: 2px;
}

.order-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.order-line:last-child {
    border-bottom: none;
}

.order-line-product {
    flex: 1;
}

.order-line-sku {
    font-size: 10px;
    color: var(--gray-500);
}

.order-line-name {
    font-size: 13px;
}

.order-line-qty {
    font-size: 13px;
    color: var(--gray-700);
    margin: 0 10px;
}

.order-line-price {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.order-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 2px solid var(--gray-200);
    font-size: 15px;
    font-weight: 700;
}

/* Customer Search */
.customer-search-results {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-top: 6px;
}

.customer-result {
    padding: 10px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
}

.customer-result:last-child {
    border-bottom: none;
}

.customer-result:hover, .customer-result.selected {
    background: #f0f7ff;
}

.customer-result-name {
    font-weight: 600;
    font-size: 13px;
}

.customer-result-address {
    font-size: 11px;
    color: var(--gray-500);
}

/* Label Info Box - Compact */
.label-info {
    background: #E3F2FD;
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 12px;
}

.label-info-title {
    font-size: 11px;
    font-weight: 600;
    color: #1565C0;
    margin-bottom: 4px;
}

.label-info-tracking {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 15px;
    font-weight: 700;
    color: #D32F2F;
    letter-spacing: 0.3px;
}

.label-info-address {
    font-size: 12px;
    margin-top: 6px;
}

/* Radio Card */
.radio-card {
    display: block;
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.radio-card input:checked + .card {
    border-color: var(--primary);
    background: #f0f7ff;
}

/* Shipment List */
.shipment-list {
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Section Headers */
h3 {
    font-size: 11px;
    color: var(--gray-500);
    margin: 12px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Date Info - Remove if exists */
.date-info {
    display: none;
}

/* Responsive Desktop */
@media (min-width: 768px) {
    body {
        padding-bottom: 20px;
    }
    
    .header {
        padding: 12px 20px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    .stats-bar {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .tabs {
        top: 44px;
    }
    
    .tab {
        padding: 8px;
        font-size: 11px;
    }
    
    .tab-icon {
        font-size: 20px;
    }
    
    .content {
        max-width: 600px;
        margin: 0 auto;
        padding: 16px;
    }
    
    .modal {
        max-width: 500px;
        border-radius: var(--radius);
        margin: auto;
    }
    
    .modal-overlay {
        align-items: center;
        padding: 20px;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(20px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
    background: white;
    z-index: 50;
}
