.deal-container {
  width: 100%;
  max-width: 100%;
}

/* HEADER */
.deal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.deal-header h2 {
  font-weight: 600;
}

/* BUTTONS */
.btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn.primary {
  background: #4CAF50;
  color: white;
}

.btn.secondary {
  background: #34495e;
  color: white;
}

.btn:hover {
  opacity: 0.9;
}

/* STATS */
/* ============================= */
/* PROFESSIONAL STATS CARDS */
/* ============================= */

.deal-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
}

/* CARD */
.stat-card {
  flex: 1;
  position: relative;

  padding: 18px 20px;
  border-radius: 14px;

  color: white;
  overflow: hidden;

  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  transition: all 0.25s ease;
}

/* HOVER EFFECT */
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
}

/* TEXT */
.stat-card h4 {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.stat-card p {
  margin: 5px 0 0;
  font-size: 24px;
  font-weight: bold;
}

/* ICON (BACKGROUND STYLE) */
.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

/* DIFFERENT COLORS */

/* TOTAL DEALS */
.stat-card:nth-child(1) {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

/* TOTAL BROKERAGE */
.stat-card:nth-child(2) {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
}

/* TABLE */
.table-card {
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-card {
  overflow-x: auto;
  /* ✅ ONLY horizontal scroll */
  overflow-y: auto;
}

/* TABLE */
#dealTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* HEADER */
#dealTable th {
  background: #2c3e50;
  color: white;
  padding: 8px;
  text-align: center;
  border: 1px solid #ddd;
}

/* CELLS */
#dealTable td {
  padding: 6px;
  border: 1px solid #ddd;
}

/* RIGHT ALIGN NUMBERS */
.right {
  text-align: right;
}

/* HOVER */
#dealTable tbody tr:hover {
  background: #f5f5f5;
}

/* TOTAL COLUMN */
.total-cell {
  font-weight: bold;
  color: #27ae60;
}

/* TOTAL ROW */
.total-row {
  background: #2c3e50;
  font-weight: bold;
  color: #2ecc71;
}

.total-row td {
  padding: 8px;
}

/* TABLE WRAP */
.table-card {
  overflow: auto;
  max-height: 500px;
}

/* STICKY HEADER */
#dealTable thead th {
  position: sticky;
  top: 0;
  background: #2c3e50;
  color: white;
  z-index: 2;
}

/* STICKY FIRST COLUMN */
.sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

/* STICKY SECOND COLUMN */
.sticky-col2 {
  position: sticky;
  left: 50px;
  background: #fff;
  z-index: 1;
}

/* HEADER COLOR */
#dealTable th {
  background: #2c3e50;
  color: white;
}

/* TOOLBAR LINE */
/* TOOLBAR BASE */
.deal-toolbar {
  position: relative;
  width: 100%;
  padding: 8px 0;
}

/* LEFT BUTTONS */
.toolbar-left {
  display: inline-flex;
  gap: 10px;
}

/* BUTTON STYLE */
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 14px;
  border-radius: 8px;
  border: none;

  color: white;
  cursor: pointer;
  font-size: 13px;
}

/* COLORS */
.export-btn {
  background: #27ae60;
}

.print-btn {
  background: #2980b9;
}

.edit-btn {
  background: #e67e22;
}

/* 🔥 RIGHT SEARCH (ABSOLUTE FIX) */
.toolbar-right {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* SEARCH BOX */
.tool-search {
  display: flex;
  align-items: center;
  gap: 6px;

  background: #e67e22;
  padding: 8px 12px;
  border-radius: 8px;

  width: 200px;
}

/* INPUT */
.tool-search input {
  border: none;
  outline: none;
  background: transparent;
  color: white;
  width: 100%;
}

.tool-btn:hover {
  opacity: 0.9;
}

.tool-search i {
  color: white;
}

#dealTable th {
  cursor: pointer;
  position: relative;
}

/* Arrow */
#dealTable th::after {
  content: "⇅";
  font-size: 10px;
  margin-left: 5px;
  opacity: 0.5;
}

/* Active sort */
#dealTable th.asc::after {
  content: "↑";
  color: #2ecc71;
}

#dealTable th.desc::after {
  content: "↓";
  color: #e74c3c;
}

/* MODAL BACKGROUND */
.modal {
  display: none;
  position: fixed;
  z-index: 999;

  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);

  justify-content: center;
  align-items: center;
}

/* MODAL BOX */
.modal-content {
  background: white;
  width: 600px;
  border-radius: 10px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.3s ease;
}

/* HEADER */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 15px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
}

/* CLOSE BUTTON */
.close-btn {
  font-size: 22px;
  cursor: pointer;
}

/* BODY */
.modal-body {
  padding: 15px;
}

/* FOOTER */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  padding: 15px;
  border-top: 1px solid #eee;
}

/* INPUT GROUP (ICON STYLE) */
.input-group {
  display: flex;
  align-items: center;

  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;

  background: #f9f9f9;
}

.input-group i {
  margin-right: 8px;
  color: #555;
}

.input-group input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
}

/* GRID */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* ANIMATION */
@keyframes fadeIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.input-group i.fa-calendar {
  color: #e67e22;
}

/* SELECTED ROW */
#dealTable tbody tr.selected-row {
  background: #d6eaf8 !important;
  /* light blue */
}

#dealTable tbody tr:hover {
  cursor: pointer;
}

#deleteDealBtn {
  background: linear-gradient(145deg, #e74c3c, #c0392b);
  color: white;
}

#toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #222;
  color: white;
  padding: 14px 18px;
  border-radius: 10px;
  z-index: 999999;
  display: none;
  font-size: 14px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
}

/* =========================
   DEAL FORM REDESIGN
========================= */

.deal-form-layout {

  width: 100%;
}

.deal-date-row {

  margin-bottom: 20px;
}

.deal-sections {

  display: grid;

  grid-template-columns:
    1fr 1fr;

  gap: 20px;
}

.deal-box {

  background: #fff;

  border: 1px solid #e5e7eb;

  border-radius: 16px;

  padding: 20px;

  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.05);
}

.deal-box-title {

  font-size: 18px;

  font-weight: 600;

  margin-bottom: 18px;

  display: flex;

  align-items: center;

  gap: 10px;

  color: #2563eb;
}

.deal-box .input-group,
.deal-box .form-group {

  margin-bottom: 16px;
}

.deal-box select,
.deal-box input {

  width: 100%;
}

/* MOBILE */

@media(max-width:900px) {

  .deal-sections {

    grid-template-columns:
      1fr;
  }
}

/* =========================
   STICKY TOTAL ROW
========================= */

.total-row {
  position: sticky;
  bottom: 0;
  z-index: 20;

  background: #0f172a !important;
  color: #fff !important;

  font-weight: 700;
}

.total-row td {
  background: #0f172a !important;
  color: #22c55e !important;

  border-top: 2px solid #fff;
}

/* TABLE SCROLL */
#dealTableWrap {
  max-height: 75vh;
  overflow: auto;
}

/* =========================
   DELETED ROW
========================= */

.deleted-row {

  opacity: 0.55;

  filter: blur(1px);

  background: #ffe5e5 !important;

  pointer-events: none;

  user-select: none;
}

.deleted-row td {

  color: #dc2626 !important;


}

/* ==========================================================================
   MOBILE & RESPONSIVE DEALS PAGE OVERRIDES (<= 768px)
   ========================================================================== */

@media (max-width: 768px) {
  .deal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .deal-actions {
    text-align: left;
  }

  .deal-actions .btn {
    width: 100%;
    padding: 10px;
  }

  /* Metric/Stats stacking */
  .deal-stats {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px 18px;
  }

  .stat-card p {
    font-size: 20px;
  }

  /* Toolbar styling overrides (prevent search input overlapping tools) */
  .deal-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 8px 0;
  }

  .toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .toolbar-left .tool-btn {
    flex-grow: 1;
    justify-content: center;
    padding: 10px;
  }

  .toolbar-right {
    position: static;
    transform: none;
    width: 100%;
  }

  .tool-search {
    width: 100%;
    max-width: 100%;
    background: linear-gradient(145deg, #f39c12, #e67e22);
    box-sizing: border-box;
    padding: 10px 12px;
  }

  /* Modal scaling overrides */
  .modal-content {
    width: 92%;
    margin: 15px auto;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
  }

  .modal-body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(92vh - 120px);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Deal form sections stack */
  .deal-sections {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .deal-box {
    padding: 14px;
    border-radius: 12px;
  }

  .deal-box-title {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .deal-box .input-group,
  .deal-box .form-group {
    margin-bottom: 12px;
  }

  .modal-footer {
    padding: 12px 16px;
    gap: 8px;
  }

  .modal-footer .btn {
    flex-grow: 1;
    text-align: center;
    padding: 12px;
  }

  /* Table responsive wrap */
  #dealTableWrap {
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: none;
    max-height: 65vh;
  }

  #dealTable {
    font-size: 11px;
    min-width: 1500px;
    /* Ensure layout scrolls nicely */
  }

  #dealTable th {
    padding: 6px;
    font-size: 11px;
  }

  #dealTable td {
    padding: 5px;
  }

  /* Sticky col overrides on narrow screen to keep readability */
  .sticky-col {
    position: sticky;
    left: 0;
    background: #fff !important;
    z-index: 1;
  }

  .sticky-col2 {
    position: sticky;
    left: 40px;
    background: #fff !important;
    z-index: 1;
  }
}


.whatsapp-option {
  margin-right: auto;
}

.whatsapp-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #25D366;
  user-select: none;
}

.whatsapp-label input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.whatsapp-label i {
  font-size: 18px;
}