* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.1em;
}

.main-content {
    padding: 30px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: #ef4444;
    color: white;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn .icon {
    font-size: 20px;
    font-weight: bold;
}

/* Add Product Section */
.add-product-section {
    margin-bottom: 30px;
}

#addProductBtn {
    font-size: 18px;
    padding: 15px 30px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Product Filter */
.product-filter-box {
    margin-bottom: 20px;
    position: relative;
}

.product-filter-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.product-filter-wrapper {
    position: relative;
}

.product-filter-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s;
}

.product-filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.product-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -2px;
}

.product-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.product-dropdown-item:last-child {
    border-bottom: none;
}

.product-dropdown-item:hover {
    background: #f9fafb;
}

.product-dropdown-item.selected {
    background: #667eea;
    color: white;
}

.product-dropdown-item.selected:hover {
    background: #5568d3;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Search Results */
.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: #f9fafb;
    border-color: #667eea;
    transform: translateX(5px);
}

.search-result-item .product-sku {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 8px;
}

.search-result-item .product-description {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 10px;
}

.search-result-item .product-price {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    margin-top: 8px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* Quantity Input */
.quantity-input-group {
    margin-bottom: 20px;
}

.quantity-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.quantity-input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
}

.quantity-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.product-info {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.product-info .info-row {
    margin-bottom: 8px;
}

.product-info .info-label {
    font-weight: 600;
    color: #6b7280;
    display: inline-block;
    width: 100px;
}

/* BoQ Section */
.boq-section {
    margin-top: 30px;
}

.boq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.boq-header h2 {
    color: #1f2937;
}

.boq-table-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.boq-table {
    width: 100%;
    border-collapse: collapse;
}

.boq-table thead {
    background: #f9fafb;
}

.boq-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    border-bottom: 2px solid #e5e7eb;
}

.boq-table th.col-sku {
    width: 150px;
}

.boq-table th.col-type {
    width: 100px;
    text-align: center;
}

.boq-table th.col-description {
    width: auto;
}

.boq-table th.col-quantity {
    width: 100px;
    text-align: center;
}

.boq-table th.col-unit-price {
    width: 120px;
    text-align: right;
}

.boq-table th.col-total-price {
    width: 130px;
    text-align: right;
}

.boq-table th.col-actions {
    width: 100px;
    text-align: center;
}

.boq-table tbody tr.boq-item {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.boq-table tbody tr.boq-item:last-child {
    border-bottom: none;
}

.boq-table tbody tr.boq-item:hover {
    background: #f9fafb;
}

.boq-table td {
    padding: 20px;
    vertical-align: top;
}

.boq-table td.col-sku {
    width: 150px;
    font-weight: 600;
    color: #1f2937;
}

.boq-table td.col-type {
    width: 100px;
    text-align: center;
    color: #667eea;
    font-weight: 500;
}

.boq-table td.col-description {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.boq-table td.col-quantity {
    width: 100px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: #1f2937;
}

.boq-table td.col-unit-price {
    width: 120px;
    text-align: right;
    color: #6b7280;
    font-size: 14px;
}

.boq-table td.col-total-price {
    width: 130px;
    text-align: right;
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

.boq-table td.col-actions {
    width: 100px;
    text-align: center;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #6b7280;
}

.empty-state td {
    padding: 60px 20px;
}

/* Total Section */
.total-section {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 24px;
}

.total-label {
    font-weight: 600;
}

.total-amount {
    font-weight: 700;
    font-size: 28px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .boq-table-wrapper {
        overflow-x: auto;
    }
    
    .boq-table {
        min-width: 600px;
    }
    
    .boq-table td.col-quantity,
    .boq-table td.col-unit-price,
    .boq-table td.col-total-price {
        text-align: left;
    }
    
    .boq-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}
