/* ============================================
   GrafikSystem26 - Design System
   ============================================
   Base: Tabler.io (Bootstrap 5)
   Icons: Tabler Icons (ti ti-*)
   Theme: Light default, dark for control/runtime
   ============================================

   TABLE PATTERN — use this structure for all new tables:

   <div class="card">
     <div class="table-toolbar">
       <div class="input-icon search-input">
         <span class="input-icon-addon"><i class="ti ti-search"></i></span>
         <input type="text" class="form-control" placeholder="Search..." data-filter-search="TABLE-ID">
       </div>
       <select class="form-select filter-select" data-filter-col="TABLE-ID" data-col="COLUMN-INDEX">
         <option value="">All ...</option>
       </select>
     </div>
     <div class="table-card-overflow">
       <table class="table table-vcenter card-table" id="TABLE-ID">
         <thead>
           <tr><th>...</th><th class="w-1"></th></tr>
         </thead>
         <tbody>
           <tr data-empty-row style="display:none">
             <td colspan="N" class="table-empty">No matching items</td>
           </tr>
           <tr data-filterable-row>
             <td>...</td>
             <td>
               <div class="row-actions">
                 <a href="#" class="row-action" title="Edit"><i class="ti ti-edit"></i></a>
                 <a href="#" class="row-action text-danger" title="Delete"><i class="ti ti-trash"></i></a>
               </div>
             </td>
           </tr>
         </tbody>
       </table>
     </div>
   </div>

   ROLE BADGES:
     <span class="badge badge-role-superadmin">superadmin</span>
     <span class="badge badge-role-admin">admin</span>
     <span class="badge badge-role-editor">editor</span>
     <span class="badge badge-role-operator">operator</span>
     <span class="badge badge-role-data_entry">data_entry</span>

   DELETE CONFIRM MODAL:
     Use .modal-danger-icon with <i class="ti ti-alert-triangle icon"></i>

   ============================================ */

/* --- Global border-radius override --- */
:root {
  --tblr-border-radius: 8px;
  --tblr-border-radius-sm: 6px;
  --tblr-border-radius-lg: 12px;
  --tblr-border-radius-xl: 16px;
  --tblr-primary: #074d3e;
  --tblr-primary-rgb: 7, 77, 62;
}

.btn-primary {
  --tblr-btn-bg: #074d3e;
  --tblr-btn-border-color: #074d3e;
  --tblr-btn-hover-bg: #063f33;
  --tblr-btn-hover-border-color: #063f33;
  --tblr-btn-active-bg: #053328;
  --tblr-btn-active-border-color: #053328;
}

.navbar {
  background: #074d3e;
  border-bottom: none;
}

.navbar-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.navbar-logo-mark {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link {
  color: rgba(255,255,255,0.85) !important;
}
.nav-link:hover {
  color: #fff !important;
}

.vr {
  border-color: rgba(255,255,255,0.2);
  opacity: 1;
}

.btn-ghost-danger, .row-action.text-danger {
  color: #c44040 !important;
}
.btn-ghost-danger:hover, .row-action.text-danger:hover {
  color: #a83232 !important;
  background: rgba(196, 64, 64, 0.08);
}

.card {
  border-radius: var(--tblr-border-radius-lg);
}

.btn {
  border-radius: 10px !important;
}
.btn-icon {
  border-radius: 10px !important;
}

.form-control,
.form-select {
  border-radius: var(--tblr-border-radius);
}

.modal-content {
  border-radius: var(--tblr-border-radius-lg);
}

.badge {
  border-radius: var(--tblr-border-radius-sm);
}

.dropdown-menu {
  border-radius: var(--tblr-border-radius);
}

.alert {
  border-radius: var(--tblr-border-radius);
}

/* --- Remove focus outline on interactive elements --- */
.nav-link:focus,
.dropdown-toggle:focus,
.btn:focus,
.row-action:focus {
  outline: none;
  box-shadow: none;
}

/* --- Layout --- */
.page-wrapper {
  min-height: calc(100vh - 3.5rem);
}

/* --- Tables --- */
.card-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-secondary);
}

.card-table thead tr:first-child th:first-child {
  border-top-left-radius: var(--tblr-border-radius-lg);
}
.card-table thead tr:first-child th:last-child {
  border-top-right-radius: var(--tblr-border-radius-lg);
}

.card-table td {
  vertical-align: middle;
}

.card-table tbody tr:last-child td {
  border-bottom: none;
}

/* Fix dropdown inside table cards */
.table-card-overflow {
  overflow: visible;
}

/* --- Table toolbar (search + filters) --- */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--tblr-border-color);
  align-items: center;
}

.table-toolbar .search-input {
  max-width: 260px;
}

.table-toolbar .filter-select {
  max-width: 200px;
}

/* --- Row action icons --- */
.row-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--tblr-secondary);
  font-size: 1.125rem;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--tblr-border-radius);
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.row-action:hover {
  color: var(--tblr-body-color);
  background: var(--tblr-bg-surface-secondary);
  transform: scale(1.1);
  text-decoration: none;
}

/* --- Badges --- */
.badge-role-superadmin {
  background: var(--tblr-red);
  color: #fff;
}

.badge-role-admin {
  background: var(--tblr-purple);
  color: #fff;
}

.badge-role-editor {
  background: var(--tblr-azure);
  color: #fff;
}

.badge-role-operator {
  background: var(--tblr-green);
  color: #fff;
}

.badge-role-data_entry {
  background: var(--tblr-orange);
  color: #fff;
}

/* --- Empty state --- */
.table-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--tblr-secondary);
}

/* --- Delete modal warning --- */
.modal-danger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--tblr-danger-lt);
  color: var(--tblr-danger);
  margin-bottom: 1rem;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
  .table-toolbar {
    flex-direction: column;
  }

  .table-toolbar .search-input,
  .table-toolbar .filter-select {
    max-width: 100%;
    width: 100%;
  }
}

/* ============================================
   Project Navigation
   ============================================ */
.project-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.project-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  border-radius: var(--tblr-border-radius);
  border: 1px solid var(--tblr-border-color);
  background: var(--tblr-bg-surface);
  color: var(--tblr-body-color);
  text-decoration: none;
  min-width: 100px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.project-nav-item:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--tblr-primary);
  box-shadow: 0 4px 12px rgba(var(--tblr-primary-rgb), 0.2);
  color: var(--tblr-primary);
}
.project-nav-item:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(var(--tblr-primary-rgb), 0.15);
}
.project-nav-item.active {
  border-color: var(--tblr-primary);
  background: rgba(var(--tblr-primary-rgb), 0.04);
  color: var(--tblr-primary);
}
.project-nav-item i {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.project-nav-item .nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}
.project-nav-sub {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.project-nav-sub.show {
  display: flex;
}
.project-nav-sub-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--tblr-border-radius);
  border: 1px solid var(--tblr-border-color);
  background: var(--tblr-bg-surface);
  color: var(--tblr-body-color);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.project-nav-sub-item:hover {
  border-color: var(--tblr-primary);
  color: var(--tblr-primary);
  text-decoration: none;
}
.project-nav-sub-item.active {
  border-color: var(--tblr-primary);
  background: rgba(var(--tblr-primary-rgb), 0.04);
  color: var(--tblr-primary);
}
.project-nav-sub-item i { font-size: 0.875rem; }
