/* File: /wp-content/plugins/vivaia-pos/assets/css/frontend-inventory.css */

/* Ensure the page fits within the viewport */
html, body {
    width: 100%;
    overflow-x: hidden;
}

/* Tab container (existing for other pages) */
.vivaia-tabs {
    margin-bottom: 1.5rem;
}
.vivaia-tabs ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid #e5e7eb; /* gray-200 */
}
.vivaia-tabs ul li {
    margin-right: 1rem;
}
.vivaia-tabs ul li a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563; /* gray-600 */
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.vivaia-tabs ul li a:hover {
    color: #111827; /* gray-900 */
}
.vivaia-tabs ul li a.active {
    color: #111827; /* gray-900 */
    border-bottom: 2px solid #111827;
    font-weight: 600;
}

/* Tab content (existing for other pages) */
.tab-content .tab {
    display: none;
}
.tab-content .tab.active {
    display: block;
}

/* Checklist tab container (new for checklist page) */
.checklist-tabs {
    margin-bottom: 1.5rem;
}
.checklist-tabs ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid #e5e7eb; /* gray-200 */
}
.checklist-tabs ul li {
    margin-right: 1rem;
}
.checklist-tabs ul li a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563; /* gray-600 */
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.checklist-tabs ul li a:hover {
    color: #111827; /* gray-900 */
}
.checklist-tabs ul li a.active {
    color: #111827; /* gray-900 */
    border-bottom: 2px solid #111827;
    font-weight: 600;
}

/* Checklist tab content (new for checklist page) */
.checklist-tab-content .tab {
    display: none !important; /* Ensure hidden */
}
.checklist-tab-content .tab.active {
    display: block !important; /* Ensure visible */
}

/* ===== STANDARDIZED QUICK PRODUCT SELECT COMPONENT ===== */
.quick-product-select-container {
    margin-bottom: 1.5rem;
}

.quick-product-search {
    position: relative;
    margin-bottom: 1rem;
}

.quick-product-search input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.quick-product-search input:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

/* Clear search button */
#stock-in-quick-clear-search,
#transfer-quick-clear-search,
#check-quick-clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

#stock-in-quick-clear-search:hover,
#transfer-quick-clear-search:hover,
#check-quick-clear-search:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}

/* Search dropdown */
.quick-product-search .dropdown {
    max-height: 600px; /* Increased from 300px to show more results */
    overflow-y: auto;
    z-index: 20;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
}

/* Quick Product Select Dropdowns */
.quick-product-select-dropdowns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.quick-product-select-dropdowns select {
    width: 100%;
    min-width: 0; /* Allow shrinking */
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Fix for text clipping */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.quick-product-select-dropdowns select:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.quick-product-select-dropdowns select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Fix for dropdown option text clipping */
.quick-product-select-dropdowns select option {
    padding: 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    min-height: 1.5em;
    line-height: 1.5;
}

/* Responsive adjustments for dropdowns */
@media (max-width: 768px) {
    .quick-product-select-dropdowns {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .quick-product-select-dropdowns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .quick-product-select-dropdowns {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Buttons */
.vivaia-button {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    background-color: #000000;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vivaia-button:hover {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

/* Inventory item list (table-like layout) */
.inventory-list {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Header row */
.inventory-list .inventory-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f3f4f6;
    border-bottom: 1px solid #d1d5db;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
}

/* Inventory item row */
.inventory-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

/* Remove border from last item */
.inventory-item:last-child {
    border-bottom: none;
}

/* Alternating row colors */
.inventory-item:nth-child(even) {
    background-color: #fafafa;
}

/* Hover effect */
.inventory-item:hover {
    background-color: #f9fafb;
}

/* Image column */
.inventory-item .image-column {
    width: 50px;
    margin-right: 1rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.inventory-item .image-column img {
    width: 50px !important;
    height: 50px !important;
    min-height: 50px;
    margin-right: 0 !important;
    object-fit: cover;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
    background-color: #f0f0f0;
}

/* Product details */
.inventory-item .flex-1 {
    flex: 1;
    min-width: 0;
}

.inventory-item .font-medium {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inventory-item .text-sm.text-gray-500 {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.5;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Quantity column */
.inventory-item .qty-column {
    width: 80px;
    margin-right: 1rem;
}

.inventory-item .quantity-input {
    width: 80px !important;
    padding: 0.5rem !important;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem !important;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus state */
.inventory-item .quantity-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Remove button */
.inventory-item .remove-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: 0 !important;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    transition: color 0.2s ease;
}

.inventory-item .remove-item:hover,
.inventory-item .remove-item:focus {
    color: #b91c1c;
}

/* SVG icon for remove button */
.inventory-item .remove-item svg {
    width: 20px !important;
    height: 20px !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .inventory-list {
        border-radius: 0.25rem;
    }

    .inventory-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.75rem;
    }

    .inventory-item .image-column {
        width: auto;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .inventory-item .qty-column {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .inventory-item .quantity-input {
        width: 100% !important;
        max-width: 120px;
    }

    .inventory-item .remove-item {
        width: 28px;
        height: 28px;
    }

    .inventory-item .remove-item svg {
        width: 18px !important;
        height: 18px !important;
    }

    .inventory-item .flex-1 {
        width: 100%;
    }

    .inventory-item .font-medium {
        white-space: normal;
    }

    /* Responsive tab adjustments (existing) */
    .vivaia-tabs ul {
        flex-direction: column;
        border-bottom: none;
    }

    .vivaia-tabs ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .vivaia-tabs ul li a {
        padding: 0.5rem 1rem;
        border-bottom: none;
        border-left: 4px solid transparent;
    }

    .vivaia-tabs ul li a.active {
        border-bottom: none;
        border-left: 4px solid #111827;
    }

    /* Responsive checklist tab adjustments (new) */
    .checklist-tabs ul {
        flex-direction: column;
        border-bottom: none;
    }

    .checklist-tabs ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .checklist-tabs ul li a {
        padding: 0.5rem 1rem;
        border-bottom: none;
        border-left: 4px solid transparent;
    }

    .checklist-tabs ul li a.active {
        border-bottom: none;
        border-left: 4px solid #111827;
    }
}

/* Legacy select styling for backward compatibility */
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

select:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Fix for all select option text clipping */
select option {
    padding: 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    min-height: 1.5em;
    line-height: 1.5;
}

/* Hide redundant element */
#transfer-quick-available-inventory {
    display: none !important;
}