/* Invoice-specific styles */

.invoice-summary {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    padding-right: 0;
    overflow-x: auto;
}

/* Line item wrapper and card styles */
.line-item-wrapper {
    position: relative;
}

.line-item-card {
    transition: border-color var(--transition-fast);
}

.line-item-card:hover {
    border-color: var(--accent-purple);
}


/* Table row styling for line items */
.table tbody tr {
    background: var(--dark-card);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child {
    border-bottom: none;
}

/* Input styling within table cells */
.table input[type="text"],
.table input[type="number"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
}

.table input[type="text"]:focus,
.table input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Hide number input spinner arrows */
.table input[type="number"]::-webkit-outer-spin-button,
.table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.summary-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    min-width: 0;
}

.summary-row>span:first-child,
.summary-row>div:first-child {
    padding-left: 0.75rem;
    min-width: 0;
}

.summary-row>span:last-child {
    text-align: right;
    padding-right: 0.75rem;
    white-space: nowrap;
}

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

.total-row {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-purple);
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border-color);
}

.line-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    position: relative;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.line-item:hover {
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.05);
}

.line-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.line-item-number {
    font-weight: 600;
    color: var(--accent-purple);
}

.remove-item-btn {
    background: rgba(245, 87, 108, 0.1);
    color: var(--accent-pink);
    border: 1px solid rgba(245, 87, 108, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.remove-item-btn:hover {
    background: rgba(245, 87, 108, 0.2);
    border-color: var(--accent-pink);
}

.line-item-grid {
    display: grid;
    grid-template-columns: 70% 5% 12.5% 12.5%;
    gap: var(--spacing-xs);
    align-items: end;
}

.line-total {
    text-align: right;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-blue);
    padding: 0.75rem;
}

/* Invoice info grid spacing reduction */
.invoice-info-grid {
    gap: var(--spacing-xs) !important;
}

/* General grid spacing reduction */
.card .grid.grid-2.gap-3 {
    gap: var(--spacing-xs);
}

/* Client card shading */
.client-details-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

/* Client card animations — opacity+translate only (no max-height — causes layout thrashing) */
#clientDetails {
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.5;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--dark-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.invoice-summary {
    padding-right: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .line-item-grid {
        grid-template-columns: 1fr;
    }

    .line-total {
        justify-content: flex-start;
        padding-top: 0;
        margin-top: var(--spacing-sm);
    }
}