﻿:root {
    --primary: #047857;
    --dark: #1e293b;
    --gray: #64748b;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 40px;
    color: #1e293b;
    background: #f1f5f9;
}

/* Floating Header Wrapper - Adjusted for Spacing */
.nav-wrapper {
    position: relative; /* Changed to relative to push content down */
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 25px; /* Gap from the very top of the browser */
    margin-bottom: 40px; /* The GAP between the navigation and your invoice */
}

/* The Stylish Pill Container */
.nav-floating-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #ffffff;
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
    /* Stronger shadow to make it "pop" from the background */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Hover effect for the whole container */
.nav-floating-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
}

/* Button & Link styles remain the same but with slightly larger padding for style */
.nav-link-back, .nav-link-records {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
}
/* Dashboard Link Style */
.nav-link-back {
    color: #64748b;
}

.nav-link-back:hover {
    color: #22c55e; /* Indigo */
    background: rgba(34, 197, 94, 0.15);
}

/* Logout Button Style */
.nav-btn-logout {
    color: #f43f5e; /* Rose/Red */
}

.nav-btn-logout:hover {
    color: #be123c;
    background: rgba(244, 63, 94, 0.08);
}

.nav-link-back .icon, .nav-btn-logout .icon {
    font-size: 16px;
    line-height: 1;
}

/* Navigation Helpers */
.nav-link-back {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
}

.nav-btn-logout {
    background: transparent;
    border: none;
    color: #f43f5e;
    font-weight: 600;
    cursor: pointer;
}

.nav-link-records {
    color: #64748b;
    text-decoration: none !important;
}

.nav-link-records:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
}

.nav-link-back .icon, .nav-link-records .icon {
    font-size: 16px;
    line-height: 1;
}

/* Print handling */
@media print {
    .nav-wrapper {
        display: none !important;
    }
}

.invoice-box {
    max-width: 900px;
    margin: auto;
    background: white;
    padding: 30px 50px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Header Layout: Left Logo, Right Double Address */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.logo-section {
    /* Increased from 30% to 40% to give the logo more horizontal "breathing room" */
    width: 40%;
}

.logo-section img {
    /* Increased from 180px to 240px (or adjust as needed) */
    max-width: 240px;
    min-width: 150px;
    height: auto;
    display: block;
    /* Keeps the logo crisp on high-res screens */
    object-fit: contain;
}

@media print {
    .logo-section img {
        /* Ensuring the logo looks sharp and appropriately sized on paper */
        max-width: 220px;
    }
}

.address-section {
    width: 65%;
    text-align: right;
    font-family: 'Inter', sans-serif;
}

.address-section h2 {
    margin: 0 0 15px 0;
    color: var(--dark);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.address-grid {
    display: flex;
    justify-content: flex-end;
    align-items: stretch; /* Makes divider full height */
    gap: 20px;
    margin-bottom: 0px;
}

.office-block {
    text-align: right;
}

.office-block strong {
    color: var(--primary); /* Use your green for labels */
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 6px;
    display: block;
}

.office-block span {
    font-size: 12px;
    color: var(--gray);
    line-height: 1.4;
    display: block;
}

/* The Stylish Divider */
.divider {
    width: 1px;
    background: #e2e8f0;
    margin: 5px 0;
}

.contact-footer {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 6px 0;
    border-top: 1px solid #f1f5f9;
    color: var(--dark);
    font-size: 12px;
    width: 100%;
}

.contact-item b {
    color: var(--gray);
    font-weight: 600;
    margin-right: 4px;
}

.dot {
    color: #cbd5e1;
    font-size: 16px;
}

@media print {
    .contact-footer {
        font-size: 11px;
        border-top: 1px solid #cbd5e1 !important;
    }
}

.contact-footer {
    width: 100%;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.contact-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    /* This is the magic line that prevents the wrap */
    white-space: nowrap;
    flex-wrap: nowrap;
}

.contact-item {
    font-size: 13px;
    /*            color: #000000 !important;*/
    font-weight: 600;
    /* Prevents the browser from squeezing the text */
    flex-shrink: 0;
}

.dot {
    margin: 0 10px;
    color: #cbd5e1;
}

@media print {
    .address-section {
        /* Give more room to the section during print */
        width: 75% !important;
    }

    .contact-item {
        /* Slightly smaller font for print ensures it fits the paper width */
        font-size: 10.5px !important;
    }

    .contact-row {
        display: flex !important;
        justify-content: flex-end !important;
    }
}

.meta-row {
    display: flex;
    gap: 40px;
    padding: 6px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 15px;
    font-size: 13px;
}

/* Apply your existing input style to the new select dropdown */
.meta-row input,
.type-select {
    border: none;
    font-weight: 600;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    background: transparent;
}

.meta-row input {
    width: 140px;
}

/* Specifically for the dropdown to look like plain text */
.type-select {
    cursor: pointer;
    appearance: none; /* Removes the default arrow */
    -webkit-appearance: none;
    color: inherit;
    padding: 0;
    margin: 0;
}

/* Subtle hover effect for the user */
.type-select:hover {
    color: #000;
}

@media print {
    /* Ensures the dropdown arrow is hidden on the final PDF */
    .type-select {
        appearance: none;
        -webkit-appearance: none;
    }
}

/* This is the new parent that puts the status on the right */
.bill-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

/* These stay exactly as you had them originally */
.bill-to {
    flex: 1; /* Takes up the left side */
}

.bill-to label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.bill-to textarea {
    width: 100%;
    border: none;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    border-bottom: 1px solid #f1f5f9;
}

.status-box {
    width: 180px;
    text-align: right;
}

.status-box label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: #64748b; /* Or your --primary variable */
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* Screen Styles */
.status-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    font-size: 16px;
    font-weight: 800;
    text-align: right;
    text-transform: uppercase;
    outline: none;
    padding: 5px 0;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    /* Small arrow for screen only */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 18px;
}

.status-input option {
    background-color: white;
    color: #1e293b;
    font-weight: 600;
}

/* Print Styles */
@media print {
    .status-input {
        background-image: none !important; /* Removes arrow on print */
        border-bottom: none !important; /* Removes underline on print */
        padding-right: 0 !important;
        color: inherit;
    }

    /* Hide the "SELECT STATUS" text on print if nothing was chosen */
    .status-input option[value=""]:checked {
        color: transparent !important;
    }
}
@media print {
    .bill-section {
        display: flex !important;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    text-align: left;
    padding: 10px;
    background: #f8fafc;
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    border-bottom: 2px solid #edf2f7;
}

td {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.col-amount {
    width: 180px;
    text-align: right;
}

input.line-input {
    border: 1px solid #e2e8f0;
    padding: 8px;
    border-radius: 4px;
    width: 95%;
    font-size: 14px;
}

input.amount-input {
    text-align: right;
    font-weight: 600;
    width: 120px;
}

.no-print {
    margin-top: 25px;
    display: flex;
    gap: 12px;
}

.btn {
    cursor: pointer;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
}

.btn-add {
    background: #f1f5f9;
    color: var(--dark);
}

.btn-print {
    background: var(--dark);
    color: white;
    margin-left: auto;
}

.remove-btn {
    color: #ef4444;
    background: none;
    font-size: 20px;
    cursor: pointer;
    border: none;
}

@media print {
    .no-print, .remove-btn {
        display: none !important;
    }

    body {
        background: white;
        margin: 0;
    }

    .invoice-box {
        box-shadow: none;
        border: none;
        width: 100%;
        padding: 0;
    }

    textarea, input {
        border: none !important;
        outline: none !important;
    }
}

table {
    width: 100%;
    table-layout: fixed; /* Prevents resizing */
    border-collapse: collapse;
    margin-top: 10px;
}

/* Define exact column widths */
th:nth-child(1) {
    width: 65%;
}
/* Description */
th:nth-child(2) {
    width: 25%;
}
/* Amount */
th:nth-child(3) {
    width: 10%;
}
/* Delete Button */

th, td {
    padding: 6px 10px; /* Reduced padding for tighter look */
    border: 1px solid #cbd5e1;
    vertical-align: middle;
}

.remove-btn {
    color: #ef4444;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    display: block;
    margin: 0 auto;
}

.remove-btn:hover {
    color: #b91c1c;
}

/* Remove internal borders but keep outer vertical borders */
#item-list tr td {
    border-bottom: none;
    border-top: none;
}

/* Optional: Keep the very last row of the item list with a bottom border to close the section */
#item-list tr:last-child td {
    border-bottom: 1px solid #cbd5e1;
}

@media print {
    .payment-info {
        background-color: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
}

.complaint-note {
    margin-top: 15px;
    margin-bottom: 0px;
    padding: 10px 0px 10px 10px;
    background-color: #f1f5f9; /* Professional Grey */
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: flex-start; /* Keeps icon at the top line */
    gap: 10px;
}

.footer-icon {
    flex-shrink: 0;
    color: #64748b;
    margin-top: 3px; /* Nudges icon to align with the first line of text */
}

.footer-text-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legal-text {
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
}

.contact-details {
    font-size: 13px;
    color: #475569;
}

.complaint-note strong {
    color: #000000;
    margin-left: 2px;
}



@media print {
    .complaint-note {
        border: none;
        background-color: #f1f5f9 !important; /* Keep the grey box in print */
        padding: 10px 0px 10px 10px;
        /* CRITICAL: Removed white-space nowrap so it fits on paper */
    }

    .legal-text, .contact-details {
        font-size: 11px !important;
        color: #000 !important;
    }

    .footer-icon {
        color: #000 !important;
    }
}

.payment-footer {
    margin-top: 0px;
    margin-bottom: 0px;
    padding-top: 10px;
    padding-bottom: 5px;
}

.url-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: sans-serif;
}

.pay-icon {
    color: #047857; /* Your primary green */
    flex-shrink: 0;
}

.pay-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.pay-url-text {
    font-size: 14px;
    font-weight: 700;
    color: #22c55e;
    text-decoration: none;
    /*border-bottom: 1px solid #cbd5e1;*/ /* Subtle underline for the URL */
    padding-bottom: 1px;
}

/* Ensure colors and underlines show when printed */
@media print {

    .pay-url-text {
        color: #22c55e !important;
        -webkit-print-color-adjust: exact;
    }

    .pay-icon {
        color: #000000 !important;
    }
}

@media print {
    /* Hides the calendar icon on the printed PDF */
    #invoiceDate::-webkit-calendar-picker-indicator {
        display: none !important;
        -webkit-appearance: none;
    }

    /* Hides the 'x' clear button on the printed PDF */
    #invoiceDate::-webkit-clear-button {
        display: none !important;
        -webkit-appearance: none;
    }

    /* Optional: Ensures the input has no border or background on paper */
    #invoiceDate {
        border: none !important;
        background: transparent !important;
        appearance: none;
        -moz-appearance: textfield; /* For Firefox */
    }
}

@media print {
    /* 1. Color and Table Fixes */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 2. Page Setup: Margin 0 hides browser URL/Title */
    @page {
        margin: 0;
    }

    body {
        /* Padding creates the "fake" margin so content doesn't touch the edge */
        padding: 1.5cm 1.5cm 1.5cm 1.5cm;
        background: white;
        counter-reset: page;
    }

    /* 3. The Page Number Fix */
    .page-footer {
        display: block !important;
        position: fixed;
        bottom: 0cm; /* Sits inside the body padding */
        left: 0;
        right: 0;
        text-align: center;
        font-size: 11px;
        color: #64748b;
        background: white;
        z-index: 9999;
    }

    .page-footer::after {
        counter-increment: page;
        content: "Page " counter(page);
    }

    /* 4. STOP SPLITTING: Prevent complaint note and table rows from cutting in half */
    .complaint-note,
    tr,
    .meta-row {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .no-print {
        display: none !important;
    }
}

/* Hide footer on screen */
.page-footer {
    display: none;
}

@media print {

    .logout-btn{
        display: none;
    }

    /* The Master Wrapper */
    .footer-group {
        display: block !important;
        /* Forces everything (Table + Payment + Note) to stay on one page */
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        margin-top: 20px;
        width: 100% !important;
    }

    /* Standardizes behavior for items inside the group */
    .footer-group table,
    .payment-footer,
    .complaint-note {
        /* Prevents the individual items from splitting internally */
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        /* Prevents a page break from occurring BETWEEN these elements */
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* Ensures the main items table (above the footer) doesn't leave the footer alone */
    #main-items-table {
        widows: 5 !important;
        orphans: 5 !important;
    }

    /* Clean up table lines for print */
    .footer-group table {
        border-collapse: collapse !important;
        margin-bottom: 10px;
    }
}


