/* ==========================
   🎨 Root & Global Variables
   ========================== */
:root {
  --main-accent: #255aab;
  --accent-darker: #1e4a91;
  --accent-gradient: #255aab;
  --text-dark: #4a004a;
}



/* ==========================
   🧍 General Styles
   ========================== */
html, body {
  min-height: 100vh;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #333;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: fadeinbg 2s ease-in-out;
}

@keyframes fadeinbg {
  from { background-position: left; }
  to { background-position: right; }
}

.logout {
  text-align: right;
  margin-top: -30px;
  padding-right: 11px;
  text-decoration: underline;
  cursor: pointer;
  color: blue;
}

/* ==========================
   🧩 Header / Navbar
   ========================== */
.logo-bar {
  background-color: var(--main-accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.7rem;
  text-align: center;
  padding: 0.82rem;
  letter-spacing: 1.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  position: relative;
  z-index: 10;
  user-select: none;
}

.logo-bar img {
  height: 38px;
  filter: drop-shadow(0 0 1px var(--main-accent));
}

.addbutton{
        display: flex;
    align-items: flex-end;
    justify-content: right;
}
/* ==========================
   💳 Auth Card
   ========================== */
.auth-card {
  max-width: 410px;
  margin: auto;
  background: linear-gradient(135deg, #fff 80%, #fce9fb 100%);
  border-radius: 18px;
  box-shadow: 0 8px 32px #f6f2f6;
  padding: 2.3rem 1.5rem 1.5rem;
  animation: fadein 0.7s ease forwards;
  color: var(--text-dark);
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: none; }
}

/* ==========================
   🧭 Buttons
   ========================== */
.btn {
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: 30px;
  user-select: none;
}

.btn-primary,
.btn-success {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
}

.btn-primary:hover,
.btn-success:hover,
.btn-warning:hover {
  background: var(--main-accent);
  filter: brightness(0.95);
}

.btn-primary:focus,
.btn-success:focus,
.btn-warning:focus {
  outline: none;
}

/* ==========================
   ➕ Add Button – Responsive Width
   ========================== */

/* Bootstrap 5 is missing w-{breakpoint}-auto utilities — define them */
@media (min-width: 576px) { .w-sm-auto { width: auto !important; } }
@media (min-width: 768px) { .w-md-auto { width: auto !important; } }
@media (min-width: 992px) { .w-lg-auto { width: auto !important; } }
@media (min-width: 1200px){ .w-xl-auto { width: auto !important; } }

/* All "Add"-type action buttons share this class */
.btn-add-action {
  /* intentionally empty — width set via media queries below */
}

/* Mobile (< 576 px): full-width stacked layout */
@media (max-width: 575.98px) {
  .btn-add-action,
  .addbutton .btn,
  button.js-add-action,
  #addBtn,
  #btnAddGRN {
    display: block;
    width: 100% !important;
    min-width: unset;
    max-width: unset;
  }
}

/* Small and up (≥ 576 px): fluid 10 rem → 30 rem */
@media (min-width: 576px) {
  .btn-add-action,
  .addbutton .btn,
  button.js-add-action,
  #addBtn,
  #btnAddGRN {
    width: clamp(10rem, 25vw, 30rem) !important;
    min-width: 10rem;
    max-width: 30rem;
  }
}

/* ==========================
   🏭 Plant / Scope Dropdown (topbar)
   ========================== */

/* searchable-select.js wraps the native select in .ss-wrap — size the wrapper, not the hidden select */
#scopeWrap .ss-wrap {
  width: 220px !important;
  min-width: 220px !important;
}

/* Native select is owned by searchable-select.js (display:none!important) — no width rule needed */

/* Chip is never shown */
#scopeChip {
  display: none !important;
}

/* ==========================
   🧮 Form Controls
   ========================== */
.form-control {
  font-size: 1rem;
  border: 1.8px solid var(--main-accent);
  border-radius: 10px;
  transition: all 0.25s ease-in-out;
  box-shadow: inset 0 1px 5px #f6f2f6;
}

.form-control:focus {
  border-color: var(--main-accent) !important;
  background: #f3f7fb;
  outline: none;
  color: var(--text-dark);
}

/* ==========================
   📋 Table Styles
   ========================== */
.table-scroll-container {
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 350px;
  border-radius: 8px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--main-accent);
  color: #fff;
  font-weight: 600;
  z-index: 5;
}

/* Auto-sizing inputs inside table cells — overrides Bootstrap's width:100% on form-control.
   JS sets style.width from content; min-width prevents collapse on empty/short values. */
.table td input[type="number"].form-control,
.table td input[type="text"].form-control {
  width: auto !important;
  min-width: 70px;
}

.table th,
.table td {
  min-width: 50px;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  color: var(--text-dark);
  border-top: 1px solid #f3ccef;
}

.table-success {
  background: var(--main-accent) !important;
  color: #fff !important;
}

.table-danger {
  background: #b025ae !important;
  color: #fff !important;
}

.table-active {
  background-color: #fcd9fc !important;
}

/* ==========================
   📦 Modal & Dropdown Fix
   ========================== */
.modal {
  z-index: 1050 !important;
}

.modal-backdrop {
  z-index: 1040 !important;
}

.modal-dialog {
  max-width: 90vw !important;
  margin: 1rem auto;
}

.modal-content {
  border-radius: 12px;
  border: 1.5px solid #637bf1;
  background: #edf1fc;
  box-shadow: 0 8px 30px #f163f140;
  /* overflow: hidden; */
}

.modal-header {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-header .btn {
  white-space: nowrap;
}

.modal .dropdown-menu {
  position: absolute !important;
  z-index: 9999 !important;
}
.dropdown{
  position:static;
}

/* ==========================
   🧾 Multi-Select Dropdown
   ========================== */
.multi-select-dropdown {
  position: relative;
  display: inline-block;
  width: 210px;
}

.dropdown-btn {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.dropdown-list {
  display: none;
  position: absolute;
  background: #fff;
  min-width: 210px;
  border: 1px solid #ccc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  z-index: 1;
}

.dropdown-list label {
  display: block;
  padding: 6px 10px;
  cursor: pointer;
}

.dropdown-list input {
  margin-right: 8px;
}

.multi-select-dropdown.open .dropdown-list {
  display: block;
}

/* ==========================
   ⚠️ Alerts & Links
   ========================== */
.error-message,
.success-message {
  font-size: 0.98rem;
  min-height: 22px;
  font-weight: 600;
  color: var(--main-accent);
}

a, .text-primary {
  color: var(--main-accent) !important;
  transition: color 0.2s ease-in-out;
}

a:hover, a:focus {
  color: var(--accent-darker) !important;
  text-decoration: underline;
  outline: none;
}

/* ==========================
   📱 Responsive Adjustments
   ========================== */
@media (max-width: 576px) {
  body, html {
    overflow-x: hidden;
  }

  .auth-card {
    padding: 1rem;
  }

  .logo-bar {
    font-size: 1.25rem;
    padding: 0.55rem 0;
  }

  .modal-dialog {
    max-width: 95vw !important;
    margin: 0.5rem auto;
  }

  .modal-header,
  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .modal-header .btn,
  .modal-footer .btn {
    width: 100%;
  }

  .table-scroll-container {
    max-height: 250px;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    min-width: 50px;
  }
}

.table-responsive{
  max-height: 400px;
}

/* ==========================
   Raj-style App Shell + Left Navigation Drawer
   (ported from Raj Ceramics to Water Tank)
   ========================== */

html, body {
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

body {
  overflow-x: hidden;
}

/* Header tightening + mobile header (Raj-style) */
.logo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1040;
  margin: 0;
  border-radius: 0;
  min-height: 48px;
}

.logo-bar #username {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: #fff;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.logo-bar .dropdown {
  position: relative;
  z-index: 1050;
}

.logo-bar .dropdown-menu {
  z-index: 1051 !important;
  position: absolute !important;
  margin-top: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  min-width: 160px !important;
  background: #fff !important;
}

.logo-bar-mobile {
  background-color: var(--main-accent);
  color: #fff;
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo-bar-mobile .btn-light {
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-weight: 500;
}

.logo-bar-mobile .btn-light:hover {
  background-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.logo-bar-mobile .dropdown-menu {
  margin-top: 0.5rem;
}

.logo-bar-mobile #mobile-panel-title {
  color: #fff;
  font-weight: 500;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  align-items: stretch;
  flex-direction: row;
  justify-content: flex-start;
}

.nav-drawer {
  width: 280px;
  flex: 0 0 280px;
  background-color: #fff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 100;
  margin: 0;
  padding: 0;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  transition: margin-left 0.25s ease;
  margin-left: 0;
  min-width: 0;
  margin-top: 0 !important;
  padding-top: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

@media (min-width: 992px) {
  .nav-drawer {
    width: 280px;
    flex: 0 0 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    transform: none;
    display: none; /* open via hamburger */
  }

  body.drawer-open .nav-drawer {
    display: block;
    transform: none;
  }

  .drawer-backdrop {
    display: none !important;
    pointer-events: none !important;
  }

  .app-topbar,
  .topbar,
  .logo-bar {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    position: sticky;
    top: 0;
    z-index: 1000;
  }
}

@media (max-width: 991px) {
  .nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 70vw;
    max-width: 320px;
    z-index: 1050;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  }

  .nav-drawer.open {
    transform: translateX(0);
  }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  background-color: var(--main-accent);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-header h5 {
  color: #fff;
  margin: 0;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.btn-close-drawer:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.drawer-body {
  padding: 1rem;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

@media (max-width: 991px) {
  .drawer-backdrop.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}

.drawer-toggle-desktop,
.drawer-toggle-mobile {
  transition: background-color 0.2s;
}

.drawer-toggle-desktop:hover,
.drawer-toggle-mobile:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.role-panel-nav {
  overflow: visible;
}

.role-nav-item {
  margin-bottom: 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.role-nav-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: #f8f9fa;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
  font-weight: 600;
  color: #333;
}

.role-nav-header:hover {
  background-color: #e9ecef;
}

.role-nav-header.expanded {
  background-color: var(--main-accent);
  color: #fff;
}

.role-toggle-icon {
  font-size: 1.2rem;
  font-weight: bold;
  width: 20px;
  text-align: center;
  line-height: 1;
}

.role-name {
  flex: 1;
}

.role-panels {
  display: none;
  padding: 0.5rem;
  background-color: #fff;
}

.role-panels.show {
  display: block;
}

.panel-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  transition: all 0.2s;
  cursor: pointer;
}

.panel-nav-item:hover {
  background-color: #f0f7ff;
  border-left: 4px solid var(--main-accent);
  padding-left: calc(1rem - 4px);
}

.panel-nav-item.active {
  background-color: #e3f2fd;
  border-left: 4px solid var(--main-accent);
  padding-left: calc(1rem - 4px);
  font-weight: 600;
  color: var(--main-accent);
}

.panel-nav-item.hidden,
.role-nav-item.hidden {
  display: none;
}

/* ==========================
   Force overrides (last-wins)
   ========================== */
/* Width on the ss-wrap (searchable-select container), not the hidden native select */
#scopeWrap .ss-wrap {
  width: 220px !important;
  min-width: 220px !important;
}