/* Main Invoice Styling */
:root {
    --primary-color: #001f3f;
    /* Dark Navy matches reference */
    --secondary-color: #ffffff;
    --text-color: #333333;
    --light-text: #ffffff;
    --border-color: #e0e0e0;
}

body {
    background-color: #f5f7fa;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    font-family: 'Inter', sans-serif;
}

.invoice-wrapper {
    max-width: 210mm;
    margin: 0 auto;
    background: white;
    min-height: 297mm;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header Section */
.invoice-header-bg {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 40px 50px 80px;
    position: relative;
    /* Smooth wave curve similar to reference - White text on Dark Blue */
    clip-path: ellipse(130% 100% at 30% 0%);
}

.invoice-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.company-details {
    max-width: 50%;
}

.company-details h2 {
    font-size: 24px;
    /* Reduced from 32px/huge */
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    color: #fff;
    /* Ensure white text */
    line-height: 1.2;
}

.company-details p {
    opacity: 0.9;
    margin: 5px 0 0;
    font-size: 13px;
    color: #e0e0e0;
    /* Light grey for tagline */
}

.invoice-title {
    text-align: right;
}

.invoice-title h1 {
    font-size: 36px;
    /* Reduced from 48px/56px */
    font-weight: 800;
    margin: 0;
    line-height: 1;
    letter-spacing: 1px;
    color: #fff;
    /* Ensure white text */
}

.invoice-meta {
    margin-top: 20px;
    text-align: right;
    color: #fff;
}

.meta-row {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 4px;
    font-size: 13px;
    opacity: 1;
}

.meta-label {
    font-weight: 400;
    min-width: 60px;
    text-align: left;
    opacity: 0.9;
}

.meta-value {
    font-weight: 600;
    min-width: 90px;
    text-align: right;
}

/* Body Content */
.invoice-body {
    padding: 20px 50px;
}

.client-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    margin-top: 10px;
}

.payment-info,
.invoice-to {
    width: 48%;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    /* Dark labels like reference */
    margin-bottom: 8px;
    text-transform: capitalize;
    /* "Payment Info:" not all caps */
}

.info-group p {
    margin-bottom: 3px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}

.info-group strong {
    color: #333;
    font-weight: 600;
    font-size: 13px;
}

/* Table */
.invoice-table-container {
    margin-bottom: 20px;
}

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

.invoice-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: capitalize;
}

.invoice-table th:last-child {
    text-align: right;
}

.invoice-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #333;
}

.invoice-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.invoice-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Summary */
.invoice-summary-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.invoice-summary {
    width: 300px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #555;
}

/* Total Row - Dark Blue Flag Style */
.summary-row:last-child {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 14px;
    border: none;
    margin-top: 10px;
    padding: 10px 15px;
}

/* Footer Content Section (Terms + Signature) */
.invoice-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 40px;
    padding-bottom: 120px;
    /* Space for the absolute footer bg */
    position: relative;
    z-index: 10;
}

.terms-section {
    font-size: 10px;
    color: #777;
    max-width: 55%;
    line-height: 1.4;
}

.signature-section {
    text-align: center;
    min-width: 180px;
    position: static;
    margin-left: auto;
}

.signature-line {
    border-top: 1px solid #ccc;
    width: 100%;
    padding-top: 8px;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

/* Footer Background */
.invoice-footer-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    /* Reduced height */
    background-color: var(--primary-color);
    clip-path: ellipse(110% 80% at 80% 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    z-index: 1;
}

/* Action Buttons (Screen Only) */
@media screen {
    .invoice-wrapper {
        margin: 30px auto;
        border-radius: 8px;
    }

    .invoice-actions {
        max-width: 210mm;
        margin: 0 auto 20px;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        padding-right: 15px;
    }
}

/* Print Only */
@media print {

    .dashboard-main-body,
    body {
        background: white;
        margin: 0;
        padding: 0;
    }

    .invoice-actions,
    .sidebar,
    .header,
    .mobile-menu {
        display: none !important;
    }

    .invoice-wrapper {
        box-shadow: none;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    @page {
        margin: 0 0 20px 0;
        /* Add bottom margin for footer */
        size: auto;
    }
}