/**
 * Invoice Creation Page CSS
 * Excel-like table styling
 */

.invoice-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.billing-section {
    margin: 30px 0;
}

.billing-section h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.instruction {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #ffc107;
}

/* Excel-Like Table */
.table-wrapper {
    overflow-x: auto;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.excel-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-table th {
    padding: 12px 8px;
    font-weight: 600;
    text-align: left;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.excel-table td {
    padding: 0;
    border: 1px solid #e0e0e0;
    position: relative;
}

.excel-table td[contenteditable="true"] {
    padding: 10px 8px;
    min-height: 40px;
    cursor: text;
    background: white;
    transition: all 0.2s ease;
}

.excel-table td[contenteditable="true"]:hover {
    background: #f0f8ff;
}

.excel-table td[contenteditable="true"]:focus {
    outline: 2px solid #667eea;
    background: #fff;
    z-index: 5;
}

.excel-table .cell-readonly {
    padding: 10px 8px;
    background: #f8f9fa;
    color: #495057;
    font-weight: 500;
    text-align: right;
}

.excel-table .cell-date {
    width: 100px;
}

.excel-table .cell-desc {
    width: 250px;
}

.excel-table .cell-qty,
.excel-table .cell-rate {
    text-align: right;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #667eea;
    color: white;
}

.autocomplete-item strong {
    display: block;
    margin-bottom: 3px;
}

.autocomplete-item span {
    font-size: 0.85em;
    color: #666;
}

.autocomplete-item:hover span,
.autocomplete-item.active span {
    color: rgba(255, 255, 255, 0.9);
}

/* Totals Section */
.totals-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    border-left: 4px solid #667eea;
}

.totals-grid {
    max-width: 500px;
    margin-left: auto;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.total-row.grand-total {
    border-top: 2px solid #667eea;
    border-bottom: 2px solid #667eea;
    margin: 10px 0;
    padding: 15px 0;
    font-size: 1.2em;
}

.total-row.due-amount {
    background: #fff3cd;
    padding: 15px;
    margin: 10px -15px;
    border-radius: 8px;
    font-size: 1.1em;
}

.total-row.amount-words {
    flex-direction: column;
    background: #e7f3ff;
    padding: 15px;
    margin: 10px -15px;
    border-radius: 8px;
    border: none;
}

.total-label {
    color: #555;
    font-weight: 600;
}

.total-value {
    color: #333;
    font-weight: 700;
}

#advanceAmount {
    border: 2px solid #667eea;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 1em;
}

/* Responsive */
@media (max-width: 768px) {
    .excel-table {
        font-size: 0.85em;
    }

    .excel-table th,
    .excel-table td {
        padding: 8px 5px;
    }

    .totals-grid {
        max-width: 100%;
    }
}