/* --- Modal Structure --- */
.dp-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.dp-modal-content {
    background-color: #f8f9fa;
    margin: 3% auto;
    padding: 0;
    border: none;
    width: 1100px;
    max-width: 95%;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
}

.dp-close-modal {
    color: #fff;
    position: absolute;
    right: -40px;
    top: 0;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.dp-close-modal:hover {
    color: #ccc;
}

.dp-loading,
.dp-error {
    padding: 100px;
    text-align: center;
    font-size: 18px;
    color: #666;
}

/* --- Premium Invoice Styles --- */
.dp-invoice-preview {
    background: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    line-height: 1.5;
    padding: 0;
}

.dp-invoice-top-actions {
    background: #f1f1f1;
    padding: 15px 40px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-bottom: 1px solid #ddd;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.dp-invoice-top-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.dp-print-btn {
    background: #fff;
    color: #333;
    border: 1px solid #ccc !important;
}

.dp-download-btn {
    background: #fff;
    color: #333;
    border: 1px solid #ccc !important;
}

.dp-send-btn {
    background: #d62027;
    color: #fff;
}

.dp-invoice-header {
    background: #1a1d2d !important;
    color: #ffffff !important;
    padding: 50px 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dp-header-branding {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    min-height: 60px;
}

.dp-logo-placeholder {
    width: 60px;
    height: 60px;
    background: #d62027;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    border-radius: 4px;
}

.dp-company-info h2 {
    margin: 0;
    padding: 0;
    color: #ffffff !important;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: 1px;
}

.dp-company-info p {
    margin: 0;
    opacity: 0.7;
    font-size: 12px;
}

.dp-tax-invoice-label {
    text-transform: uppercase;
    font-size: 11px;
    color: #d62027;
    letter-spacing: 2px;
    margin-bottom: 10px;
    position: relative;
    padding-left: 20px;
}

.dp-tax-invoice-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 12px;
    height: 1px;
    background: #d62027;
}

.dp-invoice-preview h1 {
    font-size: 38px;
    margin: 0;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.dp-invoice-preview h1 span {
    font-style: italic;
    opacity: 0.5;
    font-weight: 300;
}

.dp-info-group {
    margin-bottom: 25px;
    text-align: right;
}

.dp-info-group label {
    display: block;
    font-size: 10px;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.dp-info-group strong {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}

.dp-info-group p {
    margin: 0;
    font-size: 12px;
    opacity: 0.7;
}

.dp-invoice-num {
    font-size: 28px;
    color: #d62027;
    font-weight: 300;
}

.dp-invoice-summary {
    display: flex;
    padding: 20px 40px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

.dp-summary-item {
    flex: 1;
    border-right: 1px solid #eee;
    padding-left: 20px;
}

.dp-summary-item:last-child {
    border-right: none;
}

.dp-summary-item label {
    display: block;
    font-size: 10px;
    color: #999;
    margin-bottom: 5px;
}

.dp-summary-item span {
    font-size: 14px;
    font-weight: 600;
}

.dp-invoice-billing {
    display: flex;
    padding: 40px;
    gap: 40px;
}

.dp-billing-box {
    flex: 1;
}

.dp-billing-box label {
    display: block;
    font-size: 11px;
    color: #999;
    letter-spacing: 1px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.dp-billing-box strong {
    display: block;
    font-size: 18px;
    margin-bottom: 10px;
}

.dp-billing-box p {
    color: #666;
    font-size: 13px;
    line-height: 1.6;
}

.dp-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.dp-invoice-table th {
    background: #1a1d23;
    color: #fff;
    text-align: left;
    padding: 12px 40px;
    font-size: 11px;
    letter-spacing: 1px;
}

.dp-invoice-table td {
    padding: 20px 40px;
    border-bottom: 1px solid #eee;
}

.dp-item-name {
    display: block;
    font-size: 16px;
    margin-bottom: 5px;
}

.dp-item-desc {
    margin: 0;
    font-size: 12px;
    color: #888;
    display: block;
}

.dp-invoice-footer {
    display: flex;
    padding: 40px;
    background: #fdfdfd;
}

.dp-footer-left {
    flex: 1.5;
}

.dp-footer-right {
    flex: 1;
}

.dp-notes-section {
    margin-bottom: 30px;
}

.dp-notes-section label {
    display: block;
    font-size: 10px;
    color: #aaa;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.dp-notes-section p {
    font-size: 12px;
    color: #666;
    max-width: 300px;
}

.dp-notes-section ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    font-size: 12px;
}

.dp-notes-section li {
    margin-bottom: 5px;
}

.dp-totals {
    background: #fff;
    padding: 0;
}

.dp-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px dotted #eee;
}

.dp-total-row label {
    color: #888;
}

.dp-grand-total {
    background: #1a1d23;
    color: #fff;
    padding: 20px;
    margin-top: 20px;
    margin-right: -40px;
    /* Bleed to the edge */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dp-grand-total label {
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.6;
}

.dp-grand-total span {
    font-size: 32px;
    font-weight: 300;
}

.dp-invoice-bottom-bar {
    padding: 25px 40px;
    background: #fff;
    border-top: 1px solid #eee;
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dp-pull-right {
    float: right;
}

.dp-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    color: #fff;
}

.dp-badge-success {
    background: #e6fffa;
    color: #2d3748;
    border: 1px solid #b2f5ea;
}

/* Text Utils */
.dp-text-right {
    text-align: right;
}

.dp-text-center {
    text-align: center;
}

.dp-text-danger {
    color: #d62027;
}

.dp-font-bold {
    font-weight: bold;
}

/* Print Handling */
@media print {
    body * {
        visibility: hidden;
    }

    #dp-invoice-modal,
    #dp-invoice-modal *,
    .dp-invoice-preview,
    .dp-invoice-preview * {
        visibility: visible;
    }

    #dp-invoice-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background: #fff !important;
    }

    .dp-modal-content {
        margin: 0;
        width: 100%;
        box-shadow: none;
    }

    .dp-invoice-top-actions,
    .dp-close-modal {
        display: none !important;
    }

    .dp-invoice-preview {
        padding: 0;
        margin: 0;
    }
}