/* تنسيقات خاصة لطباعة الفواتير من الأجهزة المحمولة */

/* تنسيقات عامة لصفحة الطباعة */
.mobile-print-page {
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

.print-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    border: none;
    flex: 1;
}

.mobile-btn i {
    font-size: 0.9rem;
}

.mobile-btn-primary {
    background-color: #2c7be5;
    color: white;
}

.mobile-btn-primary:hover {
    background-color: #1a68d1;
    color: white;
}

.mobile-btn-success {
    background-color: #28a745;
    color: white;
}

.mobile-btn-success:hover {
    background-color: #218838;
    color: white;
}

.mobile-btn-outline {
    background-color: white;
    color: #495057;
    border: 1px solid #ced4da;
}

.mobile-btn-outline:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.mobile-btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* تنسيقات الفاتورة العادية */
.print-area {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.invoice-header {
    text-align: center;
    margin-bottom: 20px;
}

.company-logo img {
    max-width: 100px;
    height: auto;
    margin-bottom: 10px;
}

.company-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #2c3e50;
}

.company-address, .company-phone {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 2px 0;
}

.invoice-title {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.invoice-title h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: #2c3e50;
}

.invoice-number {
    font-size: 0.9rem;
    color: #6c757d;
}

.invoice-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 3px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2c3e50;
}

.invoice-items {
    margin-bottom: 20px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th, .items-table td {
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid #e9ecef;
}

.items-table th {
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

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

.invoice-summary {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-label {
    font-size: 0.9rem;
    color: #495057;
}

.summary-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #2c3e50;
}

.summary-row.total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e9ecef;
}

.summary-row.total .summary-label,
.summary-row.total .summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c7be5;
}

.invoice-notes {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #6c757d;
}

.invoice-signature {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    margin-bottom: 20px;
}

.signature-box {
    width: 45%;
    text-align: center;
}

.signature-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 25px;
}

.signature-line {
    height: 1px;
    background-color: #ced4da;
}

.invoice-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #6c757d;
}

/* تنسيقات الطباعة الحرارية */
.thermal-print-area {
    background-color: white;
    width: 80mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 5mm;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.thermal-header {
    text-align: center;
    margin-bottom: 10px;
}

.thermal-company-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.thermal-company-info {
    font-size: 12px;
    margin-bottom: 3px;
}

.thermal-divider {
    margin: 5px 0;
    overflow: hidden;
    white-space: nowrap;
}

.thermal-title {
    font-size: 14px;
    font-weight: bold;
    margin: 5px 0;
}

.thermal-meta {
    font-size: 12px;
    margin: 3px 0;
    text-align: right;
}

.thermal-items {
    margin: 10px 0;
    text-align: right;
}

.thermal-item-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 5px;
}

.thermal-item {
    margin-bottom: 8px;
}

.thermal-item-name {
    text-align: right;
    margin-bottom: 3px;
    font-weight: bold;
}

.thermal-item-details {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.thermal-summary {
    text-align: right;
    margin: 10px 0;
}

.thermal-summary-row {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
}

.thermal-total {
    font-weight: bold;
    font-size: 14px;
}

.thermal-footer {
    text-align: center;
    margin-top: 15px;
}

.thermal-footer-text {
    margin: 3px 0;
    font-size: 11px;
}

.thermal-barcode {
    margin: 10px 0;
    height: 30px;
    background-color: #f5f5f5;
}

.thermal-cut {
    margin: 10px 0 0 0;
    font-size: 14px;
    letter-spacing: -1px;
}

/* تنسيقات حالة الطباعة */
@media print {
    body {
        margin: 0;
        padding: 0;
        background-color: white;
    }
    
    .print-actions, .mobile-header, .mobile-bottom-nav {
        display: none !important;
    }
    
    .mobile-content {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .print-area, .thermal-print-area {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .thermal-print-content {
        width: 80mm;
        font-size: 12px;
        margin: 0;
        padding: 0;
    }
    
    .mobile-print-page {
        width: 100%;
        margin: 0;
        padding: 0;
    }
}

/* تنسيقات مودال البلوتوث */
.mobile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    max-width: 100%;
    width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.mobile-modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.btn-close::before {
    content: "×";
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.bluetooth-status {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #2c7be5;
    animation: spin 1s linear infinite;
    margin-top: 10px;
}

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

.bluetooth-devices {
    display: none;
}

.device-list-header {
    font-weight: 600;
    margin-bottom: 10px;
}

.device-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
}

.device-item:last-child {
    border-bottom: none;
}

.device-name {
    font-size: 0.95rem;
}

.bluetooth-message {
    display: none;
    padding: 15px;
    text-align: center;
}

.bluetooth-message-success {
    color: #28a745;
    background-color: #d4edda;
    border-radius: 5px;
    padding: 10px;
}

.bluetooth-message-error {
    color: #dc3545;
    background-color: #f8d7da;
    border-radius: 5px;
    padding: 10px;
}

.bluetooth-message-warning {
    color: #ffc107;
    background-color: #fff3cd;
    border-radius: 5px;
    padding: 10px;
}

body.modal-open {
    overflow: hidden;
}
