/* Billing Styles */

/* Progress Steps */
.bill-progress {
    display: flex;
    margin-top: 1rem;
    border-radius: 8px;
    background-color: white;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-step {
    flex: 1;
    padding: 1rem 0.5rem;
    text-align: center;
    position: relative;
    background-color: #f5f5f5;
    transition: background-color 0.3s;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 10px solid #f5f5f5;
    transform: translateY(-50%);
    z-index: 1;
}

.progress-step.active {
    background-color: #0f345e;
    color: white;
}

.progress-step.active:not(:last-child)::after {
    border-left-color: #0f345e;
}

.progress-step.completed {
    background-color: #27ae60;
    color: white;
}

.progress-step.completed:not(:last-child)::after {
    border-left-color: #27ae60;
}

.step-number {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.progress-step.active .step-number,
.progress-step.completed .step-number {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Billing Form Container */
.billing-form-container {
    margin-top: 1.5rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.billing-step {
    display: block;
}

.billing-step.hidden {
    display: none;
}

.section-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.section-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

/* Form Styles */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #555;
}

.form-group input, 
.form-group textarea, 
.form-group select {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    background-color: #f9f9f9;
}

.form-group input:focus, 
.form-group textarea:focus, 
.form-group select:focus {
    outline: none;
    border-color: #0f345e;
    background-color: #fff;
}

.form-group textarea {
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #777;
    font-size: 0.8rem;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navigation-buttons {
    display: flex;
    gap: 1rem;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    align-items: center;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #0f345e;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Global GST Toggle */
.global-gst-container {
    margin: 15px 0 25px;
}

.global-setting-container {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.setting-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #0f345e;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.gst-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-label {
    flex: 1;
}

.toggle-label span {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.toggle-label small {
    display: block;
    color: #777;
    font-size: 0.8rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch .toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #0f345e;
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #0f345e;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.gst-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    background-color: #f1f1f1;
    color: #666;
    border: 1px solid #ddd;
    transition: all 0.3s;
}

.gst-status.active {
    background-color: #e1f0ff;
    color: #0f345e;
    border-color: #c5e1ff;
}

/* Customer Search */
.customer-search-container {
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    margin-bottom: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-box button {
    background-color: #0f345e;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 0 1rem;
    cursor: pointer;
}

.search-instructions {
    color: #777;
    font-size: 0.9rem;
}

.customer-result {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #0f345e;
}

.customer-result.hidden {
    display: none;
}

#new-customer-form.hidden {
    display: none;
}

/* Button Styles */
.primary-btn, .secondary-btn {
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.primary-btn {
    background-color: #0f345e;
    color: white;
    border: none;
}

.primary-btn:hover {
    background-color: #0a2647;
}

.primary-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.secondary-btn {
    background-color: #f0f2f5;
    color: #333;
    border: 1px solid #ddd;
}

.secondary-btn:hover {
    background-color: #e4e6e9;
}

/* Item Cards */
#items-container {
    margin-bottom: 1.5rem;
}

.item-card {
    background-color: #f9f9f9;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info {
    flex: 1;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: #555;
}

.item-detail {
    display: flex;
    align-items: center;
}

.item-detail span:first-child {
    font-weight: 500;
    margin-right: 0.3rem;
}

.item-price {
    font-weight: bold;
    color: #0f345e;
    font-size: 1.1rem;
}

.item-actions {
    margin-left: 1rem;
}

.item-actions button {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2rem;
}

.calculated-value {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.value {
    font-size: 1.2rem;
    color: #0f345e;
    font-weight: bold;
}

/* Bill Summary */
.bill-summary {
    margin-bottom: 2rem;
}

.customer-summary {
    margin-bottom: 1.5rem;
}

.customer-summary h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.customer-detail {
    display: flex;
    margin-bottom: 0.5rem;
}

.customer-detail-label {
    min-width: 100px;
    font-weight: 500;
    color: #555;
}

.items-summary h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.summary-table th {
    background-color: #f5f5f5;
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    color: #555;
}

.summary-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
}

.summary-total {
    margin-top: 1rem;
    border-top: 2px solid #ddd;
    padding-top: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.grand-total {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ddd;
}

#exchange-row {
    color: #e74c3c;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    visibility: hidden;
    min-width: 250px;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
}

.toast-content {
    background-color: #333;
    color: white;
    padding: 16px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Guest Mode */
#guest-customer-form.hidden {
    display: none;
}

.guest-mode-banner {
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    color: #9e7d27;
    font-weight: 500;
}

.guest-mode-banner i {
    margin-right: 10px;
    font-size: 1.2em;
}

.customer-option-buttons {
    display: flex;
    gap: 10px;
}

.customer-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.guest-badge {
    background-color: #fff8e1;
    color: #9e7d27;
    border: 1px solid #ffc107;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        width: 100%;
    }
    
    .step-name {
        display: none;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-actions button, 
    .navigation-buttons {
        width: 100%;
    }
    
    .navigation-buttons {
        flex-direction: column;
    }
    
    .customer-option-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .customer-option-buttons button {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    width: 80%;
    max-width: 900px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 95vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #0f345e;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Print Bill Styles */
.print-bill-container {
    background-color: white;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.bill-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
}

.company-logo {
    text-align: left;
}

.company-logo h1 {
    font-size: 2rem;
    margin: 0;
}

.company-logo p {
    font-size: 1rem;
    margin: 0;
}

.bill-info {
    text-align: right;
    font-size: 1rem;
}

.bill-number, .bill-date {
    margin-bottom: 0.5rem;
}

.bill-customer-info {
    margin-bottom: 1.5rem;
}

.bill-customer-info h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.bill-items {
    margin-bottom: 1.5rem;
}

.bill-items h3 {
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.print-table th {
    background-color: #f5f5f5;
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    color: #555;
    border-bottom: 1px solid #ddd;
}

.print-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
}

.bill-summary {
    margin-top: 1rem;
    border-top: 2px solid #ddd;
    padding-top: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.amount-paid-input {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    padding: 0 0.5rem;
}

.amount-paid-input span {
    color: #555;
}

.amount-paid-input input {
    border: none;
    background: transparent;
    padding: 0.5rem;
    width: 150px;
    font-weight: 500;
    font-size: 1rem;
    text-align: right;
}

.amount-paid-input input:focus {
    outline: none;
}

.balance-row {
    color: #e74c3c;
}

.bill-footer {
    margin-top: 2rem;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

/* Rough Estimate Styling */
.rough-estimate .print-bill-container {
    background-color: #f9f9f9;
    border: 1px dashed #aaa;
}

.rough-estimate .bill-customer-info,
.rough-estimate .bill-items,
.rough-estimate .bill-summary {
    border: 1px dashed #ccc;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.rough-estimate .bill-header {
    justify-content: flex-end;
    border-bottom: 1px dashed #ccc;
}

.rough-estimate .print-table {
    border: 1px dashed #ccc;
}

.rough-estimate .print-table th {
    background-color: #eee;
    font-style: italic;
}

.rough-estimate .bill-footer {
    font-style: italic;
    border-top: 1px dashed #ccc;
}

.rough-estimate .watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 5rem;
    color: rgba(200, 200, 200, 0.2);
    font-weight: bold;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

/* Print Specific Styles */
@media print {
    body * {
        visibility: visible;
    }
    
    .print-bill-container, .print-bill-container * {
        visibility: visible;
    }
    
    /* Ensure customer info is always visible when printing */
    #customer-name, #customer-phone, #customer-address,
    .customer-table, .customer-table td, .customer-table tr,
    .customer-info, .customer-section, .customer-detail, 
    #print-customer-info, .customer-details, .bill-customer-info,
    [id*="customer"], [class*="customer"] {
        visibility: visible !important;
        display: block !important;
        opacity: 1 !important;
    }
    
    /* Table structure specific overrides */
    .customer-table {
        display: table !important;
        visibility: visible !important;
    }
    .customer-table tr {
        display: table-row !important;
    }
    .customer-table td {
        display: table-cell !important;
    }
    
    /* Hide form input fields during print */
    input[type="text"][id*="customer"], 
    input[type="tel"][id*="customer"], 
    input[type="email"][id*="customer"], 
    textarea[id*="customer"],
    #new-customer-form, #guest-customer-form {
        display: none !important;
    }
    
    .print-bill-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
    }
    
    .modal, .modal-header, .modal-footer, .close-modal {
        display: none;
    }
    
    .modal-content {
        box-shadow: none;
        border: none;
    }
    
    .modal-body {
        padding: 0;
    }
    
    .amount-paid-input {
        border: none;
        background: none;
    }
    
    .amount-paid-input input {
        border-bottom: 1px solid #ddd;
    }
}

/* Add CSS for the Save Customer button */
.save-customer-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.save-customer-actions button {
    min-width: 150px;
}

/* Old Metal Exchange Styles */
.old-metal-card {
    background-color: #f5f8fa;
    border-left: 4px solid #27ae60;
}

.old-metal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.old-metal-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #27ae60;
}

.no-metals-message {
    padding: 2rem;
    text-align: center;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

/* Old Metal Breakdown in Summary */
.old-metal-breakdown {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.toggle-details {
    cursor: pointer;
    color: #0f345e;
    text-align: right;
    font-size: 0.85rem;
}

.metal-details-list {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dotted #ddd;
}

.metal-details-list.hidden {
    display: none;
}

.metal-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: #555;
}

/* Print Bill Exchange Breakdown */
.exchange-breakdown {
    margin: 0.25rem 0 0.75rem 0;
    padding-left: 2rem;
    font-size: 0.9rem;
}

.breakdown-title {
    color: #555;
    margin-bottom: 0.25rem;
}

.breakdown-list {
    padding-left: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    color: #555;
    padding: 0.1rem 0;
}

@media print {
    .exchange-breakdown {
        margin: 0.15rem 0 0.5rem 0;
        font-size: 0.85rem;
    }
}

/* Payment Details */
.payment-details {
    margin-top: 0.75rem;
}

.amount-paid-input,
.payment-method-select {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    padding: 0 0.5rem;
    width: 200px;
}

.payment-method-select {
    padding: 0;
}

.payment-method-select select {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 1rem;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
}

.payment-method-select select:focus {
    background-color: #fff;
}

.balance-row {
    margin-top: 0.75rem;
    font-weight: bold;
}

/* Print Bill Exchange Breakdown */

/* Bill Templates Styles - Updated */
@media print {
    body * {
        visibility: visible;
    }
    
    .modal-body * {
        visibility: visible;
    }
    
    .modal-body {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0;
    }
    
    .modal-header, .modal-footer, .close-modal {
        display: none !important;
    }
}

/* Common Template Styles */
.invoice-container, .estimate-container {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
}

/* Template Headers */
.invoice-header, .estimate-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 2px solid #b8860b;
    margin-bottom: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
}

.invoice-logo {
    width: 100px;
    height: auto;
    margin-right: 15px;
}

.company-details h1 {
    font-size: 22px;
    color: #b8860b;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.company-details p {
    margin: 2px 0;
    font-size: 13px;
}

.estimate-title {
    font-size: 26px;
    font-weight: bold;
    margin-top: 10px;
    color: #333;
    text-transform: uppercase;
}

.invoice-info {
    text-align: right;
    font-size: 14px;
    line-height: 1.5;
}

.invoice-number, .invoice-date {
    margin-bottom: 5px;
}

/* Customer Section */
.customer-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.section-title {
    font-size: 16px;
    margin-bottom: 12px;
    color: #b8860b;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.customer-details {
    font-size: 14px;
    line-height: 1.5;
}

.customer-detail {
    margin-bottom: 8px;
    display: flex;
}

.customer-detail-label {
    font-weight: bold;
    margin-right: 10px;
    min-width: 80px;
}

/* Items Section */
.items-section {
    margin-bottom: 25px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.items-table th {
    background-color: #f5f5f5;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

.items-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.items-table tfoot td {
    padding: 10px 8px;
    border-top: 1px solid #ddd;
}

.subtotal-row td {
    font-weight: 500;
}

.grand-total td {
    font-weight: bold;
    border-top: 2px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding-top: 12px;
    font-size: 15px;
}

.total-label {
    text-align: right;
    font-weight: bold;
}

.total-value {
    text-align: right;
}

/* Payment Section */
.payment-section {
    margin: 25px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.payment-table {
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    border-collapse: collapse;
}

.payment-table tr:not(:last-child) td {
    padding-bottom: 10px;
}

.payment-label {
    font-weight: 500;
    padding-right: 20px;
}

.payment-value {
    text-align: right;
    font-weight: 500;
}

.payment-status-row td {
    padding-top: 12px;
    font-size: 16px;
    font-weight: bold;
    border-top: 1px solid #ddd;
}

/* GST Summary */
.gst-summary {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.gst-table {
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    border-collapse: collapse;
}

.gst-table td {
    padding: 8px 0;
}

.gst-table td:first-child {
    font-weight: 500;
}

.gst-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.gst-total td {
    padding-top: 10px;
    font-weight: bold;
    border-top: 1px solid #ddd;
}

/* Footers */
.invoice-footer, .estimate-disclaimer {
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
}

.signature-box {
    text-align: center;
    width: 45%;
}

.signature-line {
    border-bottom: 1px solid #aaa;
    width: 100%;
    margin-bottom: 8px;
    height: 40px;
}

.estimate-disclaimer {
    font-style: italic;
    color: #777;
    padding: 10px;
    border: 1px dashed #ccc;
    background-color: #f5f5f5;
    text-align: center;
    margin-top: 40px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .invoice-header, .estimate-header, .logo-section {
        flex-direction: column;
    }
    
    .invoice-info {
        text-align: left;
        margin-top: 15px;
    }
    
    .logo-section {
        align-items: flex-start;
        margin-bottom: 15px;
    }
    
    .invoice-logo {
        margin-bottom: 10px;
    }
    
    .items-table, .items-table th, .items-table td {
        font-size: 12px;
    }
    
    .items-table th, .items-table td {
        padding: 8px 4px;
    }
    
    .signatures {
        flex-direction: column;
        align-items: center;
    }
    
    .signature-box {
        width: 80%;
        margin-bottom: 20px;
    }
}

/* ... existing code ... */

/* Template 2 - Estimate */
.estimate-title-section {
    text-align: center;
    padding: 15px 0;
}

.estimate-title-section h1 {
    font-size: 32px;
    color: #333;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

/* ... existing code ... */

/* Loading and Error States */
.loading-template {
    padding: 40px;
    text-align: center;
    font-size: 16px;
    color: #666;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    position: relative;
}

.loading-template:before {
    content: "";
    display: block;
    width: 30px;
    height: 30px;
    border: 3px solid #0f345e;
    border-top-color: transparent;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-message {
    padding: 20px;
    background-color: #fef2f2;
    border-left: 4px solid #e74c3c;
    color: #333;
    border-radius: 4px;
    margin: 20px 0;
}

.error-message h3 {
    color: #e74c3c;
    margin-top: 0;
    margin-bottom: 10px;
}

.error-message p {
    margin-bottom: 15px;
}

/* Ensure customer info is always visible */
#customer-name, #customer-phone, #customer-address,
.customer-table .value, .customer-table,
.customer-section, .customer-detail, .customer-info,
#print-customer-info, .bill-customer-info, .customer-details {
    visibility: visible !important;
    display: block !important;
    opacity: 1 !important;
}

/* Table structure specific overrides */
.customer-table {
    display: table !important;
    visibility: visible !important;
}
.customer-table tr {
    display: table-row !important;
}
.customer-table td {
    display: table-cell !important;
}

/* View All Customers */
.view-all-customers-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

.customer-list-modal .modal-content {
    max-width: 800px;
    width: 90%;
}

.customer-search-box {
    display: flex;
    margin-bottom: 15px;
    gap: 10px;
}

.customer-search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.customer-search-box button {
    background-color: #0f345e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.customer-search-box button:hover {
    background-color: #0a2747;
}

.customers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.customers-table th,
.customers-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.customers-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.customers-table tr:hover {
    background-color: #f9f9f9;
}

.customers-table .select-customer-btn {
    padding: 6px 12px;
    font-size: 12px;
}

.customers-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.no-customers {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.error-message {
    padding: 15px;
    background-color: #ffe8e8;
    border: 1px solid #ffb8b8;
    border-radius: 4px;
    color: #d8000c;
    margin: 10px 0;
}

/* Highlight button to draw attention */
.highlight-btn {
    animation: pulse 1.5s;
    box-shadow: 0 0 0 0 rgba(15, 52, 94, 0.7);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(15, 52, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(15, 52, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(15, 52, 94, 0);
    }
}

/* Search warning styles */
.search-warning {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: #856404;
    font-size: 0.9rem;
}

.error-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Warning message styles */
.warning-message {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    color: #856404;
}

.warning-message p {
    margin-bottom: 15px;
    font-weight: 500;
}

.warning-message button {
    margin-top: 10px;
}

/* Customer actions in search result */
.customer-actions {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.customer-actions button {
    min-width: 200px;
}

.customer-details {
    border-radius: 6px;
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.customer-details h3 {
    color: #0f345e;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

/* Search Indicators */
.search-indicator {
    padding: 10px;
    margin: 10px 0;
    background-color: #f5f5f5;
    border-radius: 4px;
    text-align: center;
    color: #666;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

.loading-spinner {
    padding: 15px;
    text-align: center;
    position: relative;
    color: #666;
}

.loading-spinner:after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #ccc;
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

.no-search-results {
    padding: 15px;
    margin: 10px 0;
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    color: #856404;
    border-radius: 4px;
    text-align: center;
}

.no-results {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    text-align: center;
    margin: 10px 0;
}

.error-message {
    padding: 15px;
    background-color: #fef1f2;
    border-left: 4px solid #dc3545;
    color: #721c24;
    border-radius: 4px;
    margin: 10px 0;
}

/* Animation for the search indicator */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Animation for the loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improve search box appearance */
.search-box {
    position: relative;
    transition: all 0.3s ease;
}

.search-box input[type="text"]:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    border-color: #80bdff;
}

/* Highlight matched text in search results */
.highlight {
    background-color: #fff3cd;
    padding: 2px;
    border-radius: 2px;
}

/* Enhanced customer list modal */
.customer-list-modal .modal-content {
    max-width: 800px;
    width: 90%;
}

.customer-search-box {
    display: flex;
    margin-bottom: 15px;
    position: relative;
}

.customer-search-box input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.customer-search-box input[type="text"]:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.customer-search-box button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.customer-search-box button:hover {
    background-color: #0069d9;
}

/* Make the customers table more responsive */
.customers-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.customers-table th,
.customers-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.customers-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.customers-table tr:hover {
    background-color: #f5f5f5;
}

/* Responsive styles for mobile */
@media screen and (max-width: 600px) {
    .customers-table th:nth-child(3),
    .customers-table td:nth-child(3) {
        display: none; /* Hide address column on small screens */
    }
    
    .customers-table th,
    .customers-table td {
        padding: 8px;
    }
    
    .select-customer-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* Fix modal stacking issues */
#print-bill-modal {
    z-index: 1001; /* Higher z-index to stay on top */
}

#view-all-customers-modal {
    z-index: 1000;
}

/* Prevent multiple modals from showing at once */
.modal.modal-active {
    z-index: 1002; /* Always keep active modal on top */
}

/* Hide inactive modals */
body.modal-open .modal:not(.modal-active) {
    display: none !important;
}

/* Add this CSS to prevent modal stacking */
.customer-modal {
    z-index: 10000; /* Higher than sidebar z-index */
    background: rgba(0,0,0,0.7); /* Darker overlay */
}

/* Add this to prevent body scroll */
body.modal-open {
    overflow: hidden;
}
