/* ===============================================================
   Quotation Generator — Main Stylesheet
   Primary: #ff5e00
   =============================================================== */

/* ── Variables ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ */
:root {
  --primary: #ff5e00;
  --primary-dk: #cc4b00;
  --primary-lt: #ff7a2e;
  --primary-bg: #fff5ee;
  --dark: #16162a;
  --dark-2: #22223b;
  --dark-3: #2d2d44;
  --txt-dark: #1e2030;
  --txt-mid: #5a5f7d;
  --txt-light: #9fa3b8;
  --bg: #f4f5fb;
  --card: #ffffff;
  --border: #ffc2aa;
  --border-lt: #eef0f8;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 30px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.13);
  --radius: 14px;
  --radius-sm: 9px;
  --trans: all 0.22s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--txt-dark);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[dir="rtl"] body,
[dir="rtl"] {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* ════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  background: linear-gradient(140deg, #0f0f1e 0%, #1a1a2e 45%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Ambient glow blobs */
.login-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  animation: glow-float 8s ease-in-out infinite alternate;
}

.login-glow--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 94, 0, .18) 0%, transparent 70%);
  top: -150px;
  right: -120px;
  animation-delay: 0s;
}

.login-glow--2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(255, 94, 0, .10) 0%, transparent 70%);
  bottom: -80px;
  left: -80px;
  animation-delay: 3s;
}

.login-glow--3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 94, 0, .12) 0%, transparent 70%);
  top: 40%;
  left: 20%;
  animation-delay: 5s;
}

@keyframes glow-float {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(20px, -20px) scale(1.05);
  }
}

.login-card {
  width: 400px;
  max-width: 94vw;
  background: rgba(255, 255, 255, .04);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 22px;
  padding: 48px 44px;
  position: relative;
  z-index: 10;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(255, 94, 0, .4));
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, .38);
  text-align: center;
  margin-bottom: 34px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 57, 53, .14);
  border: 1px solid rgba(229, 57, 53, .28);
  border-radius: 9px;
  padding: 11px 14px;
  color: #ff7875;
  font-size: 13px;
  margin-bottom: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.login-field label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .42);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #e8470f;
  pointer-events: none;
}

[dir="rtl"] .login-input-icon {
  left: auto;
  right: 14px;
}

.login-input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 40px;
  background: rgba(255, 255, 255, .07);
  border: 1.5px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  transition: var(--trans);
}

[dir="rtl"] .login-input-wrap input {
  padding: 13px 40px 13px 14px;
}

.login-input-wrap input::placeholder {
  color: rgba(255, 255, 255, .2);
}

.login-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .2);
}

.toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #e8470f;
  cursor: pointer;
  padding: 4px;
  transition: var(--trans);
}

[dir="rtl"] .toggle-pass {
  right: auto;
  left: 12px;
}

.toggle-pass:hover {
  color: rgba(255, 255, 255, .7);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .4px;
  box-shadow: 0 4px 24px rgba(255, 94, 0, .4);
  transition: var(--trans);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 94, 0, .55);
}

.login-btn:active {
  transform: translateY(0);
}

.login-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .22);
}

/* ════════════════════════════════════════════════════════════
   APP HEADER
   ════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--dark);
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  box-shadow: 0 2px 24px rgba(0, 0, 0, .35);
  border-bottom: 2px solid var(--primary);
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hdr-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  filter: brightness(1.05);
}

.hdr-company {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .3px;
  background-color: #FF5722;
  padding: 0.3rem;
  border-radius: 6px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, .08);
  border-radius: 9px;
  padding: 3px;
}

.lang-btn {
  padding: 5px 15px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, .5);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  transition: var(--trans);
  letter-spacing: .3px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

.lang-btn:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

/* Logout */
.logout-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .5);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  transition: var(--trans);
}

.logout-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .05);
    transform: translateY(-1.5px);
}

/* ════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════════════════════ */
.main-wrap {
  max-width: calc(100% - 30px);
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.form-container {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Page Title Bar ── */
.page-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
}

[dir="rtl"] .page-title-bar {
  border-left: none;
  border-right: 4px solid var(--primary);
}

.ptb-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ptb-title {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(180deg, #ff5200, #ff2300);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ptb-sub {
  font-size: 13px;
  color: var(--txt-light);
}

.ptb-right {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.meta-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--txt-light);
  text-transform: uppercase;
  letter-spacing: .7px;
}

.meta-inp {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--txt-dark);
  background: var(--bg);
  min-width: 145px;
  transition: var(--trans);
}

.meta-inp:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .1);
}

/* ── Form Cards ── */
.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .22s ease;
  margin-bottom: 13px;
}

.form-card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--txt-mid);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-lt);
}

.card-bar {
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Client Fields Grid ── */
.fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-lbl {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--txt-mid);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.field-inp {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--txt-dark);
  background: var(--bg);
  transition: var(--trans);
}

.field-inp:hover:not(:focus) {
  border-color: #c9ccdf;
}

.field-inp:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .1);
}

/* ═══════ ITEMS TABLE ═══════ */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.items-table thead tr {
  background: var(--dark);
}

.items-table th {
  padding: 12px 10px;
  color: rgba(255, 255, 255, .85);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
  text-align: left;
}

[dir="rtl"] .items-table th {
  text-align: right;
}

.col-num {
  width: 42px;
  text-align: center !important;
}

.col-ref {
  min-width: 110px;
  width: 10%;
}

.col-desc {
  min-width: 200px;
}

.col-img {
  width: 15%;
}

.col-qty {
  width: 80px;
  text-align: center !important;
}

.col-price {
  width: 120px;
  text-align: right !important;
}

.col-tax {
  width: 90px;
  text-align: center !important;
}

.col-total {
  width: 120px;
  text-align: right !important;
}

.col-action {
  width: 42px;
  text-align: center !important;
}

.items-table tbody tr {
  border-bottom: 1px solid var(--border-lt);
  transition: background .14s;
}

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

.items-table tbody tr:nth-child(even) {
  background: #fafbff;
}

.items-table tbody tr:hover {
  background: var(--primary-bg);
}

.items-table td {
  padding: 10px 6px;
}

.items-table td:first-child {
  text-align: center;
  color: var(--txt-light);
  font-size: 12px;
  font-weight: 600;
}

/* Table row inputs */
.items-table input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  background: #ff5e003b;
  color: var(--txt-dark);
  transition: var(--trans);
}

.items-table input:hover {
  border-color: var(--border);
  background: var(--bg);
}

.items-table input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .1);
}

.inp-qty,
.inp-price,
.inp-tax {
  text-align: right;
}

.row-total-cell {
  font-weight: 600;
  color: var(--txt-dark);
  text-align: right;
  padding-right: 12px;
}

/* Remove row button */
.remove-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  color: var(--border);
  font-size: 18px;
  line-height: 1;
  transition: var(--trans);
}

.remove-row:hover {
  background: #ffeaea;
  color: #e53935;
}

/* Add row button */
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 9px 18px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--txt-light);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--trans);
}

.add-row-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

/* ═══════ SUMMARY ═══════ */
.summary-card {
  display: flex;
  justify-content: flex-end;
}

[dir="rtl"] .summary-card {
  justify-content: flex-end;
}

.summary-box {
  min-width: 310px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-lt);
}

.sum-row:last-child {
  border-bottom: none;
}

.sum-lbl {
  font-size: 14px;
  color: var(--txt-mid);
  font-weight: 700;
}

.sum-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--txt-dark);
}

/* Discount row */
.sum-disc-row {
  gap: 14px;
  flex-wrap: wrap;
}

.disc-ctrl {
  display: flex;
  gap: 6px;
  align-items: center;
}

.disc-inp,
.tax-inp,
.profit-inp,
.ship-inp {
  width: 90px;
  padding: 7px 10px;
  text-align: right;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--txt-dark);
  transition: var(--trans);
}

.disc-inp:focus,
.tax-inp:focus,
.profit-inp:focus,
.ship-inp:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .1);
}

.disc-sel {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--txt-dark);
  cursor: pointer;
  transition: var(--trans);
}

.disc-sel:focus {
  outline: none;
  border-color: var(--primary);
}

/* Total row */
.sum-total-row {
  background: linear-gradient(180deg, #ff8100, #ff3b00);
}

.sum-total-lbl {
  color: rgba(255, 255, 255, .85) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.sum-total-val {
  color: #fff !important;
  font-size: 20px !important;
  font-weight: 700 !important;
}

/* ═══════ TEXTAREAS ═══════ */
.wide-ta {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--txt-dark);
  background: var(--bg);
  resize: vertical;
  line-height: 1.75;
  transition: var(--trans);
}

.wide-ta:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 94, 0, .1);
}

[dir="rtl"] .wide-ta {
  text-align: right;
}

/* ═══════ GENERATE BUTTON ═══════ */
.gen-row {
  display: flex;
  justify-content: center;
  padding: 6px 0 10px;
}

.gen-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 16px 52px;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  background: linear-gradient(180deg, #ff8100, #ff3b00);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .4px;
  transition: var(--trans);
  box-shadow: 0 4px 22px rgba(255, 94, 0, .36);
}

.gen-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 36px rgba(255, 94, 0, .52);
}

.gen-btn:active {
  transform: translateY(-1px);
}

.gen-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

/* ═══════ LOADING OVERLAY ═══════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, .65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-card {
  background: var(--card);
  border-radius: 18px;
  padding: 40px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-lg);
}

.loading-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3.5px solid var(--border-lt);
  border-top-color: var(--primary);
  animation: spin .75s linear infinite;
}

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

.loading-txt {
  font-size: 15px;
  font-weight: 500;
  color: var(--txt-mid);
}

/* ═══════ RTL OVERRIDES ═══════ */
[dir="rtl"] .page-title-bar {
  /* flex-direction: row-reverse;*/
}

[dir="rtl"] .ptb-right {
  flex-direction: row-reverse;
}

[dir="rtl"] .hdr-left {
  flex-direction: row-reverse;
}

[dir="rtl"] .hdr-right {
  /* flex-direction: row-reverse; */
}

[dir="rtl"] .card-title {
  /* flex-direction: row-reverse;*/
}

[dir="rtl"] .field-lbl,
[dir="rtl"] .meta-lbl {
  text-align: right;
}

[dir="rtl"] .sum-row {
  /* flex-direction: row-reverse;*/
}

[dir="rtl"] .sum-disc-row {
  /* flex-direction: row-reverse;*/
}

[dir="rtl"] .disc-inp {
  text-align: left;
}

[dir="rtl"] .col-price,
[dir="rtl"] .col-tax,
[dir="rtl"] .col-total {
  text-align: left !important;
}

[dir="rtl"] .row-total-cell {
  text-align: left;
  padding-left: 12px;
  padding-right: 8px;
}

[dir="rtl"] .inp-qty,
[dir="rtl"] .inp-price,
[dir="rtl"] .inp-tax {
  text-align: left;
}

[dir="rtl"] .add-row-btn {
  flex-direction: row-reverse;
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
  .app-header {
    padding: 0 16px;
  }

  .hdr-company {
    display: none;
  }

  .main-wrap {
    padding: 16px 12px 48px;
  }

  .form-card {
    padding: 20px 16px;
  }

  .page-title-bar {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
  }

  .ptb-right {
    width: 100%;
  }

  .fields-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-box {
    min-width: 100%;
  }

  .gen-btn {
    padding: 14px 28px;
    font-size: 15px;
  }

  .login-card {
    padding: 32px 24px;
  }
}

@media (max-width: 460px) {
  .fields-grid {
    grid-template-columns: 1fr;
  }

  .ptb-right {
    flex-direction: column;
    gap: 10px;
  }
}

input:disabled {
  background-color: #d7d7d7;
  color: #50505087;
  cursor: not-allowed;
}

.custom-file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  background-color: #f8fafc;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}

.custom-file-upload:hover {
  border-color: var(--primary);
  background-color: #f1f5f9;
}

.custom-file-upload .upload-btn {
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.custom-file-upload:hover .upload-btn {
  color: var(--primary);
}

.custom-file-upload .img-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

/* ═══════ CUSTOMER AUTOFILL & ITEM HISTORY STYLES ═══════ */

/* Autofill Button */
.autofill-btn-wrap {
  margin-top: 6px;
}

.autofill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary-bg);
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
  animation: slideDownFade 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.autofill-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(255, 94, 0, 0.25);
}

.autofill-btn:active {
  transform: translateY(0);
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Description field with history button */
.col-desc-cell {
  position: relative;
}

.has-history-btn {
  padding-right: 36px !important;
}

[dir="rtl"] .has-history-btn {
  padding-left: 36px !important;
  padding-right: 9px !important;
}

.item-history-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: white;
  color: var(--primary);
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans);
  z-index: 5;
  box-shadow: 0px 0px 5px 1px rgb(255 94 0);
  padding: 0;
}

[dir="rtl"] .item-history-btn {
  right: auto;
  left: 12px;
}

.item-history-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 4px 10px rgba(255, 94, 0, 0.3);
}

.item-history-btn:active {
  transform: translateY(-50%) scale(1);
}

.item-history-btn svg {
  display: block;
}

/* Glassmorphic Modal Dialog */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  width: 85%;
  max-width: 92vw;
  max-height: 82vh;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.94);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-lt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--txt-dark);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  font-size: 20px;
  font-weight: 400;
  cursor: pointer;
  color: var(--txt-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
  line-height: 1;
}

.modal-close:hover {
  background: #ffeaea;
  color: #e53935;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Modal Table */
.modal-table-scroll {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-lt);
  overflow-x: auto;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

[dir="rtl"] .modal-table {
  text-align: right;
}

.modal-table th {
  padding: 12px 14px;
  background: var(--dark);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 12px;
}

.modal-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-lt);
  color: var(--txt-dark);
}

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

.modal-table tr:nth-child(even) {
  background: #fafbff;
}

.modal-table tr:hover {
  background: var(--primary-bg);
}

.modal-no-data {
  text-align: center;
  padding: 40px 20px;
  color: var(--txt-light);
  font-size: 14px;
}
