/* ============================================================
   theme-purple.css
   Bridges the app's existing hand-rolled component classes
   (page-heading, master-card, table-card, add-button, alert,
   dialog editors, metric cards, etc.) onto the PurpleAdmin
   visual language, WITHOUT changing any view markup or
   controller logic. Loaded last so it wins the cascade.
   ============================================================ */

:root{
  --brand-purple: #9a55ff;
  --brand-purple-dark: #6a008a;
  --brand-purple-light: #da8cff;
  --brand-gradient: linear-gradient(to right, #da8cff, #9a55ff);
  --ink: #3e4b5b;
  --muted: #6c7383;
  --card-shadow: 0 0 20px 0 rgba(0,0,0,.06);
  --card-radius: 10px;
}

/* ---------- Page headings ---------- */
.page-heading, .dashboard-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  flex-wrap:wrap; gap:1rem; margin-bottom:1.75rem;
}
.page-heading .eyebrow, .dashboard-head .eyebrow, .hero .eyebrow{
  text-transform:uppercase; letter-spacing:.08em; color:var(--brand-purple);
  font-weight:700; font-size:.78rem;
}
.page-heading h1, .dashboard-head h1, .hero h1{
  font-size:1.85rem; margin:.25rem 0 .35rem; color:var(--ink); font-weight:600;
}
.page-heading p, .dashboard-head p, .dashboard-caption{
  color:var(--muted); margin:0;
}

/* ---------- Buttons ---------- */
.add-button, .master-card button:not(.link-button):not(.danger):not(.secondary){
  background:var(--brand-gradient); color:#fff; border:0; border-radius:6px;
  padding:.6rem 1.1rem; font-weight:600; cursor:pointer; box-shadow:0 3px 10px rgba(154,85,255,.35);
  transition:opacity .15s ease;
}
.add-button:hover, .master-card button:not(.link-button):not(.danger):not(.secondary):hover{ opacity:.9; }
.master-card .secondary, button.secondary{
  background:#eef0f6; color:var(--ink); border:0; border-radius:6px; padding:.6rem 1.1rem; cursor:pointer;
}
.inline{ display:inline-block; }

/* Small themed action buttons (Edit / Delete links in table rows).
   Reset native <button> chrome first, then apply the pill look —
   without this reset these render with the browser's default
   gray 3-D button box. */
.link-button, .danger, .logout{
  -webkit-appearance:none; appearance:none; font:inherit; cursor:pointer;
  border:0; border-radius:5px; padding:.4rem .9rem; font-size:.82rem; font-weight:600;
  display:inline-flex; align-items:center; line-height:1.2;
}
.link-button{ background:rgba(154,85,255,.12); color:var(--brand-purple-dark); margin-right:.4rem; }
.link-button:hover{ background:rgba(154,85,255,.22); }
.link-button:disabled{ background:#f1f1f5; color:#a9adba; cursor:not-allowed; }
.link-button:disabled:hover{ background:#f1f1f5; }
.danger{ background:rgba(229,56,59,.1); color:#e5383b; }
.danger:hover{ background:rgba(229,56,59,.18); }
.logout{ background:rgba(255,255,255,.12); color:#fff; }
td .link-button, td form.inline{ vertical-align:middle; }
td form.inline .danger{ margin:0; }

/* ---------- Cards / tables ---------- */
.master-card, .table-card, .template-card, .cards article, .next, .metric-card, .chart-card{
  background:#fff; border:0; border-radius:var(--card-radius); box-shadow:var(--card-shadow);
  padding:1.5rem;
}
.master-grid{ gap:1.5rem; }
table{ width:100%; border-collapse:collapse; font-size:.9rem; table-layout:auto; }
th, td{ padding:.85rem .75rem; border-top:1px solid #eef0f6; color:var(--ink); text-align:left; }
th{ color:var(--muted); font-weight:600; text-transform:uppercase; font-size:.72rem; letter-spacing:.04em; white-space:nowrap; }
/* Only the plain Masters/Access-style CRUD tables get their action column
   pinned right + kept narrow — tables with their own last column (Status,
   Details, etc., e.g. Access > Logs) are left to their own/inline styling. */
.master-card table td:last-child, .master-card table th:last-child,
.table-card table td:last-child, .table-card table th:last-child{
  text-align:right; white-space:nowrap; width:1%;
}
tr:hover td{ background:#faf7ff; }
.empty{ color:var(--muted); text-align:center; padding:2rem 0 !important; }

/* ---------- Remaining DigiRidge-green (#154734) brand accents,
   swapped to the purple theme for consistency across every page ---------- */
.filter-btn, .action-bar button:not(.secondary), .upload-row button{
  background:var(--brand-gradient) !important; box-shadow:0 3px 10px rgba(154,85,255,.3);
}
.perm-module-toggle{ color:var(--brand-purple-dark) !important; }
.page-btn.active{ background:var(--brand-gradient) !important; border-color:transparent !important; }
.secondary-button{ color:var(--brand-purple-dark) !important; border-color:#e7d9ff !important; }
.secondary-button:hover{ background:#f7f1ff !important; }
.report-card .report-icon{ color:var(--brand-purple) !important; }
.primary{ background:var(--brand-gradient) !important; }
.user-avatar-placeholder{ background:var(--brand-gradient) !important; }

/* ---------- Forms ---------- */
.master-card input, .master-card select, .master-card textarea,
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea{
  border:1px solid #e2e5ec; border-radius:6px; padding:.6rem .75rem; font-size:.92rem;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.master-card input:focus, .master-card select:focus, .master-card textarea:focus,
input:focus, select:focus, textarea:focus{
  outline:none; border-color:var(--brand-purple); box-shadow:0 0 0 3px rgba(154,85,255,.15);
}
.master-card label{ color:var(--muted); font-weight:600; font-size:.82rem; }

/* ---------- Alerts ---------- */
.alert, .dashboard-message{
  background:#fff6e8; border:1px solid #ffe1a8; color:#8a5a00;
  border-radius:8px; padding:.9rem 1.1rem;
}
.validation{ color:#e5383b; }

/* ---------- Native <dialog> editors used across Masters/Access pages ---------- */
dialog{
  border:0; border-radius:var(--card-radius); box-shadow:0 20px 60px rgba(30,20,60,.25);
  padding:1.75rem; max-width:560px; width:95%;
}
dialog::backdrop{ background:rgba(30,20,60,.45); }
.modal-heading{
  display:flex; align-items:center; justify-content:space-between; margin-bottom:1.1rem;
}
.modal-heading h2{ margin:0; font-size:1.2rem; color:var(--ink); }
.modal-heading .close{
  border:0; background:transparent; font-size:1.4rem; line-height:1; color:var(--muted); cursor:pointer;
}
.modal-actions{ display:flex; justify-content:flex-end; gap:.6rem; }
.modal-actions button:not(.secondary){
  background:var(--brand-gradient); color:#fff; border:0; border-radius:6px; padding:.6rem 1.2rem; font-weight:600;
}
.modal-actions .secondary{ background:#eef0f6; color:var(--ink); border:0; border-radius:6px; padding:.6rem 1.2rem; }

/* ---------- Dashboard metric grid ---------- */
.metrics-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:1.25rem; margin-bottom:1.5rem; }
.metric-card{ display:flex; align-items:center; gap:1rem; }
.metric-icon{
  width:52px; height:52px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:1.3rem; color:#fff; flex:none;
}
.metric-icon.teal{ background:linear-gradient(135deg,#20c9a6,#0fb8ab); }
.metric-icon.blue{ background:linear-gradient(135deg,#7ea6ff,#4298ee); }
.metric-icon.orange{ background:linear-gradient(135deg,#ffb37e,#ff8a3d); }
.metric-icon.green{ background:linear-gradient(135deg,#7fe0a0,#2fbf71); }
.metric-icon.red{ background:linear-gradient(135deg,#ff8fa3,#ef4a67); }
.metric-title{ color:var(--muted); font-size:.82rem; }
.metric-number{ font-size:1.6rem; font-weight:700; color:var(--ink); }

/* ---------- Dashboard activity / chart cards ---------- */
.dashboard-row{ display:grid; grid-template-columns:1.4fr 1fr; gap:1.5rem; align-items:start; }
.card-title{ font-weight:700; color:var(--ink); }
.chart-number{ font-size:1.6rem; font-weight:700; color:var(--ink); }
.metric-change{ color:#2fbf71; font-size:.85rem; font-weight:600; }
.chart-sub{ color:var(--muted); font-size:.85rem; }
.chart-tabs span{ color:var(--muted); font-size:.8rem; margin-left:.6rem; cursor:pointer; }
.chart-tabs span.selected{ color:var(--brand-purple); font-weight:700; }
.chart-footer{ display:flex; gap:1.5rem; margin-top:.75rem; color:var(--muted); font-size:.85rem; }
.legend-dot{ display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--brand-purple); margin-right:.4rem; }
.legend-dot.blue{ background:#4298ee; }
.activity-new{ display:flex; gap:.85rem; padding:.7rem 0; border-top:1px solid #f1eefc; }
.activity-new:first-child{ border-top:0; }
.activity-avatar-new{
  width:38px; height:38px; border-radius:50%; background:var(--brand-gradient); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:.8rem; flex:none;
}
.activity-text{ color:var(--ink); font-size:.9rem; }
.activity-time-new{ color:var(--muted); font-size:.78rem; }

@media (max-width: 900px){
  .dashboard-row{ grid-template-columns:1fr; }
}

/* ---------- Dashboard metric cards: force all 5 into one row ----------
   flex:1 1 0 (with max-width:none) makes every card exactly 1/5 of the
   row's actual width, shrinking together as the window narrows, so they
   stay on one line at any normal desktop/laptop width instead of
   wrapping once the content area drops below some fixed breakpoint. */
.metric-row{ flex-wrap:nowrap; margin-left:-.5rem; margin-right:-.5rem; }
.metric-row .col-fifth{
  flex:1 1 0; max-width:none; width:auto; padding-left:.5rem; padding-right:.5rem; min-width:0;
}
.metric-row .card-img-holder .card-body{ padding:1.1rem .9rem; overflow:hidden; }
.metric-row .card-img-holder h4{ font-size:.85rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.metric-row .card-img-holder h2{ font-size:1.5rem; margin-bottom:.5rem !important; }
.metric-row .card-img-holder h6{ font-size:.72rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.metric-row .card-img-holder .mdi-24px{ font-size:1.15rem !important; }
@media (max-width: 900px){
  .metric-row{ flex-wrap:wrap; }
  .metric-row .col-fifth{ flex:0 0 50%; max-width:50%; }
}
@media (max-width: 560px){
  .metric-row .col-fifth{ flex:0 0 100%; max-width:100%; }
}

/* ---------- Navbar brand: icon + stacked "Name / TAGLINE" lockup ----------
   Matches the reference brand card: bold dark name on top, small
   letter-spaced gray tagline underneath, icon to the left. The wrapper's
   background is already white (template default), so plain dark text
   reads perfectly here - no contrast issue like the old plain-white text. */
.navbar-brand-wrapper .navbar-brand.brand-logo{
  display:flex !important; align-items:center !important; justify-content:flex-start !important;
  gap:.65rem; padding-left:1.4rem !important; line-height:normal !important;
}
.navbar-brand-wrapper .navbar-brand.brand-logo img{
  width:auto !important; height:36px !important; margin:0 !important; flex:none;
}
.brand-text-stack{ display:flex; flex-direction:column; line-height:1.15; text-align:left; }
.navbar-brand-wrapper .navbar-brand.brand-logo .brand-name-text,
.brand-card-name{
  color:#161a2b !important; font-weight:800 !important; font-size:1.05rem; letter-spacing:-.01em;
}
.navbar-brand-wrapper .navbar-brand.brand-logo .brand-tagline-text,
.brand-card-tagline{
  color:#9195a8; font-weight:700; font-size:.6rem; letter-spacing:.12em;
  text-transform:uppercase; margin-top:.15rem;
}

/* ---------- Brand card (Login page) ----------
   Standalone white rounded card holding the icon + stacked name/tagline
   lockup, matching the reference design: soft shadow, generous padding,
   a small decorative "peek" tab centered on the top edge. */
.brand-card{
  position:relative; display:inline-flex; align-items:center; gap:1rem;
  background:#fff; border-radius:22px; box-shadow:0 14px 34px rgba(30,20,60,.10);
  padding:1.6rem 2.2rem; margin:0 auto 2rem;
}
.brand-card::before{
  content:""; position:absolute; top:-9px; left:50%; transform:translateX(-50%);
  width:60px; height:18px; background:#eef0f6; border-radius:10px 10px 0 0; z-index:-1;
}
.brand-card-icon{ height:44px; width:auto; flex:none; }
.brand-card .brand-card-name{ font-size:1.5rem; }
.brand-card .brand-card-tagline{ font-size:.68rem; }

/* ---------- Sidebar section labels (fallback if template CSS doesn't style nav-category) ----------
   Each section label ("Society setup", "Operations", "Insights", ...) gets a thin divider line
   above it plus breathing room, so the sidebar reads as clearly grouped sections instead of one
   long unbroken list. */
.sidebar .nav-item.nav-category{
  padding:.9rem 1.6rem .3rem; font-size:.7rem; text-transform:uppercase; letter-spacing:.08em;
  color:#a7a3c9; font-weight:700;
  margin-top:.4rem;
  border-top:1px solid rgba(167,163,201,.22);
}

/* Thin separators between the individual links within a section, so each menu item reads as its
   own row instead of one unbroken block of text (same divider weight as the profile dropdown's
   .dropdown-divider elsewhere on this page). Excludes the profile card and the category labels
   themselves, which already get their own spacing/border above. */
.sidebar .nav-item:not(.nav-profile):not(.nav-category) + .nav-item:not(.nav-category) > .nav-link{
  border-top:1px solid rgba(167,163,201,.12);
}

/* ---------- Sidebar: scroll the menu itself, not the whole page ----------
   The vendor sidebar (theme/css/style.css) only pins itself and scrolls internally below 991px
   (see its .sidebar-offcanvas media rule); at desktop widths it's a plain flex item with
   min-height:calc(100vh - 70px) and no overflow handling, so once the menu list (Dashboard +
   Society setup + Operations + Insights + Finance + Advertising + Access & Security, etc.) is
   taller than the viewport, the whole body/html scrolls to reach the bottom items instead of the
   sidebar scrolling on its own. This mirrors that same fixed + internal-scroll treatment at
   desktop widths (same 70px navbar offset and 260px sidebar width already used everywhere else),
   so only the sidebar grows its own scrollbar while the navbar and main content stay put. */
@media (min-width: 992px) {
  .sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    bottom: 0;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .main-panel {
    margin-left: 260px;
  }
}

/* ---------- Scrollbars: one thin, themed style everywhere ----------
   Replaces the thick default gray bars on the sidebar, the page and the table cards. */
html, .sidebar, .table-card, .checkbox-grid, dialog{
  scrollbar-width:thin; scrollbar-color:rgba(154,85,255,.45) transparent;
}
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:rgba(154,85,255,.35); border-radius:8px; }
::-webkit-scrollbar-thumb:hover{ background:rgba(154,85,255,.6); }
::-webkit-scrollbar-corner{ background:transparent; }
.sidebar::-webkit-scrollbar{ width:5px; }
.sidebar{ scrollbar-gutter:stable; }

/* Never let the page itself scroll sideways; wide tables scroll inside their own card. */
.main-panel{ min-width:0; overflow-x:hidden; }
.content-wrapper{ min-width:0; }

/* ---------- List tables fit the screen ----------
   On list pages (table card followed by pagination) table-fit.js caps the card's height to the
   space left in the viewport, so the rows scroll inside the card while the header row stays
   pinned and the pagination stays visible. */
.table-card.fit-screen{ overflow:auto; }
.table-card.fit-screen thead th{
  position:sticky !important; top:0; z-index:2; background:#fff; /* beats the inline relative set by resizable-table.js; sticky still anchors the resize handle */
  box-shadow:inset 0 -1px 0 #eef0f6;
}
