/* MaxOne/client/css/main.css */

/* ==== Main Page Styles ==== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body, html {
  min-height: 100vh;
  background: linear-gradient(135deg, #2980b9, #6dd5fa);
  color: #333;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-x: hidden;
}

.main {
  flex-grow: 1;
  padding: 20px;
}

.mainContainer {
  display: flex;
  flex: 1;
  gap: 20px;
  width: 100%;
  min-height: calc(100vh - 250px);
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
  .mainContainer {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  background: transparent;
  padding: 10px 0 30px;
}

.navbar h1 {
  font-size: 2.2rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.sidebar {
  width: 260px;
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.sidebar button {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}

.sidebar nav a {
  display: block;
  color: #2980b9;
  text-decoration: none;
  font-weight: 600;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  transition: background-color 0.3s;
}

.sidebar nav a:hover {
  background-color: #e3f2fd;
}

.sidebar h3 {
  font-size: 1rem;
  color: #888;
  margin-top: 20px;
  margin-bottom: 10px;
  padding-left: 10px;
  text-transform: uppercase;
  font-weight: bold;
}

.content {
  flex: 1;
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.content h2 {
  margin-bottom: 20px;
  color: #1b5f8a;
}

.footer {
  text-align: center;
  color: white;
  margin-top: 40px;
}

/* ==== licenseBanner ==== */
.licenseBanner {
  width: 100%;
  padding: 10px 15px;
  margin-bottom: 15px;
  font-weight: 600;
  border-radius: 6px;
  color: #ffffff;
  display: none;
}

.licenseBanner.active {
  background-color: #2980b9;
  display: block;
}

.licenseBanner.warning {
  background-color: #f39c12;
  display: block;
}

.licenseBanner.expired {
  background-color: #c0392b;
  display: block;
}

.hidden {
  display: none !important;
}

.upgradeBtn {
  margin-left: 20px;
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  background: #fff;
  color: #c0392b;
  font-weight: bold;
  cursor: pointer;
}

.upgradeBtn:hover {
  background: #eee;
}

/* ==== Disable Module not License ==== */
#sidebar li.disabledModule {
  cursor: not-allowed;
  color: #777 !important;
}
#sidebar li.disabledModule:hover {
  background: none !important;
}

/* ==== Collapsible Sections Styles ==== */
.collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(45deg, #1b5f8a, #3c87c4);
  color: #fff;
  font-size: 1rem;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}

.collapsible:hover {
  background: linear-gradient(45deg, #16608a, #326fa3);
}

.collapsible .icon {
  font-size: 0.9rem;
  margin-left: 10px;
  transition: transform 0.3s ease;
}

.collapsible.active .icon {
  transform: rotate(90deg);
}

.collapsible + .content {
  display: none;
  margin-bottom: 10px;
  padding: 10px 15px;
  background: #f0f4f8;
  border-radius: 8px;
}

.collapsible + .content a {
  display: block;
  color: #1b5f8a;
  text-decoration: none;
  margin-bottom: 8px;
}

.collapsible + .content a:hover {
  text-decoration: underline;
}

.collapsible.active + .content {
  display: block;      /* keep */
  max-height: 9999px;  /* fallback if JS doesn't run */
}

/* ==== Customer Details Styles ==== */
.customerCard h3 {
  border: 1px solid #ddd;
  margin: 0 0 8px;
  font-size: 1rem;
  color: #155555;
  max-width: 400px;
}

.customerCard p {
  margin: 4px 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.customerDetails .collapsible {
  background-color: #007bff;
  color: white;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  border-radius: 5px;
  margin-bottom: 5px;
}

/* ==== Space between Table and Form Styles ==== */
.splitContent {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

/* ==== Container ==== */
.tableContainer {
  flex: 1;              /* keep table on left side */
  overflow-x: auto;     /* horizontal scroll if needed */
  overflow-y: auto;     /* vertical scroll */
  max-height: 600px;    /* adjust until ~10 rows fit */
  display: block;       /* ensures scroll applies properly */
  /* width: 50%; */
}

.formContainer {
  flex: 1;              /* form on right side of table */
}

.rightPanel {
  flex: 1;              /* form on right side of table */
}

.userCustomerPanel {
  flex: 1;              /* form on right side of table */
}

/* When no form/panel content, hide it so table uses full width */
.rightPanel:empty,
.userCustomerPanel:empty,
.formContainer:empty {
  display: none;
}

/* ==== Data Table Styles ==== */
.dataTable {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.dataTable th,
.dataTable td {
  border: 1px solid #ddd;
  text-align: left;
  padding: 8px 12px;
  line-height: 1.4;
  height: 40px;       /* fixes row height */
  vertical-align: middle;
}

.dataTable tr:hover {
  background-color: #f1f1f1;
}

/* ==== Data Form Styles ==== */
#dataForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  /* max-width: 400px;  /* match form width */
}

#dataForm label {
  font-weight: bold;
  text-transform: capitalize;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column; /* stack label above input */
  gap: 4px;
}

#dataForm input,
#dataForm select,
#dataForm textarea,
#dataForm .readOnlyInput {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

/* ==== readOnlyInput Data Styles ==== */
.readOnlyInput {
  background-color: #eee;
  color: #777;
  cursor: not-allowed;
}

/* ==== Search Input Box ==== */
#searchInput {
  width: 50%;
  /* margin: 1px 0 1px; */
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom:10px;
}

/* ==== Result from Search ==== */
.resultItem {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.resultItem:hover {
  background-color: #e3f2fd;   /* same hover color as sidebar nav links */
}

/* ==== All Buttons ==== */
#applyFiltersBtn, #resetFiltersBtn, #idButton {
  background-color: #2980b9;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#applyFiltersBtn:hover, #resetFiltersBtn:hover, #idButton:hover {
  background-color: #1b5f8a;
}

.classButton {
  background-color: #2980b9;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.classButton:hover {
  background-color: #1b5f8a;
}

.dataButton {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.dataButton button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 8px 14px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.dataButton button:hover {
  background-color: #2980b9;
}

.logoutButton {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.logoutButton:hover {
  background-color: #c0392b;
}

/* ==== PASSWORD ==== */
.passwordWrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.passwordInput {
  width: 100%;
  padding-right: 2rem;
  box-sizing: border-box;
}

.togglePassword {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #555;
}

.passwordWrapper .togglePassword:hover {
  color: #000;
}

/* ==== DASHBOARD ==== */
.dashboardCards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.dashboardCard {
  color: #fff;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.dashboardCard span {
  display: block;
  font-size: 1.8rem;
  margin-top: 8px;
}

.dashboardCard:hover {
  transform: scale(1.05);
}
.dashboardCard.total { background: linear-gradient(135deg, #3498db, #2980b9); }
.dashboardCard.newr { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.dashboardCard.inProgress { background: linear-gradient(135deg, #f1c40f, #f39c12); }
.dashboardCard.closed { background: linear-gradient(135deg, #e74c3c, #c0392b); }

/* Charts */
.chartGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.dashboardChart {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

/* Bar Chart */
.barChart {
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  flex-wrap: nowrap;            /* keep bars in one row */
  height: 220px;
  margin-top: 20px;
  gap: 24px;                    /* consistent space between bars */
  padding: 0 10px;
}

/* Each bar column */
.bar {
  width: 60px;                  /* ✅ fixed width for uniform bars */
  flex: 1 1 60px;               /* ✅ grow/shrink flexibly */
  max-width: 80px;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  height: 100%;
  box-sizing: border-box;
}

/* Numeric value above the bar */
.barValue {
  position: absolute;
  top: -22px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  pointer-events: none;
}

/* The actual bar fill */
.barFill {
  width: 70%;
  background: linear-gradient(135deg, #2980b9, #6dd5fa);
  border-radius: 6px 6px 0 0;
  transition: height 0.35s ease;
  box-sizing: border-box;
}

/* Label under bar */
.barLabel {
  transform: rotate(-30deg);
  transform-origin: bottom right; /* ✅ pivot from label's top-right corner */
  white-space: nowrap;
  font-size: 0.84rem;
  text-align: left;           /* ✅ ensures the end of text is the pivot point */
  line-height: 1.2;
  /* pointer-events: none; this is to disable the hover */
}

/* Optional hover to reveal full label */
.barLabel:hover {
  white-space: normal;
  overflow: visible;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  padding: 2px 4px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Pie Chart */
.pieChart {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto;
}

.chartLegend {
  margin-top: 10px;
  text-align: left;
  font-size: 0.9em;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: center;
}

.legendItem {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legendColor {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 2px;
}

/* gauge container & svg */
.gaugeContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 8px;
}

.gaugeChart {
  width: 300px;   /* bigger arc size */
  height: auto;
  display: block;
  margin: 0 auto;
}

.gaugeText {
  text-align: center;
  margin-top: 8px;
  color: #263238;
}

.gaugePercent strong {
  font-size: 1.3rem;
  line-height: 1;
}

.gaugeLabel {
  font-size: 0.95rem;
  color: #555;
  margin-top: 5px;
}

/* 🔹 Legend styling */
.gaugeLegend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: #444;
}

.legendColor {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.legendColor.red { background: #e15759; }
.legendColor.yellow { background: #edc948; }
.legendColor.green { background: #59a14f; }

/* Dashboar Filters */
.dashboardFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.dashboardFilters label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  color: #333;
}

.dashboardFilters select,
.dashboardFilters input {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.dashboardFilters button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: #2980b9;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.dashboardFilters button:hover {
  background: #1f5f8b;
}

/* ==== Dashboard Customer Search ==== */  /* new */
.dashboardCustomerSearch {
  position: relative; /* make suggestions absolute relative to this container */
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboardCustomerSearch input {
  flex: 1; /* take available width */
}

.dashboardCustomerSearch button {
  flex-shrink: 0;
}

.dashboardCustomerSearch label {
  white-space: nowrap;
  font-weight: 500;
}

#customerSearchInput {
  flex: 1;
  min-width: 220px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#customerSuggestions .customerSuggestions {
  position: absolute;
  top: 100%;
  left: calc(95px + 10px); /* adjust if label width changes */
  width: calc(100% - 95px - 10px);
  z-index: 9999;
}

.resultItem {
  padding: 6px 10px;
  cursor: pointer;
}

.resultItem:hover {
  background-color: #f0f0f0;
}

.suggestionsList {
  position: absolute; /* now relative to the search container */
  top: 100%; /* directly below input */
  left: 0;
  width: 100%; /* same width as container */
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
  display: none; /* hide by default */
}

.suggestionItem {
  padding: 6px 10px;
  cursor: pointer;
}

.suggestionItem:hover {
  background-color: #f0f0f0;
}

.noResults {
  padding: 6px 10px;
  color: #666;
}

/* no results / error */
.customerSuggestions .noResults,
.customerSuggestions .error {
  padding: 8px 10px;
  color: #666;
}

.dashboardControlsContainer {
  background-color: #f2f2f2;   /* light grey */
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Make sure search and filters stay nicely spaced */
.dashboardControlsContainer .dashboardCustomerSearch,
.dashboardControlsContainer .dashboard-filters {
  margin-bottom: 8px;
}

/* Ensure the "Clear" button and inputs align */
.dashboardCustomerSearch {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-wrap: wrap;
}
