/* assets/css/invoice_style.css */

/* --- General Layout --- */
.new-invoice {
    background: #525659;
    /* Contrast background for viewer */
    min-height: 100vh;
    padding: 20px 0;
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
}

#invoice-preview-modal .modal-content {
    max-width: 210mm;
    /* A4 width */
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: white;
    min-height: 297mm;
    /* A4 Height */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* --- Document Form (The Actual Page) --- */
.document-form {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px 20px;
    /* Small Margin for print safety */
    background: white;
    box-sizing: border-box;
}

/* --- Compact Header --- */
.details-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
}

.cliven-info,
#document-details {
    background: #ffffff;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.cliven-info {
    flex: 1.5;
    /* More space for Company/Bill To */
}

#document-details {
    flex: 1;
    /* Less space for Inv No */
    text-align: right;
}

/* Typography Compact */
h1,
h2,
h3,
h4,
h5 {
    margin: 0;
    padding: 0;
    line-height: 1.2;
    color: #000;
}

p {
    margin: 0;
    padding: 0;
    line-height: 1.3;
    font-size: 13px;
    color: #000;
}

.page-title {
    font-size: 16px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.section-title {
    font-size: 13px;
    font-weight: 800;
    color: #000;
    margin-bottom: 2px;
    padding-bottom: 2px;
    border-bottom: 1px solid #ccc;
    text-transform: uppercase;
}

.input-field-with-prefix input[name="invoice_no"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* --- Items Table Compact --- */
#line-items {
    background: #ffffff;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 1rem;
    border: none;
}

#line-items table {
    width: 100%;
    border-collapse: collapse;
    /* Collapse borders for print */
    border-spacing: 0;
    margin-bottom: 0;
}

#line-items th {
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    color: #000;
    font-weight: 700;
    padding: 4px 6px;
    border-bottom: 2px solid #000;
    border-top: 2px solid #000;
    background-color: transparent;
}

#line-items td {
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    color: #000;
    font-size: 13px;
}

/* --- Add Item Picker --- */
.item-picker {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    transition: border-color 0.2s;
}

.item-picker:hover {
    border-color: #94a3b8;
}

.item-picker .field {
    margin-bottom: 0;
}

.item-picker label {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}

.item-picker input,
.item-picker select {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.btn-add-item {
    background-color: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    height: 38px;
    width: 100%;
    transition: background-color 0.2s;
}

.btn-add-item:hover {
    background-color: #4f46e5;
}

/* --- Compact Summary --- */
#summary {
    display: flex;
    gap: 1rem;
    margin-top: 10px;
}

.adjustments {
    flex: 1;
    display: none;
    /* Hide adjustments/checkboxes in print view usually */
}

/* Totals Section */
.totals {
    width: 50%;
    margin-left: auto;
    /* Push to right */
    background: #ffffff;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.totals .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 13px;
    padding-bottom: 2px;
    border-bottom: 1px dotted #eee;
}

.totals .row label {
    color: #000;
    font-weight: 500;
}

.totals .row .amount {
    font-weight: 600;
    color: #000;
    font-size: 13px;
}

#total.row {
    border-top: 2px solid #000;
    padding-top: 6px;
    margin-top: 6px;
    border-bottom: none;
}

#total.row label {
    font-size: 13px;
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
}

#total.row .amount {
    font-size: 14px;
    font-weight: 800;
    color: #000;
}

/* --- Footer Buttons --- */
.buttons.sticked {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 1rem 2rem;
    border-top: 1px solid #cbd5e1;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    z-index: 100;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-save {
    background: #6366f1;
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-save:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
}

.btn-cancel {
    background: #fff;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f1f5f9;
    color: #334155;
}

/* --- Custom Searchable Dropdown --- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-input {
    width: 100%;
    cursor: pointer;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
    animation: fadeIn 0.1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-dropdown.active {
    display: block;
}

.custom-select-search {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    position: sticky;
    top: 0;
}

.custom-select-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
}

.custom-select-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.custom-select-option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #334155;
    transition: background 0.1s;
}

.custom-select-option:hover {
    background: #f1f5f9;
    color: #6366f1;
}

/* Responsive */
@media (max-width: 992px) {
    .details-wrapper {
        flex-direction: column;
    }

    #summary {
        flex-direction: column;
    }

    .totals {
        flex: 1;
    }

    .item-picker .row>div {
        margin-bottom: 1rem;
    }
}