/**
 * Warehouse Management Styles
 * Specific styling for warehouse batch management, receiving workflow, and stock confirmation
 */

/* ============================================================
   ROOT VARIABLES - Shared with shared-tables.css
   ============================================================ */
:root {
    --primary-color: #1EC677;
    --primary-dark: #189060;
    --primary-light: #4dd99c;
    --text-color: #23282d;
    --la-field-border-color: #e5e5e5;
    --bg-light: #f8f9fa;
    --bg-light-hover: rgba(30, 198, 119, 0.05);
    --shadow: 0 2px 8px rgba(30, 198, 119, 0.15);
}

/* ============================================================
   WAREHOUSE CONTAINER
   ============================================================ */

.warehouse-management-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.warehouse-management-container h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.warehouse-management-container .button {
    margin: 0;
}

/* ============================================================
   WAREHOUSE SELECTOR
   ============================================================ */

.warehouse-selector {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    /* border-radius: 6px; */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--la-field-border-color);
}

.warehouse-selector .filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.warehouse-selector .filter-select {
    width: 100%;
}

.warehouse-info-banner {
    background: linear-gradient(135deg, rgba(30, 198, 119, 0.1) 0%, rgba(30, 198, 119, 0.05) 100%);
    padding: 15px 20px;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    margin-bottom: 20px;
    margin-top: 0;
}

.warehouse-info-banner p {
    margin: 0;
    color: var(--text-color);
    font-size: 15px;
}

/* ============================================================
   WAREHOUSE BATCHES SECTION
   ============================================================ */

.warehouse-batches-section {
    padding: 20px 25px;
}

.warehouse-batches-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.batches-container {
    margin-top: 20px;
}

/* ============================================================
   WAREHOUSE BATCHES TABLE
   ============================================================ */

.warehouse-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 20px;
}

.warehouse-table thead {
    background-color: var(--primary-color);
}

.warehouse-table thead th {
    /* color: #fff; */
    /* padding: 12px 15px; */
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: none;
    /* border: none; */
}

.warehouse-table tbody tr {
    border-bottom: 1px solid var(--la-field-border-color);
    transition: background-color 0.2s ease;
}

.warehouse-table tbody tr:hover {
    background-color: var(--bg-light-hover);
}

.warehouse-table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-color);
}

.warehouse-table .text-center {
    text-align: center;
}

/* Status Badges - Updated for table layout */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #f0f0f0;
    color: #666;
    white-space: nowrap;
}

.status-badge.draft {
    background-color: #f5f5f5;
    color: #999;
}

.status-badge.submitted {
    background-color: rgba(30, 198, 119, 0.1);
    color: var(--primary-color);
}

.status-badge.warehouse-assigned,
.status-badge.warehouse_assigned {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-badge.inventory-received,
.status-badge.inventory_received {
    background-color: #f3e5f5;
    color: #6a1b9a;
}

.status-badge.in-picking,
.status-badge.in_picking {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-badge.in-packing,
.status-badge.in_packing {
    background-color: #ffe0b2;
    color: #e65100;
}

.status-badge.completed {
    background-color: #e8f5e9;
    color: #2e7d32;
}

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

.table-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.table-actions .button {
    padding: 6px 10px;
    font-size: 12px;
    height: auto;
    line-height: 1.4;
    white-space: nowrap;
    margin-right: 0;
}

/* ============================================================
   MODALS - Batch Receiving Forms
   ============================================================ */

.batch-info-summary {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--la-field-border-color);
}

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

.info-label {
    font-weight: 600;
    color: var(--text-color);
    flex: 0 0 40%;
}

.info-value {
    color: var(--primary-dark);
    font-weight: 500;
    flex: 1;
    text-align: right;
}

/* ============================================================
   FORMS - Receiving, Confirmation, Modification
   ============================================================ */

.receive-form,
.confirmation-form,
.modify-form {
    padding: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--la-field-border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 198, 119, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #777;
    font-size: 12px;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
}

.form-actions button {
    flex: 1;
}

/* ============================================================
   STOCK CONFIRMATION
   ============================================================ */

.stock-confirmation-header {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.stock-confirmation-header p {
    margin: 0;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
}

.items-list {
    margin-bottom: 20px;
}

.item-confirmation-row {
    display: grid;
    grid-template-columns: 1fr 100px 120px 50px;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 10px;
}

.item-confirmation-row > div:first-child {
    font-weight: 600;
    color: var(--text-color);
}

.item-expected,
.item-actual-input {
    display: flex;
    flex-direction: column;
}

.item-expected .label,
.item-actual-input label {
    font-size: 12px;
    font-weight: 600;
    color: #777;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-expected .value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color);
}

.confirm-actual-qty {
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--la-field-border-color);
    border-radius: 4px;
    text-align: center;
}

.item-status {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s ease;
}

.item-status.match {
    color: #4caf50;
}

.item-status.mismatch {
    color: #f44336;
}

/* ============================================================
   STOCK MODIFICATION
   ============================================================ */

.item-modification-card {
    background: #fff;
    border: 1px solid var(--la-field-border-color);
    border-radius: 6px;
    margin-bottom: 15px;
    overflow: hidden;
}

.card-header {
    background: var(--bg-light);
    padding: 12px 15px;
    border-bottom: 1px solid var(--la-field-border-color);
}

.card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.card-body {
    padding: 15px;
}

.qty-comparison {
    display: grid;
    grid-template-columns: 1fr 30px 1fr;
    gap: 15px;
    align-items: center;
}

.qty-column {
    display: flex;
    flex-direction: column;
}

.qty-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #777;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.qty-display {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    padding: 10px;
    background: var(--bg-light);
    border-radius: 4px;
    text-align: center;
}

.qty-arrow {
    text-align: center;
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 700;
}

.qty-input {
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--la-field-border-color);
    border-radius: 4px;
    text-align: center;
}

.qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 198, 119, 0.1);
}

/* ============================================================
   INFO BOXES
   ============================================================ */

.info-box {
    background: rgba(33, 150, 243, 0.08);
    border-left: 4px solid #2196f3;
    padding: 15px;
    border-radius: 4px;
}

.info-box p,
.info-box ol,
.info-box li {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
}

.info-box ol {
    margin-left: 20px;
}

.info-box p:last-child,
.info-box li:last-child {
    margin-bottom: 0;
}

/* ============================================================
   MODAL STYLES (Generic for all warehouse modals)
   ============================================================ */

.inventory-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    overflow: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 600px;
}

.modal-content.large-modal {
    max-width: 900px;
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-header .close {
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
}

.modal-header .close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 25px;
}

/* ============================================================
   STATUS TABLE
   ============================================================ */

.status-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.status-table thead th {
    background: var(--bg-light);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--la-field-border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--la-field-border-color);
}

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

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.pending {
    background-color: #ffc107;
}

.status-indicator.confirmed {
    background-color: #4caf50;
}

.status-indicator.mismatch {
    background-color: #f44336;
}

/* ============================================================
   LOADING INDICATORS
   ============================================================ */

.button-loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.button.loading {
    opacity: 0.6;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 900px) {
    .batches-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .item-confirmation-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .warehouse-management-container h2 {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        font-size: 20px;
    }

    .warehouse-selector {
        padding: 15px;
    }

    .warehouse-batches-section {
        padding: 15px;
    }

    .batches-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .batch-card {
        padding: 15px;
    }

    .batch-meta {
        flex-direction: column;
        gap: 8px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-header {
        padding: 15px;
    }

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

    .modal-body {
        padding: 15px;
    }

    .qty-comparison {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .qty-arrow {
        display: none;
    }

    /* Table responsive for tablet */
    .warehouse-table {
        font-size: 12px;
    }

    .warehouse-table thead th {
        padding: 10px 8px;
    }

    .warehouse-table tbody td {
        padding: 10px 8px;
    }

    .table-actions {
        flex-direction: column;
        gap: 4px;
    }

    .table-actions .button {
        padding: 5px 8px;
        font-size: 11px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .warehouse-management-container h2 {
        font-size: 18px;
    }

    .modal-content {
        width: 98%;
        margin: 20% auto;
    }

    .item-confirmation-row {
        padding: 12px;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Table responsive for mobile - hide non-essential columns */
    .warehouse-table {
        font-size: 11px;
    }

    .warehouse-table thead th {
        padding: 8px 6px;
        font-size: 10px;
    }

    .warehouse-table tbody td {
        padding: 8px 6px;
        font-size: 11px;
    }

    /* Hide columns on mobile: Created Date, SLA Due */
    .warehouse-table thead th:nth-child(n+5) {
        display: none;
    }

    .warehouse-table tbody td:nth-child(n+5) {
        display: none;
    }

    .table-actions {
        flex-direction: column;
        gap: 3px;
    }

    .table-actions .button {
        padding: 5px 6px;
        font-size: 10px;
        width: 100%;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .warehouse-management-container {
        box-shadow: none;
    }

    .warehouse-table {
        border: 1px solid #000;
        page-break-inside: avoid;
    }

    .table-actions {
        display: none;
    }

    .warehouse-selector {
        margin-bottom: 20px;
    }
}
