/* =====================================================
   Invoice Generator - Horizontal Split Layout
   ===================================================== */

/* الحاوية الرئيسية - تخطيط أفقي */
.invoice-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 80px);
    align-items: flex-start;
}

/* الجانب الأيسر - نموذج الإدخال */
.invoice-form {
    flex: 1;
    width: 50%;
    background: white;
    border-radius: 24px;
    padding: 28px;
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

/* الجانب الأيمن - المعاينة */
.invoice-preview {
    flex: 1;
    width: 50%;
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border, #e5e7eb);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    max-height: calc(100vh - 60px);
}

/* شريط التمرير للنموذج */
.invoice-form::-webkit-scrollbar {
    width: 6px;
}

.invoice-form::-webkit-scrollbar-track {
    background: var(--bg-light, #f9fafb);
    border-radius: 10px;
}

.invoice-form::-webkit-scrollbar-thumb {
    background: var(--border, #e5e7eb);
    border-radius: 10px;
}

/* تنسيق المعاينة */
.preview-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 100%);
    padding: 18px 24px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.preview-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    color: var(--text, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-badge {
    background: var(--primary, #00008B);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 500;
}

.preview-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-light, #f9fafb);
}

/* =====================================================
   Responsive - شاشات متوسطة وصغيرة
   ===================================================== */
@media (max-width: 1024px) {
    .invoice-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .invoice-form,
    .invoice-preview {
        width: 100%;
        max-height: none;
    }
    
    .invoice-form {
        order: 1;
    }
    
    .invoice-preview {
        order: 2;
    }
}

@media (max-width: 768px) {
    .invoice-container {
        padding: 12px;
        gap: 16px;
    }
    
    .invoice-form {
        padding: 20px;
    }
    
    .preview-header {
        padding: 14px 16px;
    }
    
    .preview-content {
        padding: 16px;
    }
}

/* =====================================================
   باقي التنسيقات (كما هي - تبقى كما سبق)
   ===================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text, #111827);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    margin-right: 6px;
    color: var(--primary, #00008B);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary, #00008B);
    box-shadow: 0 0 0 3px rgba(0, 0, 139, 0.08);
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

.form-group.half {
    flex: 1;
}

/* جدول العناصر */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid var(--border, #e5e7eb);
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.items-table th,
.items-table td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.items-table th {
    background: var(--bg-light, #f9fafb);
    font-weight: 600;
    font-size: 12px;
}

.items-table input,
.items-table select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 13px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--error, #ef4444);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #fee2e2;
    transform: scale(1.05);
}

.btn-add {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.totals {
    background: var(--bg-light, #f9fafb);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.total-row.grand {
    border-top: 2px solid var(--border, #e5e7eb);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary, #00008B);
}

.btn-generate {
    background: linear-gradient(135deg, #00008B 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    margin-top: 20px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 139, 0.3);
}

.file-input {
    padding: 8px 0 !important;
}

.preview-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    min-height: 400px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #9ca3af;
    text-align: center;
}

.preview-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}