/* assets/styles/invoice.css */

/* Invoice form specific styles */
.invoice-form {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.invoice-item-wrapper {
    transition: all 0.3s ease;
    position: relative;
}

.invoice-item-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.invoice-item-wrapper .remove-item-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.invoice-item-wrapper:hover .remove-item-btn {
    opacity: 1;
}

/* Form section headers */
.form-section-header {
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 1.5rem;
}

.form-section-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Custom input styles */
.form-input {
    transition: all 0.2s ease;
}

.form-input:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Totals display */
.totals-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.totals-display .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.totals-display .total-row:last-child {
    border-bottom: none;
    font-size: 1.25rem;
    font-weight: bold;
    padding-top: 1rem;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

/* Animation for adding items */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.invoice-item-wrapper.new-item {
    animation: slideInUp 0.4s ease-out;
}

/* Loading states */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    z-index: 10;
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
}

.error-message::before {
    content: "⚠";
    margin-right: 0.25rem;
}

/* Success states */
.field-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .invoice-item-wrapper {
        padding: 1rem;
    }

    .invoice-item-wrapper .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
        justify-content: center;
    }
}

/* Print styles */
@media print {
    .invoice-form {
        background: white;
    }

    .form-actions,
    .remove-item-btn,
    .add-item-btn {
        display: none !important;
    }

    .invoice-item-wrapper {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* Arabic RTL support */
[dir="rtl"] .invoice-form {
    text-align: right;
}

[dir="rtl"] .form-section-header {
    text-align: right;
}

[dir="rtl"] .totals-display .total-row {
    flex-direction: row-reverse;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .invoice-item-wrapper {
        border-width: 2px;
    }

    .form-input:focus {
        outline: 3px solid #0066cc;
        outline-offset: 2px;
    }
}
