/**
 * Invoice Generator CSS
 * Professional invoice form styling for WriteXO
 */

/* Container */
.invoice-generator-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: var(--content-bg, #ffffff);
}

.invoice-wrapper {
    background: var(--content-bg, #ffffff);
    border: 1px solid var(--border-color, #dddddd);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Header Section */
.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color, #dddddd);
}

.invoice-logo-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.invoice-logo-upload {
    text-align: center;
    padding: 20px;
    border: 2px dashed var(--border-color, #dddddd);
    border-radius: 6px;
    background: var(--sidebar-bg, #f5f5f5);
}

.invoice-logo-btn {
    padding: 10px 20px;
    background: var(--accent-color, #50ca59);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.invoice-logo-btn:hover {
    background: var(--accent-hover, #3da449);
}

.invoice-logo-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary, #696969);
}

.invoice-logo-preview {
    text-align: center;
}

.invoice-logo-preview img {
    max-width: 200px;
    max-height: 80px;
    display: block;
    margin: 0 auto 10px;
    border: 1px solid var(--border-color, #dddddd);
    border-radius: 4px;
}

.invoice-logo-remove {
    padding: 6px 12px;
    background: var(--status-danger, #ff3b30);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.invoice-logo-remove:hover {
    background: var(--status-danger-hover, #e12c23);
}

.invoice-meta-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invoice-field {
    display: flex;
    flex-direction: column;
}

.invoice-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #696969);
    margin-bottom: 4px;
}

.invoice-input,
.invoice-textarea,
.invoice-select {
    padding: 8px 10px;
    border: 1px solid var(--border-color, #dddddd);
    border-radius: 4px;
    font-size: 13px;
    background: var(--content-bg, #ffffff);
    color: var(--text-primary, #333333);
    transition: border-color 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.invoice-input:focus,
.invoice-textarea:focus,
.invoice-select:focus {
    outline: none;
    border-color: var(--accent-color, #50ca59);
}

/* Party Information */
.invoice-parties {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--sidebar-bg, #f5f5f5);
    border-radius: 6px;
}

.invoice-party h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333333);
    margin: 0 0 12px 0;
}

.invoice-party .invoice-field {
    margin-bottom: 8px;
}

.invoice-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary, #333333);
    margin-bottom: 12px;
    cursor: pointer;
}

.invoice-checkbox input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Line Items Table */
.invoice-line-items {
    margin-bottom: 30px;
}

.invoice-line-items table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.invoice-line-items th {
    text-align: left;
    padding: 10px;
    background: var(--sidebar-bg, #f5f5f5);
    border: 1px solid var(--border-color, #dddddd);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333333);
}

.invoice-line-items td {
    padding: 8px 10px;
    border: 1px solid var(--border-color, #dddddd);
    vertical-align: middle;
}

.invoice-line-items .invoice-input {
    width: 100%;
    padding: 6px 8px;
    margin: 0;
}

.invoice-amount {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary, #333333);
    font-size: 14px;
}

.invoice-remove-item {
    padding: 4px 8px;
    background: transparent;
    color: var(--status-danger, #ff3b30);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.invoice-remove-item:hover {
    background: rgba(255, 59, 48, 0.1);
}

.add-line-item-btn {
    padding: 8px 16px;
    background: var(--accent-color, #50ca59);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.add-line-item-btn:hover {
    background: var(--accent-hover, #3da449);
}

/* Footer Sections */
.invoice-footer-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.invoice-notes label,
.invoice-terms label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333333);
    margin-bottom: 6px;
}

.invoice-textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

/* Totals Section */
.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
}

.invoice-totals-grid {
    width: 400px;
    background: var(--sidebar-bg, #f5f5f5);
    padding: 20px;
    border-radius: 6px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #dddddd);
    font-size: 14px;
}

.total-row:last-child {
    border-bottom: none;
}

.total-row span:first-child {
    color: var(--text-secondary, #696969);
}

.total-row .invoice-input {
    width: 120px;
    text-align: right;
}

.total-row.total-main {
    border-top: 2px solid var(--border-color, #dddddd);
    font-weight: 600;
    font-size: 16px;
    margin-top: 8px;
    padding-top: 14px;
}

.total-row.total-balance {
    font-weight: 700;
    font-size: 18px;
    color: var(--accent-color, #50ca59);
    border-bottom: 2px solid var(--border-color, #dddddd);
    padding-bottom: 14px;
}

.total-value {
    font-weight: 600;
    color: var(--text-primary, #333333);
}

.invoice-tax-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border-color, #dddddd);
    border-radius: 3px;
    text-align: center;
    background: var(--content-bg, #ffffff);
    color: var(--text-primary, #333333);
    font-size: 13px;
}

.invoice-tax-input:focus {
    outline: none;
    border-color: var(--accent-color, #50ca59);
}

/* Currency Selector */
.invoice-currency {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--sidebar-bg, #f5f5f5);
    border-radius: 6px;
}

.invoice-currency label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #333333);
}

.invoice-currency .invoice-select {
    width: 200px;
}

/* Actions */
.invoice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color, #dddddd);
}

.invoice-download-btn {
    padding: 12px 24px;
    background: var(--accent-color, #50ca59);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.invoice-download-btn:hover {
    background: var(--accent-hover, #3da449);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(80, 202, 89, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .invoice-generator-container {
        padding: 10px;
    }

    .invoice-wrapper {
        padding: 20px 15px;
    }

    .invoice-header,
    .invoice-parties,
    .invoice-footer-sections {
        grid-template-columns: 1fr;
    }

    .invoice-totals-grid {
        width: 100%;
    }

    .invoice-line-items table {
        font-size: 12px;
    }

    .invoice-line-items th,
    .invoice-line-items td {
        padding: 6px;
    }

    .invoice-line-items th:nth-child(2),
    .invoice-line-items th:nth-child(3),
    .invoice-line-items td:nth-child(2),
    .invoice-line-items td:nth-child(3) {
        display: none;
    }
}

/* Dark Mode Support */
body.dark .invoice-generator-container,
body.dark .invoice-wrapper {
    background: #1e1e1e;
    border-color: #444;
}

body.dark .invoice-input,
body.dark .invoice-textarea,
body.dark .invoice-select,
body.dark .invoice-tax-input {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

body.dark .invoice-line-items th {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

body.dark .invoice-line-items td {
    border-color: #444;
}

body.dark .invoice-checkbox,
body.dark .invoice-notes label,
body.dark .invoice-terms label,
body.dark .invoice-currency label,
body.dark .invoice-party h4 {
    color: #ddd;
}

body.dark .invoice-amount,
body.dark .total-value {
    color: #fff;
}

body.dark .invoice-parties,
body.dark .invoice-totals-grid,
body.dark .invoice-currency {
    background: #2a2a2a;
}

body.dark .invoice-logo-upload {
    background: #2a2a2a;
    border-color: #444;
}

body.dark .total-row {
    border-bottom-color: #444;
}

body.dark .total-row.total-main,
body.dark .total-row.total-balance,
body.dark .invoice-header,
body.dark .invoice-actions {
    border-color: #444;
}
