/* ============================================
   FIFO COST SYSTEM STYLES
   ============================================ */

/* FIFO Warning Box in Import */
.fifo-warning-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.fifo-warning-box p {
    margin: 10px 0;
    line-height: 1.6;
}

.fifo-warning-box p:first-child {
    margin-top: 0;
    color: #856404;
    font-size: 1.1em;
}

.fifo-warning-box ul {
    margin: 10px 0 10px 20px;
    line-height: 1.8;
}

.fifo-warning-box ul li {
    margin: 5px 0;
}

.fifo-warning-box details {
    margin-top: 15px;
    cursor: pointer;
}

.fifo-warning-box summary {
    color: #007bff;
    font-weight: 600;
    padding: 8px 0;
}

.fifo-warning-box summary:hover {
    text-decoration: underline;
}

.warning-section {
    border-left: 4px solid #ffc107;
    padding-left: 20px;
    margin-bottom: 30px;
}

.warning-section h3 {
    color: #856404;
    margin-bottom: 15px;
}

.preview-modal.has-warnings {
    max-height: 90vh;
}

.preview-modal.has-warnings .preview-content {
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

/* FIFO Lot Viewer Component */
.fifo-lot-viewer {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fifo-lot-viewer h3 {
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fifo-lot-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.fifo-lot-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.9em;
}

.fifo-lot-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
}

.fifo-lot-table tr:hover {
    background: #f8f9fa;
}

.lot-number {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #495057;
}

.lot-age {
    font-size: 0.85em;
    color: #6c757d;
}

.lot-age.old {
    color: #dc3545;
    font-weight: 600;
}

.lot-source {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.lot-source.purchase {
    background: #d4edda;
    color: #155724;
}

.lot-source.assembly {
    background: #d1ecf1;
    color: #0c5460;
}

.lot-source.import {
    background: #fff3cd;
    color: #856404;
}

.lot-source.adjustment {
    background: #f8d7da;
    color: #721c24;
}

.lot-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.lot-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* FIFO Cost Breakdown in Sales */
.fifo-cost-breakdown {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.fifo-cost-breakdown h4 {
    margin-bottom: 10px;
    color: #495057;
    font-size: 0.95em;
}

.fifo-allocation-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9em;
}

.fifo-allocation-row:last-child {
    border-bottom: none;
    font-weight: 600;
    margin-top: 5px;
    padding-top: 10px;
    border-top: 2px solid #dee2e6;
}

.fifo-allocation-label {
    color: #6c757d;
}

.fifo-allocation-value {
    font-family: 'Courier New', monospace;
}

/* Inventory Valuation Report */
.valuation-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.valuation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.valuation-stat {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
}

.valuation-stat.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.valuation-stat.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.valuation-stat.tertiary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.valuation-stat-label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.valuation-stat-value {
    font-size: 2em;
    font-weight: 700;
}

.valuation-stat-note {
    font-size: 0.75em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Lot Aging Report */
.aging-category {
    margin-bottom: 30px;
}

.aging-category h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.aging-category.critical h3 {
    color: #dc3545;
}

.aging-category.warning h3 {
    color: #ffc107;
}

.aging-category.recent h3 {
    color: #28a745;
}

.aging-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.aging-badge.critical {
    background: #dc3545;
    color: white;
}

.aging-badge.warning {
    background: #ffc107;
    color: #856404;
}

.aging-badge.recent {
    background: #28a745;
    color: white;
}

/* FIFO Info Badge */
.fifo-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e7f3ff;
    color: #004085;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid #b8daff;
}

.fifo-badge svg {
    width: 14px;
    height: 14px;
}

/* Product Edit - FIFO Lots Section */
.product-lots-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #dee2e6;
}

.product-lots-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.product-lots-summary-item {
    text-align: center;
}

.product-lots-summary-label {
    font-size: 0.8em;
    color: #6c757d;
    margin-bottom: 5px;
}

.product-lots-summary-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #495057;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .fifo-lot-table {
        font-size: 0.85em;
    }

    .fifo-lot-table th,
    .fifo-lot-table td {
        padding: 8px;
    }

    .valuation-summary {
        grid-template-columns: 1fr;
    }

    .product-lots-summary {
        grid-template-columns: 1fr 1fr;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .fifo-warning-box {
        background: #3a2f0f;
        border-color: #ffc107;
    }

    .fifo-warning-box p:first-child {
        color: #ffdb6d;
    }

    .fifo-lot-viewer {
        background: #2d3748;
    }

    .fifo-lot-table th {
        background: #1a202c;
        color: #e2e8f0;
    }

    .fifo-lot-table tr:hover {
        background: #1a202c;
    }

    .valuation-card {
        background: #2d3748;
        color: #e2e8f0;
    }
}
