/**
 * Mobile Styles for Yard Operations
 * Touch-optimized interface for yard workers
 */

/* Mobile-specific resets */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: var(--gray-50);
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
}

/* ============================================================================
   FIXED HEADER
   ============================================================================ */

.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.menu-btn,
.refresh-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: var(--spacing-sm);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.menu-btn:active,
.refresh-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.site-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.site-name {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.worker-select {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 14px;
    font-weight: 500;
    min-height: 32px;
    outline: none;
}

.worker-select option {
    color: var(--gray-900);
}

/* ============================================================================
   SLIDE-OUT MENU
   ============================================================================ */

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    transition: left 0.3s ease;
}

.mobile-menu.active {
    left: 0;
}

.menu-content {
    padding: var(--spacing-xl);
}

.menu-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-600);
    min-width: 44px;
    min-height: 44px;
}

.menu-content h3 {
    margin-bottom: var(--spacing-lg);
    color: var(--gray-900);
}

.menu-link,
.menu-btn-action {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    text-decoration: none;
    color: var(--gray-700);
    background: var(--gray-50);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    min-height: 48px;
}

.menu-link:active,
.menu-btn-action:active {
    background: var(--gray-200);
}

/* ============================================================================
   MAIN CONTENT AREA
   ============================================================================ */

.mobile-content {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 70px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.tab-panel {
    display: none;
    padding: var(--spacing-md);
    min-height: 100%;
}

.tab-panel.active {
    display: block;
}

/* ============================================================================
   MOVE CARDS
   ============================================================================ */

.move-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--gray-300);
}

.move-card.priority-high,
.move-card.priority-urgent {
    border-left-color: var(--error-color);
}

.priority-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
}

.priority-high,
.priority-urgent {
    background: #fee2e2;
    color: #991b1b;
}

.card-trailer {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.card-locations {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
}

.location-from,
.location-to {
    background: var(--gray-100);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
}

.location-to {
    background: #dbeafe;
    color: #1e40af;
}

.location-arrow {
    font-size: 20px;
    color: var(--gray-500);
}

.card-time {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
}

/* ============================================================================
   ACTION BUTTONS
   ============================================================================ */

.action-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px var(--spacing-md);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-claim:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

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

.btn-complete:active {
    background: #059669;
    transform: scale(0.98);
}

.completed-info {
    padding: var(--spacing-md);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 14px;
    color: var(--gray-700);
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */

.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
    min-height: 300px;
}

.empty-state.visible {
    display: flex;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.empty-text {
    font-size: 18px;
    color: var(--gray-600);
}

/* ============================================================================
   BOTTOM TAB NAVIGATION
   ============================================================================ */

.mobile-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    min-height: 60px;
    color: var(--gray-600);
}

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

.tab-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.tab-label {
    font-size: 12px;
    font-weight: 500;
}

.tab-badge {
    position: absolute;
    top: 4px;
    right: 20%;
    background: var(--error-color);
    color: var(--white);
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
}

.tab-badge:empty {
    display: none;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

#toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    background: var(--gray-900);
    color: var(--white);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    font-size: 16px;
    font-weight: 500;
    min-width: 250px;
    text-align: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

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

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

.toast-info {
    background: var(--info-color);
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   SAFE AREAS (for notched devices)
   ============================================================================ */

@supports (padding: max(0px)) {
    .mobile-header {
        padding-left: max(var(--spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--spacing-md), env(safe-area-inset-right));
    }

    .mobile-tabs {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}
