/* NovaFlow Invoice Builder Styles */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazir-Regular.ttf') format('truetype');
    font-display: swap;
}

.novaflow-container {
    font-family: 'Vazir', Tahoma, sans-serif;
    direction: rtl;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    max-width: 900px;
    margin: 30px auto;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.novaflow-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.novaflow-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.novaflow-section h3 {
    margin-top: 0;
    color: #0073e6;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.novaflow-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.novaflow-input:focus {
    border-color: #0073e6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 230, 0.2);
}

.novaflow-input.error {
    border-color: #dc3545;
}

.novaflow-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #fff;
}

.novaflow-table th,
.novaflow-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
}

.novaflow-table th {
    background: #f5f5f5;
    font-weight: bold;
    color: #222;
    position: sticky;
    top: 0;
}

.novaflow-table tr:hover {
    background-color: #f9f9f9;
}

.novaflow-btn {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #0073e6;
    color: #fff;
    margin: 10px 5px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.novaflow-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.novaflow-btn.novaflow-pdf {
    background: #28a745;
}

.novaflow-btn.novaflow-pdf:hover {
    background: #218838;
}

.novaflow-btn.novaflow-remove {
    background: #dc3545;
    padding: 5px 10px;
    font-size: 12px;
}

.novaflow-btn.novaflow-remove:hover {
    background: #c82333;
}

.novaflow-sum {
    font-weight: bold;
    margin: 15px 0;
    font-size: 16px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.novaflow-sum span {
    color: #0073e6;
    font-size: 18px;
}

.novaflow-sig-canvas {
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: crosshair;
    width: 200px;
    height: 100px;
    background: #fff;
    transition: width 0.3s ease-in-out, height 0.3s ease-in-out;
}

.novaflow-sig-canvas:hover {
    width: 400px;
    height: 200px;
}

.novaflow-clear-sig {
    margin-right: 10px;
    padding: 5px 10px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.novaflow-clear-sig:hover {
    background: #c82333;
}

/* Responsive for phone */
@media (max-width: 768px) {
    .novaflow-container {
        padding: 15px;
        margin: 10px;
        border-radius: 8px;
    }
    
    .novaflow-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .novaflow-section {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .novaflow-section h3 {
        font-size: 16px;
    }
    
    .novaflow-input {
        font-size: 16px; /* جلوگیری از زوم در iOS */
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .novaflow-btn {
        width: 100%;
        margin: 5px 0;
        justify-content: center;
    }
    
    .novaflow-table {
        overflow-x: auto;
        display: block;
        white-space: nowrap;
        font-size: 14px;
    }
    
    .novaflow-table thead, 
    .novaflow-table tbody, 
    .novaflow-table th, 
    .novaflow-table td, 
    .novaflow-table tr {
        display: block;
    }
    
    .novaflow-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .novaflow-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 5px;
    }
    
    .novaflow-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
        white-space: normal;
    }
    
    .novaflow-table td:before {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #0073e6;
    }
    
    .novaflow-table td:nth-of-type(1):before { content: "نام کالا یا خدمات"; }
    .novaflow-table td:nth-of-type(2):before { content: "شرح"; }
    .novaflow-table td:nth-of-type(3):before { content: "تعداد"; }
    .novaflow-table td:nth-of-type(4):before { content: "قیمت واحد"; }
    .novaflow-table td:nth-of-type(5):before { content: "جمع"; }
    .novaflow-table td:nth-of-type(6):before { content: "حذف"; }
    
    .novaflow-sig-canvas {
        width: 100%;
        max-width: 300px;
        height: 150px;
    }
    
    .novaflow-sum {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Print-specific styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .invoice-print, 
    .invoice-print * {
        visibility: visible;
    }
    
    .invoice-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 20mm;
        box-shadow: none;
        border: none;
        font-size: 12pt;
        direction: rtl;
    }
    
    .invoice-print header {
        border-bottom: 2px solid #ddd;
        padding-bottom: 10mm;
        margin-bottom: 10mm;
    }
    
    .invoice-print table {
        page-break-inside: avoid;
        width: 100%;
        border-collapse: collapse;
    }
    
    .invoice-print th, 
    .invoice-print td {
        border: 1px solid #ddd;
        padding: 8pt;
        text-align: center;
    }
    
    .invoice-print th {
        background-color: #f5f5f5;
        font-weight: bold;
    }
    
    .invoice-print canvas {
        border: 1px solid #ddd;
        max-width: 200px;
        height: auto;
    }
    
    .invoice-print .novaflow-btn,
    .invoice-print .novaflow-clear-sig {
        display: none !important;
    }
    
    .invoice-print .novaflow-sig-canvas {
        width: 200px;
        height: 100px;
        border: 1px solid #ddd;
    }
    
    .invoice-print .novaflow-section {
        border: none;
        padding: 0;
        margin-bottom: 15mm;
    }
    
    .invoice-print .novaflow-title {
        font-size: 24pt;
        margin-bottom: 10mm;
    }
    
    .invoice-print .novaflow-sum {
        font-size: 14pt;
        margin: 10mm 0;
    }
    
    .invoice-print .signatures {
        display: flex;
        justify-content: space-between;
        margin-top: 20mm;
    }
    
    .invoice-print .signature-box {
        width: 45%;
        text-align: center;
    }
}

/* Animation for notifications */
@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.novaflow-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.novaflow-notification.success {
    background-color: #28a745;
}

.novaflow-notification.error {
    background-color: #dc3545;
}

.novaflow-notification.info {
    background-color: #17a2b8;
}

/* Loading spinner */
.novaflow-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}