/* --- Screen Basics --- */
.wrig-container {
    max-width: 600px;
    margin: 20px auto;
    font-family: 'Segoe UI', sans-serif;
    padding: 20px;
    background: #f0f0f1;
    border: 1px solid #ccc;
}

/* TABS STYLING */
.wrig-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.wrig-tab-link {
    padding: 10px 20px;
    cursor: pointer;
    background: #e1e1e1;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    font-weight: bold;
    color: #555;
}

.wrig-tab-link.active {
    background: #2271b1;
    color: white;
}

.wrig-tab-content {
    display: none;
}

.wrig-tab-content.active {
    display: block;
}

.wrig-form-group { margin-bottom: 15px; }
.wrig-form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.wrig-form-group input, .wrig-form-group select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }

.wrig-btn {
    background: #2271b1; color: white; border: none; padding: 12px 25px;
    cursor: pointer; font-size: 16px; border-radius: 4px; width: 100%; transition: 0.3s;
}
.wrig-btn:hover { background: #135e96; }
.wrig-print-btn { background: #e67e22; width: auto; } 

/* --- Invoice Layout (The Source for PDF) --- */
.wrig-invoices-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px; 
    margin-top: 30px;
    background: #555; 
    padding: 50px 0;
}

/* A4 Page Definition */
.wrig-invoice-page {
    background: #fff;
    width: 210mm;
    height: 297mm; 
    padding: 15mm 20mm; 
    box-sizing: border-box;
    position: relative;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    font-size: 13px;
    overflow: hidden; 
    box-shadow: 0 0 15px rgba(0,0,0,0.5); 
}

/* Header */
.wrig-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.wrig-company-left { width: 60%; }
.wrig-invoice-right { width: 40%; text-align: right; }
.company-title { font-size: 22px; text-transform: uppercase; margin: 0 0 5px 0; font-weight: 700; color: #2c3e50; }
.company-details { font-size: 12px; line-height: 1.5; color: #555; }
.invoice-title { font-size: 24px; color: #555; text-transform: uppercase; margin: 0 0 5px 0; font-weight: 600; }
.invoice-meta { font-size: 14px; line-height: 1.5; font-weight: bold; color: #000; white-space: nowrap; }
.wrig-thick-divider { height: 2px; background: #000; margin: 15px 0 25px 0; }

/* Bill To Box */
.wrig-bill-to-box { background: #f9f9f9; border-left: 5px solid #333; padding: 15px; margin-bottom: 30px; }
.bill-label { font-size: 12px; color: #666; }
.client-name { font-size: 16px; color: #000; display: block; margin: 3px 0; }

/* Table */
.wrig-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; table-layout: fixed; }
.wrig-table th { background: #f2f2f2; color: #444; font-weight: bold; font-size: 11px; text-transform: uppercase; padding: 12px 8px; border: 1px solid #ddd; white-space: nowrap; }
.wrig-table td { padding: 15px 8px; border: 1px solid #ddd; vertical-align: middle; font-size: 13px; word-wrap: break-word; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Column Widths */
.col-desc { width: 35%; }
.col-hsn { width: 15%; }
.col-val { width: 18%; } 
.col-rate { width: 14%; }
.col-total { width: 18%; }

/* Footer */
.wrig-footer-container { display: flex; justify-content: space-between; align-items: flex-start; }
.wrig-footer-left { width: 55%; }
.wrig-footer-right { width: 40%; }
.amount-words { font-size: 12px; margin-bottom: 20px; color: #444; line-height: 1.4; }
.payment-mode-box { background: #f2f2f2; padding: 12px; border-radius: 3px; font-size: 12px; }
.wrig-totals-table { width: 100%; border-collapse: collapse; border: 1px solid #ccc; }
.wrig-totals-table td { padding: 8px 10px; border-bottom: 1px solid #ccc; }
.grand-total-row td { border-top: 2px solid #000; border-bottom: 2px solid #000; background: #f9f9f9; font-weight: bold; font-size: 15px; }
.wrig-divider-light { border: 0; border-top: 1px solid #eee; margin: 40px 0 20px 0; }

/* Bottom */
.wrig-bottom-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 30px; }
.wrig-terms { font-size: 10px; color: #777; width: 60%; }
.wrig-terms ol { padding-left: 15px; margin: 5px 0; }
.wrig-sign { text-align: right; width: 35%; }
.sign-line { border-top: 1px solid #ccc; width: 100%; margin-bottom: 10px; }

/* Print Fallback */
@media print {
    body * { visibility: hidden; }
    .wrig-invoices-list, .wrig-invoices-list * { visibility: visible; }
    #wrig-controls, .wrig-container { display: none !important; }
}