/* ========================================
   HEADER / NAVIGATION
   ======================================== */

.header {
    height: var(--header-height);
    background: var(--bg-surface);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
}

.header-title {
    font-size: 1.125rem;
    /* 18px */
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ========================================
   CARD
   ======================================== */

.card {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* ========================================
   TABLE
   ======================================== */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background-color: var(--bg-surface-2);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--bg-surface-2);
}

/* ========================================
   STATUS BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1;
    white-space: nowrap;
}

.badge-draft {
    background-color: #F3F4F6;
    /* Gray 100 */
    color: #4B5563;
    /* Gray 600 */
}

.badge-pending {
    background-color: #FEF3C7;
    /* Amber 100 */
    color: #D97706;
    /* Amber 600 */
}

.badge-approved {
    background-color: #D1FAE5;
    /* Emerald 100 */
    color: #059669;
    /* Emerald 600 */
}

.badge-rejected {
    background-color: #FEE2E2;
    /* Red 100 */
    color: #DC2626;
    /* Red 600 */
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    padding: var(--spacing-md);
}

.modal {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-2);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    background-color: var(--bg-surface-2);
    border-bottom-left-radius: var(--border-radius-lg);
    border-bottom-right-radius: var(--border-radius-lg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   QUANTITY CONTROLS (Counter)
   ======================================== */

.quantity-control {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface-2);
    border-radius: var(--border-radius-sm);
    padding: 2px;
    border: 1px solid var(--border-color);
}

.quantity-input {
    width: 60px;
    text-align: center;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-weight: 600;
}

.quantity-input:focus {
    box-shadow: none;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background-color: var(--bg-surface);
    color: var(--primary);
    border-radius: var(--border-radius-sm);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    line-height: 0;
}

.quantity-btn:hover {
    background-color: var(--primary);
    color: white;
}

.quantity-btn:active {
    transform: scale(0.95);
}

/* ========================================
   LIST ITEMS
   ======================================== */

.list-item {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.list-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.list-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.list-item-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
    filter: grayscale(1);
}

.empty-state-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.empty-state-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   FAB (Floating Action Button)
   ======================================== */

.fab {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fafafb 0%, #d5d5db 100%);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 50;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
}

.fab:active {
    transform: scale(0.95);
}

/* ========================================
   LOGIN SCREEN
   ======================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    background-color: var(--bg-body);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
}

.login-card {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-logo h1 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.75rem;
    margin-bottom: 8px;
}

/* ========================================
   FILTERS
   ======================================== */

.filter-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 8px 16px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-tab.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.filter-tab:hover:not(.active) {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
}

/* ========================================
   FOREMAN SPECIFIC
   ======================================== */

.foreman-header {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.warehouse-selectors {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 640px) {
    .warehouse-selectors {
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
    }
}

.warehouse-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    background-color: var(--bg-body);
}

/* ========================================
   TRANSFER HISTORY SPECIFIC
   ======================================== */

.transfer-card {
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.transfer-card-header {
    background-color: var(--bg-surface-2);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.transfer-status.status-completed {
    background-color: #DEF7EC;
    color: #03543F;
}

/* ========================================
   RESPONSIVE HEADER (Foreman)
   ======================================== */

.foreman-header-responsive {
    height: auto !important;
    /* Override fixed height */
    min-height: var(--header-height);
    flex-wrap: wrap;
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-sm);
}

.foreman-header-responsive .header-left {
    display: flex;
    flex-direction: column;
}

.foreman-header-responsive .header-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
    /* Keep buttons on one line if possible, or scroll */
    overflow-x: auto;
    /* Scroll if too many buttons */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    /* Space for scrollbar if visible */
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .foreman-header-responsive {
        flex-direction: column;
        align-items: stretch;
    }

    .foreman-header-responsive .header-left {
        align-items: center;
        margin-bottom: 4px;
    }

    .foreman-header-responsive .header-actions {
        justify-content: space-between;
        width: 100%;
    }

    .foreman-header-responsive .btn {
        flex: 1;
        justify-content: center;
        padding: 8px;
        font-size: 1.25rem;
        /* Larger icons */
    }

    .desktop-inline {
        display: none;
    }
}

@media (min-width: 641px) {
    .desktop-inline {
        display: inline;
        margin-left: 6px;
        font-size: 0.875rem;
    }
}