/*
 * balbaa.css  —  Brand stylesheet for Contracts Daily
 * Sits on top of Bootstrap 5 RTL.
 * Replaces styles_full_combined.css (3099 lines → ~220 lines).
 */

/* ── Fonts ─────────────────────────────────────────────────────────────────── */
:root {
  --bb-green:        #1A7A3A;
  --bb-green-dark:   #145f2d;
  --bb-green-light:  #e8f5ed;
  --bb-red:          #CC1515;
  --bb-text:         #1e293b;
  --bb-muted:        #64748b;
  --bb-border:       #dee2e6;
  --bb-radius:       0.5rem;
  --bb-shadow:       0 1px 4px rgba(0,0,0,.08);
}

body {
  font-family: 'Noto Kufi Arabic', 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: var(--bb-text);
  font-size: 0.9rem;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.bb-navbar {
  background: var(--bb-green) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  min-height: 56px;
}

.bb-navbar .nav-link {
  color: rgba(255,255,255,.88) !important;
  border-radius: var(--bb-radius);
  padding: 0.4rem 0.75rem !important;
  font-size: 0.85rem;
  transition: background .15s;
}

.bb-navbar .nav-link:hover,
.bb-navbar .nav-link.active {
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
}

.bb-navbar .dropdown-menu {
  font-size: 0.85rem;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  border-radius: var(--bb-radius);
  min-width: 180px;
}

.bb-navbar .dropdown-item {
  padding: 0.45rem 1rem;
  color: var(--bb-text);
}

.bb-navbar .dropdown-item:hover {
  background: var(--bb-green-light);
  color: var(--bb-green-dark);
}

/* ── Main content area ──────────────────────────────────────────────────────── */
.bb-main {
  min-height: calc(100vh - 56px - 40px);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.bb-footer {
  background: #fff;
  border-top: 1px solid var(--bb-border);
}

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
}

.card-header {
  background: var(--bb-green-light);
  border-bottom: 1px solid var(--bb-border);
  font-weight: 600;
  color: var(--bb-green-dark);
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table {
  font-size: 0.85rem;
}

.table thead th {
  background: var(--bb-green);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  border: none;
}

.table tbody tr:hover {
  background: var(--bb-green-light);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
  /* Mirror scrollbar to top */
  transform: rotateX(180deg);
}
.table-responsive > * {
  transform: rotateX(180deg);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary, .btn-success {
  background: var(--bb-green);
  border-color: var(--bb-green);
}

.btn-primary:hover, .btn-success:hover {
  background: var(--bb-green-dark);
  border-color: var(--bb-green-dark);
}

.btn-danger {
  background: var(--bb-red);
  border-color: var(--bb-red);
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--bb-green);
  box-shadow: 0 0 0 0.2rem rgba(26,122,58,.2);
}

.form-label {
  font-weight: 500;
  color: var(--bb-text);
}

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge-green {
  background: var(--bb-green);
  color: #fff;
}

/* ── Page heading utility ────────────────────────────────────────────────────── */
.bb-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bb-green-dark);
  border-right: 4px solid var(--bb-green);
  padding-right: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ── Stat / summary cards (dashboard + everywhere) ──────────────────────────── */
.bb-stat-card {
  border-right: 4px solid var(--bb-green);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit !important;
}

.bb-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(26,122,58,.15);
  border-right-color: var(--bb-red);
}

.bb-stat-card .stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--bb-green);
}

.bb-stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--bb-muted);
}

/* ── Dashboard hero banner ───────────────────────────────────────────────────── */
.bb-dashboard-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: linear-gradient(135deg, var(--bb-green-light) 0%, #fff 100%);
  border: 1px solid rgba(26,122,58,.15);
  border-right: 5px solid var(--bb-green);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.bb-dashboard-logo-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--bb-green);
  box-shadow: 0 0 0 4px rgba(26,122,58,.12);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bb-dashboard-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bb-dashboard-hero-text h4 {
  color: var(--bb-green-dark);
  margin-bottom: .15rem;
}

/* ── Dashboard icon cards ────────────────────────────────────────────────────── */
.bb-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1.5rem 1rem;
  background: #fff;
  border: 1px solid rgba(26,122,58,.15);
  border-bottom: 3px solid var(--bb-green);
  border-radius: 10px;
  text-decoration: none !important;
  color: var(--bb-green-dark) !important;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  height: 100%;
}

.bb-nav-card i {
  font-size: 2rem;
  color: var(--bb-green);
  transition: color .18s ease, transform .18s ease;
}

.bb-nav-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(26,122,58,.18);
  border-bottom-color: var(--bb-red);
  background: var(--bb-green-light);
}

.bb-nav-card:hover i {
  color: var(--bb-red);
  transform: scale(1.15);
}

/* ── Login page ─────────────────────────────────────────────────────────────── */
.bb-login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bb-green-light) 0%, #fff 60%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bb-login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.page-item.active .page-link {
  background: var(--bb-green);
  border-color: var(--bb-green);
}

.page-link {
  color: var(--bb-green);
}

.page-link:hover {
  color: var(--bb-green-dark);
}

/* ── Alert / flash tones ─────────────────────────────────────────────────────── */
.text-bg-success { background-color: var(--bb-green) !important; }

/* ── Checkboxes & row selection ──────────────────────────────────────────────── */
.form-check-input:checked {
  background-color: var(--bb-green);
  border-color: var(--bb-green);
}

/* ── Sticky table header ─────────────────────────────────────────────────────── */
.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .bb-navbar .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(255,255,255,.08);
  }

  .bb-navbar .dropdown-item {
    color: rgba(255,255,255,.88);
    padding-right: 2rem;
  }

  .bb-navbar .dropdown-item:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
  }

  .table { font-size: 0.78rem; }
}

/* ── Print: hide nav ─────────────────────────────────────────────────────────── */
@media print {
  .bb-navbar, .bb-footer, .btn, .pagination { display: none !important; }
  .bb-main { padding: 0 !important; }
  body { background: #fff; }
}

/* ── Larger checkboxes ───────────────────────────────────────────── */
.bb-checkbox {
  width: 1.2rem !important;
  height: 1.2rem !important;
  cursor: pointer;
  border: 2px solid #adb5bd;
  border-radius: 3px;
}
.bb-checkbox:checked {
  background-color: var(--bb-green);
  border-color: var(--bb-green);
}

/* ── Note textareas in tables ────────────────────────────────────── */
.bb-note-textarea {
  min-width: 120px;
  font-size: 0.8rem;
  border-radius: 4px;
  border-color: #ced4da;
  resize: vertical;
  padding: 4px 6px;
  line-height: 1.4;
}
.bb-note-textarea:focus {
  border-color: var(--bb-green);
  box-shadow: 0 0 0 0.15rem rgba(26,122,58,.2);
  outline: none;
}

/* ── Input textareas in input page ───────────────────────────────── */
.bb-input-cell {
  min-width: 100px;
  font-size: 0.8rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 3px 5px;
  width: 100%;
  resize: none;
  background: #fff;
  line-height: 1.4;
}
.bb-input-cell:focus {
  border-color: var(--bb-green);
  box-shadow: 0 0 0 0.15rem rgba(26,122,58,.2);
  outline: none;
}

/* ── Selected row highlight ──────────────────────────────────────── */
tr.selected-row td {
  background-color: #d1fae5 !important;  /* light green */
}
tr.rosheta-row td {
  background-color: #dbeafe !important;  /* light blue for rosheta */
}

/* ── Month picker in input page ──────────────────────────────────── */
.month-picker {
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
.month-picker:focus {
  border-color: var(--bb-green);
  outline: none;
}

/* ── Selection bar animation ─────────────────────────────────────── */
#selection-bar {
  transition: all 0.2s ease;
  border-right: 4px solid var(--bb-green);
}

/* ── Custom modal (used by rosheta_details.js date/receipt modals) ── */
.custom-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1055;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  min-width: 320px;
  max-width: 500px;
  width: 90vw;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  direction: rtl;
}
.custom-modal h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bb-green);
}
.custom-modal label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.custom-modal input,
.custom-modal select,
.custom-modal textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.custom-modal input:focus,
.custom-modal select:focus {
  border-color: var(--bb-green);
  outline: none;
  box-shadow: 0 0 0 0.15rem rgba(26,122,58,.2);
}
.custom-modal button[type="submit"] {
  background: var(--bb-green);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 7px 18px;
  cursor: pointer;
  font-size: 0.9rem;
}
.custom-modal button[type="submit"]:hover { filter: brightness(.92); }
.custom-modal button[type="button"] {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 7px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-right: 8px;
}

/* Backdrop behind custom modals */
#dateModalBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1050;
}

/* ── Receipt modal backdrop (#modalBackdrop injected by JS) ─────── */
/* Override Bootstrap's .modal-backdrop with a higher-specificity rule */
#modalBackdrop {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,.45) !important;
  z-index: 1050 !important;
}

/* ── editModal customer-data backdrop ───────────────────────────── */
.custom-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1050;
}

/* ── Input page: larger editable cells ──────────────────────────────── */
.bb-input-cell {
  min-height: 52px !important;
  font-size: 0.82rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 4px 6px;
  width: 100%;
  resize: vertical;
  background: #fff;
  line-height: 1.5;
}
.bb-input-cell:focus {
  border-color: var(--bb-green);
  box-shadow: 0 0 0 0.15rem rgba(26,122,58,.2);
  outline: none;
}

/* ── Input page table: horizontal scroll with sticky header ─────────── */
#myTable {
  min-width: 2200px;   /* forces horizontal scroll on input page */
}