@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Heebo', Tahoma, sans-serif;
  font-size: 15px;
  color: #374151;
  background: #F3F4F6;
  direction: rtl;
}

body, #header, #content { direction: rtl; text-align: right; }

/* ===== LAYOUT ===== */
#wrapper { min-height: 100%; display: flex; flex-direction: column; }
#wrapper-container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
#content { flex: 1; padding: 28px 0 60px; }
#footer { background: #fff; border-top: 1px solid #E5E7EB; padding: 16px; text-align: center; font-size: 13px; color: #9CA3AF; }

/* ===== HEADER & NAV ===== */
#header {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo {
  font-size: 22px;
  font-weight: 600;
  color: #2563EB;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.header-logo span {
  font-size: 13px;
  font-weight: 300;
  color: #9CA3AF;
  margin-right: 6px;
}

/* Desktop nav */
#menu-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  background: none;
  box-shadow: none;
  border: none;
  border-radius: 0;
  height: auto;
  padding: 0;
  margin: 0;
  position: static;
}

#menu-bar li {
  float: none;
  margin: 0;
  padding: 0;
  position: relative;
}

#menu-bar > li > a,
#menu-bar a {
  font-family: 'Heebo', Tahoma, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #6B7280;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  display: block;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  text-shadow: none;
  margin: 0;
}

#menu-bar li a:hover,
#menu-bar .active > a {
  background: #EFF6FF;
  color: #2563EB;
  font-weight: 500;
  background-image: none;
  box-shadow: none;
  text-shadow: none;
}

/* Hide dropdown submenu (not used but keep structure safe) */
#menu-bar ul { display: none !important; }

/* Logout link */
.nav-logout {
  font-size: 13px;
  color: #9CA3AF;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  border: none;
  background: none;
  font-family: 'Heebo', Tahoma, sans-serif;
  text-decoration: none;
}
.nav-logout:hover { color: #EF4444; background: #FEF2F2; }

/* Hamburger button */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  background: none;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #6B7280;
  border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  position: fixed;
  top: 58px;
  right: 0;
  left: 0;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  z-index: 99;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block;
  padding: 12px 16px;
  font-size: 15px;
  color: #374151;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 2px;
}
.mobile-nav a:hover, .mobile-nav a.active { background: #EFF6FF; color: #2563EB; font-weight: 500; }
.mobile-nav .mobile-logout { color: #EF4444; }
.mobile-nav .mobile-logout:hover { background: #FEF2F2; }

/* ===== PAGE TITLE ===== */
.page-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 20px;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ===== FORMS ===== */
label { font-size: 13px; font-weight: 500; color: #4B5563; display: block; margin-bottom: 5px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
  font-family: 'Heebo', Tahoma, sans-serif;
  font-size: 14px;
  color: #374151;
  background: #fff;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[readonly], input[disabled] {
  background: #F9FAFB;
  color: #9CA3AF;
  cursor: default;
}
textarea { resize: vertical; min-height: 72px; }

/* Keep .text class working */
input.text { width: auto; }

/* LTR inputs */
input.ltr, input[type="date"] { direction: ltr; text-align: left; }

/* Chosen override – make it look like native select */
.chosen-container { font-family: 'Heebo', Tahoma, sans-serif !important; width: 100% !important; }
.chosen-container-single .chosen-single {
  border: 1px solid #D1D5DB !important;
  border-radius: 8px !important;
  background: #fff !important;
  background-image: none !important;
  box-shadow: none !important;
  height: 38px !important;
  line-height: 38px !important;
  padding: 0 12px !important;
  font-size: 14px !important;
  color: #374151 !important;
}
.chosen-container-single .chosen-single:hover { border-color: #9CA3AF !important; }
.chosen-container-active.chosen-with-drop .chosen-single {
  border-color: #2563EB !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
}
.chosen-drop {
  border: 1px solid #E5E7EB !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
  margin-top: 4px !important;
}
.chosen-container .chosen-results li { font-size: 14px; padding: 8px 12px; }
.chosen-container .chosen-results li.highlighted { background: #EFF6FF !important; color: #2563EB !important; }
.chosen-search input { border-radius: 6px !important; border: 1px solid #D1D5DB !important; font-size: 14px !important; }

/* ===== BUTTONS ===== */
button,
input[type="submit"],
.btn {
  font-family: 'Heebo', Tahoma, sans-serif;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #D1D5DB;
  background: #fff;
  color: #374151;
}
button:hover { background: #F9FAFB; }

/* jQuery UI button override */
.ui-button {
  font-family: 'Heebo', Tahoma, sans-serif !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  border: 1px solid #D1D5DB !important;
  background: #fff !important;
  color: #374151 !important;
  padding: 7px 16px !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
.ui-button:hover { background: #F9FAFB !important; border-color: #9CA3AF !important; }
.ui-button.ui-state-active { background: #EFF6FF !important; color: #2563EB !important; border-color: #BFDBFE !important; }
.ui-button-text { font-size: 14px !important; line-height: 1.4 !important; }

/* Primary button */
#btn-create, #btn-register, #btn-login, #btn-save-settings,
.btn-primary {
  background: #2563EB !important;
  color: #fff !important;
  border-color: #2563EB !important;
}
#btn-create:hover, #btn-register:hover, #btn-login:hover, #btn-save-settings:hover,
.btn-primary:hover { background: #1D4ED8 !important; border-color: #1D4ED8 !important; }

/* ===== TABLES ===== */
.tbl-collapsed, .tbl-receipt, .tbl-list,
#tbl-receipts-list, #tbl-customers-list, #tbl-accounts-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tbl-collapsed th, .tbl-receipt th,
#tbl-receipts-list th, #tbl-customers-list th, #tbl-accounts-list th {
  background: #F9FAFB;
  color: #6B7280;
  font-weight: 500;
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid #E5E7EB;
  text-align: right;
}

.tbl-collapsed td, .tbl-receipt td,
#tbl-receipts-list td, #tbl-customers-list td, #tbl-accounts-list td {
  padding: 10px 12px;
  border-bottom: 1px solid #F3F4F6;
  color: #374151;
  text-align: right;
}

.tbl-collapsed tr:last-child td, .tbl-receipt tr:last-child td { border-bottom: none; }

.tbl-collapsed tr.tr-data:nth-child(even),
.tbl-collapsed tr.tr-data:nth-child(odd) { background: transparent; }
.tbl-collapsed tr.tr-data:hover,
.tr-receipts:hover, .tr-customers:hover, .tr-accounts:hover {
  background: #F0F7FF !important;
  color: #374151 !important;
  cursor: pointer;
}

.tr-title td { font-weight: 600; color: #111827; background: #F9FAFB; }

/* Inputs inside table */
.tbl-receipt input[type="text"],
.tbl-receipt input.text {
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  background: #F9FAFB;
  width: 100%;
}
.tbl-receipt input:focus { background: #fff; border-color: #2563EB; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }

/* ===== RADIO TOGGLE (customer type) ===== */
#customer-type { display: flex; gap: 0; margin-bottom: 16px; }
#customer-type label {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  border: 1px solid #D1D5DB;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: #6B7280;
  background: #F9FAFB;
  transition: all 0.15s;
  margin: 0;
}
#customer-type label:first-of-type { border-radius: 8px 0 0 8px; }
#customer-type label:last-of-type { border-radius: 0 8px 8px 0; }
#customer-type .ui-state-active { background: #EFF6FF !important; color: #2563EB !important; border-color: #BFDBFE !important; font-weight: 500 !important; }
.ui-buttonset .ui-button { border-radius: 0 !important; margin: 0 !important; }
.ui-buttonset .ui-button:first-child { border-radius: 0 8px 8px 0 !important; }
.ui-buttonset .ui-button:last-child { border-radius: 8px 0 0 8px !important; }

/* ===== CHECKBOXES ===== */
.ui-checkbox {
  width: 20px !important;
  height: 20px !important;
  border-radius: 5px !important;
  border: 1px solid #D1D5DB !important;
  background: #fff !important;
  padding: 0 !important;
  margin: 0 4px 0 0 !important;
  vertical-align: middle;
}
.ui-checkbox .ui-icon-check { background-color: #2563EB; border-radius: 3px; }
.ui-checkbox:hover { border-color: #2563EB !important; }

/* ===== DATEPICKER ===== */
.ui-datepicker { border: 1px solid #E5E7EB !important; border-radius: 12px !important; box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important; font-family: 'Heebo', Tahoma, sans-serif !important; font-size: 14px !important; }
.ui-datepicker td { padding: 2px !important; }
.ui-datepicker td a, .ui-datepicker td span { border-radius: 6px !important; text-align: center !important; }
.ui-datepicker td a:hover { background: #EFF6FF !important; color: #2563EB !important; }
.ui-datepicker .ui-state-highlight { background: #DBEAFE !important; color: #1D4ED8 !important; border-color: #BFDBFE !important; }
.ui-datepicker .ui-state-active { background: #2563EB !important; color: #fff !important; }
.ui-datepicker-header { background: #F9FAFB !important; border-bottom: 1px solid #E5E7EB !important; border-radius: 12px 12px 0 0 !important; }

/* ===== DIALOG (jQuery UI) ===== */
.ui-dialog {
  border: 1px solid #E5E7EB !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15) !important;
  font-family: 'Heebo', Tahoma, sans-serif !important;
  padding: 0 !important;
  overflow: hidden;
}
.ui-dialog-titlebar {
  background: #F9FAFB !important;
  border-bottom: 1px solid #E5E7EB !important;
  border-radius: 16px 16px 0 0 !important;
  padding: 14px 20px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #111827 !important;
}
.ui-dialog-content { padding: 20px !important; font-size: 14px !important; }
.ui-dialog-titlebar-close { border-radius: 6px !important; }

/* Loading in dialog */
#dialog p { text-align: center; padding: 20px; color: #6B7280; font-size: 15px; }
#dialog img { display: none; } /* hide old gif */
#dialog strong::before { content: ''; display: block; width: 32px; height: 32px; border: 3px solid #E5E7EB; border-top-color: #2563EB; border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== HOME PAGE ===== */
#dv-stats { list-style: none; }
#dv-stats li { padding: 8px 0; border-bottom: 1px solid #F3F4F6; font-size: 15px; }
#dv-stats li:last-child { border-bottom: none; }

/* ===== RECEIPT FORM (dv-receipt) ===== */
#dv-receipt { width: 100% !important; max-width: 100%; }
#dv-receipt > strong { font-size: 13px; font-weight: 600; color: #9CA3AF; text-transform: uppercase; letter-spacing: 0.4px; display: block; margin-bottom: 10px; }
#dv-receipt h3 { font-size: 16px; font-weight: 600; color: #2563EB; background: #EFF6FF; padding: 8px 14px; border-radius: 8px; display: inline-block; margin: 8px 0; }

/* ===== AUTOCOMPLETE ===== */
.ui-autocomplete {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  text-align: right;
  border: 1px solid #E5E7EB !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important;
  font-family: 'Heebo', Tahoma, sans-serif !important;
  font-size: 14px !important;
}
.ui-autocomplete .ui-menu-item { padding: 8px 14px; }
.ui-autocomplete .ui-state-focus { background: #EFF6FF !important; color: #2563EB !important; border-radius: 0 !important; }

/* ===== LIST CONTAINER ===== */
.list-container { padding: 0; }

/* ===== LOGIN / REGISTER ===== */
#login, #register {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  margin: 0 auto 24px;
}
#login table, #register table { width: 100%; border: none !important; }
#login table td, #register table td,
#login table th, #register table th {
  padding: 8px 4px;
  text-align: right;
  border: none;
  font-size: 14px;
}
#login table th, #register table th {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  padding-bottom: 20px;
}
#login table tr td:first-child,
#register table tr td:first-child { color: #6B7280; width: 130px; font-size: 13px; white-space: nowrap; }
#login table input, #register table input { width: 100%; }
#login #btn-login, #register #btn-register { width: 100%; justify-content: center; margin-top: 8px; }
#sp-forget-password {
  color: #2563EB;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
#sp-forget-password:hover { text-decoration: underline; }

/* ===== SETTINGS ===== */
.tbl-settings td { padding: 10px 4px; text-align: right; font-size: 14px; }
.tbl-settings td:first-child { color: #6B7280; font-size: 13px; }

/* ===== ADD CUSTOMER DIALOG ===== */
#dv-add-customer table { width: 100%; }
#dv-add-customer table td { padding: 6px 4px; text-align: right; font-size: 14px; }
#dv-add-customer table td:first-child { color: #6B7280; font-size: 13px; width: 120px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #menu-bar { display: none; }
  .nav-logout { display: none; }
  .nav-hamburger { display: flex; }
  .header-logo span { display: none; }

  #content { padding: 16px 0 40px; }
  .card { padding: 16px; border-radius: 10px; }
  #wrapper-container { padding: 0 12px; }

  /* Make receipt table scrollable on mobile */
  .tbl-receipt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-receipt { min-width: 480px; }

  /* Stack login/register */
  #login, #register { padding: 24px 16px; border-radius: 12px; }
  #login table td:first-child, #register table td:first-child { display: none; }
  #login table input, #register table input { width: 100%; }

  /* Chosen full width */
  .chosen-container { width: 100% !important; }
  #slct_exising_customer_chosen,
  #slct_active_demands_chosen,
  #slct_account_chosen { width: 100% !important; }

  /* dv-receipt */
  #dv-receipt { padding: 0 !important; }

  .tbl-collapsed td, .tbl-collapsed th,
  #tbl-receipts-list td, #tbl-receipts-list th,
  #tbl-customers-list td, #tbl-customers-list th {
    padding: 8px 8px;
    font-size: 13px;
  }

  /* Hide less important columns on mobile */
  .hide-mobile { display: none !important; }

  /* Buttons row */
  div[style*="text-align: left"] button { width: 100%; justify-content: center; margin-bottom: 8px; }
}

/* ===== UTILITIES ===== */
.centered { text-align: center !important; }
.ltr { direction: ltr; }
.right-aligned { text-align: right; }
.left-aligned { text-align: left; }
h1 { font-size: 20px; font-weight: 600; color: #111827; }
.comments-textarea { width: 100%; height: 72px; }
#dv-certificate { font-weight: 600; color: #2563EB; }

/* Section divider */
.section-sep {
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
  padding: 0 0 10px 0;
  border-bottom: 1px solid #F3F4F6;
  margin-bottom: 16px;
}

/* td-chk */
.td-chk .ui-button-icon-only { width: 2em !important; height: 2em !important; }
.td-chk .ui-checkbox { margin: 0.1em !important; }

/* Images (edit/trash/save icons from original) */
#dv-receipt img[style*="height: 18px"],
#dv-receipt img[style*="height:18px"] {
  opacity: 0.5;
  transition: opacity 0.15s;
  cursor: pointer;
}
#dv-receipt img[style*="height: 18px"]:hover,
#dv-receipt img[style*="height:18px"]:hover { opacity: 1; }

/* ===== DASHBOARD ===== */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.dash-greeting { font-size: 20px; font-weight: 600; color: #111827; }
.dash-greeting strong { color: #2563EB; }
.dash-year-nav { display: flex; align-items: center; gap: 10px; }
.dash-year-btn {
  background: #fff; border: 1px solid #E5E7EB;
  border-radius: 6px; width: 32px; height: 32px;
  font-size: 18px; cursor: pointer; color: #374151;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.dash-year-btn:hover { background: #EFF6FF; border-color: #2563EB; color: #2563EB; }
.dash-year-label { font-size: 16px; font-weight: 600; color: #374151; }

.dash-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.dash-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.dash-ytd-amount {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
  direction: ltr;
  text-align: right;
}

.dash-progress-wrap {
  background: #F3F4F6;
  border-radius: 20px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}
.dash-progress-bar {
  height: 100%;
  border-radius: 20px;
  transition: width 0.6s ease;
}
.dash-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 6px;
}
.dash-ceiling-note {
  font-size: 11px;
  color: #9CA3AF;
  text-align: left;
}

.dash-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: #6B7280;
  direction: ltr;
  justify-content: flex-end;
}
.dash-legend-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
}

.dash-demands-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-demands-count {
  font-size: 16px;
  font-weight: 500;
  color: #374151;
}
.dash-demands-total {
  font-size: 22px;
  font-weight: 700;
  color: #F59E0B;
  direction: ltr;
}
.dash-no-demands {
  font-size: 14px;
  color: #9CA3AF;
  text-align: center;
  padding: 10px 0;
}

.dash-btn-demands {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: none;
  border: 1px solid #2563EB;
  color: #2563EB;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: 'Heebo', Tahoma, sans-serif;
  cursor: pointer;
  text-align: center;
}
.dash-btn-demands:hover { background: #EFF6FF; }

/* ===== HISTORY TABS ===== */
.hist-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  direction: rtl;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 0;
}
.hist-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 18px;
  font-size: 14px;
  font-family: 'Heebo', Tahoma, sans-serif;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.hist-tab:hover { color: #2563EB; }
.hist-tab.active {
  color: #2563EB;
  border-bottom: 3px solid #2563EB;
  font-weight: 600;
}
.hist-date-row {
  margin: 12px 0;
  direction: rtl;
}
.hist-search-row {
  margin-bottom: 12px;
  direction: rtl;
}
#tbl-demands-list { border-collapse: collapse; }
#tbl-demands-list th, #tbl-demands-list td {
  padding: 8px 12px;
  border: 1px solid #E5E7EB;
  text-align: right;
}
#tbl-demands-list th { background: #F9FAFB; font-weight: 600; }
#tbl-demands-list tr:hover { background: #F9FAFB; }
