/* ==========================================================================
   Tafnit Orders Tab — styles
   RTL layout (Hebrew UI)
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Wrapper
   --------------------------------------------------------------------------- */
.tafnit-orders-wrap {
	direction: rtl;
	text-align: right;
}

/* ---------------------------------------------------------------------------
   Date-range filter form
   --------------------------------------------------------------------------- */
.tafnit-filter-form {
	margin-bottom: 1.5em;
}

.tafnit-filter-fields {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75em;
}

.tafnit-filter-fields label {
	font-weight: 600;
	white-space: nowrap;
}

.tafnit-filter-fields .tafnit-date-input {
	padding: 0.4em 0.6em;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 0.95em;
	width: 11em;
}

.flatpickr-calendar.animate.arrowTop.arrowLeft.open {
  border:1px solid #000;
}
.flatpickr-calendar.animate.arrowTop.arrowLeft.open::after {
  border-bottom-color: #000;
}

.tafnit-filter-btn {
	white-space: nowrap;
}

.tafnit-clear-btn {
	display: inline;
	background: none;
	border: none;
	padding: 0;
	color: #000 !important;
	text-decoration: underline;
	font-size: 0.9em;
	cursor: pointer;
	white-space: nowrap;
}

.tafnit-unit-price {
  direction: ltr;
}

/* ---------------------------------------------------------------------------
   Orders table
   --------------------------------------------------------------------------- */
.tafnit-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tafnit-orders-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.tafnit-orders-table th,
.tafnit-orders-table td {
	padding: 0.65em 0.9em;
	border: 1px solid #e0e0e0;
	text-align: right;
	vertical-align: middle;
	white-space: nowrap;
}

.tafnit-orders-table thead tr {
	background-color: #f5f5f5;
	font-weight: 700;
}

.tafnit-orders-table tbody tr:nth-child(even) {
	background-color: #fafafa;
}

.tafnit-orders-table tbody tr:hover {
	background-color: #eef4fb;
}

/* Clickable links inside table cells */
.tafnit-order-link,
.tafnit-dn-link {
	color: #0073aa;
	text-decoration: underline;
	cursor: pointer;
}

.tafnit-order-link:hover,
.tafnit-dn-link:hover {
	color: #005177;
}

/* Hide order title when modal is opened in DN-only mode */
.tafnit-modal-dn-only .tafnit-modal-title {
	display: none;
}

/* Disable background scroll when modal is open */
body.tafnit-modal-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Modal overlay
   --------------------------------------------------------------------------- */
.tafnit-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tafnit-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Modal panel
   --------------------------------------------------------------------------- */
.tafnit-modal-panel {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
	width: fit-content;
	max-width: 95vw;
  min-width: 50vw;
	max-height: 85vh;
	overflow-y: auto;
	padding: 2em;
	direction: rtl;
	text-align: right;
}

.tafnit-modal-close {
	position: sticky;
	top: 0;
	float: left; /* left in RTL = far end */
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 3px;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
	color: #555;
	padding: 0 0.25em;
	z-index: 1;
}

.tafnit-modal-close:hover {
	color: #000;
}

.tafnit-modal-title {
	margin-top: 0;
	font-size: 1.25em;
	border-bottom: 1px solid #e0e0e0;
	padding-bottom: 0.5em;
	margin-bottom: 1em;
}

.tafnit-modal-order-id {
	font-weight: 400;
	color: #555;
	font-size: 0.9em;
	margin-right: 0.5em;
}

/* ---------------------------------------------------------------------------
   Field list inside modal
   --------------------------------------------------------------------------- */
.tafnit-order-fields dl,
.tafnit-dn-fields dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.4em 1em;
	margin: 0;
}

.tafnit-order-fields dt,
.tafnit-dn-fields dt {
	font-weight: 600;
	white-space: nowrap;
}

.tafnit-order-fields dd,
.tafnit-dn-fields dd {
	margin: 0;
}

/* ---------------------------------------------------------------------------
   Delivery note sub-section
   --------------------------------------------------------------------------- */
.tafnit-dn-section {
	margin-top: 1.5em;
	padding-top: 1em;
}

.tafnit-dn-title {
	font-size: 1.05em;
	margin-top: 0;
	margin-bottom: 0.75em;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.5em;
}

.tafnit-dn-number {
	font-weight: 400;
	color: #555;
	font-size: 0.9em;
	margin-right: 0.4em;
}

/* ---------------------------------------------------------------------------
   Line items table inside modal
   --------------------------------------------------------------------------- */
.tafnit-lines-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-top: 0.5em;
}

.tafnit-lines-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88em;
}

.tafnit-lines-table th,
.tafnit-lines-table td {
	padding: 0.55em 0.75em;
	border: 1px solid #e0e0e0;
	text-align: right;
	vertical-align: middle;
	white-space: nowrap;
}

#tafnit-modal-body{
  .tafnit-lines-table th,
  .tafnit-lines-table td {
    padding-inline-start: 10px;
  }
}

.tafnit-lines-table thead tr {
	background-color: #f5f5f5;
	font-weight: 700;
}

.tafnit-lines-table tbody tr:nth-child(even) {
	background-color: #fafafa;
}

.tafnit-lines-table tbody tr:hover {
	background-color: #eef4fb;
}

/* ---------------------------------------------------------------------------
   Spinner / loading indicator
   --------------------------------------------------------------------------- */
.tafnit-spinner {
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	border: 2px solid #ccc;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: tafnit-spin 0.7s linear infinite;
	vertical-align: middle;
	margin-left: 0.4em;
}

@keyframes tafnit-spin {
	to { transform: rotate(360deg); }
}

.tafnit-modal-loading,
.tafnit-dn-loading {
	padding: 1em 0;
	color: #555;
}

/* ---------------------------------------------------------------------------
   Error messages
   --------------------------------------------------------------------------- */
.tafnit-modal-error,
.tafnit-dn-error {
	color: #c00;
	padding: 0.5em 0;
}

.tafnit-error,
.tafnit-empty {
	padding: 0.75em 1em;
}
