:root {
  --bg: #0b1220;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.09);
  --text: #eef4ff;
  --muted: rgba(238,244,255,0.72);
  --line: rgba(255,255,255,0.10);
  --accent: rgba(90, 148, 255, 0.95);
  --radius: 16px;
}

* { box-sizing: border-box; }
body.tdq-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(900px 500px at 12% 18%, rgba(90,148,255,0.20), transparent 55%),
              radial-gradient(900px 600px at 92% 70%, rgba(90,148,255,0.12), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* =========================
   HEADER & NAV
========================= */
.tdq-header {
  position: sticky;
  top: 0;
  z-index: 50;
  
  /* The Glass Effect */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); /* Safari support */
  
  /* Semi-transparent background (matching your dark blue theme) */
  background: rgba(15, 31, 56, 0.65); 
  
  /* Frosted edge */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}



.tdq-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tdq-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tdq-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: block;
}
.tdq-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.tdq-brand-text strong {
  font-size: 15px;
  font-weight: 600;
}
.tdq-brand-text span {
  font-size: 13px;
  opacity: 0.7;
}
.tdq-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tdq-navlink {
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tdq-navlink:hover {
  border-color: var(--line);
  background: rgba(255,255,255,0.05);
}

/* =========================
   GENERAL MAIN & FORMS
========================= */
.tdq-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 18px;
}
.tdq-card {
  grid-column: span 6;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  line-height: 1.55;
}
.tdq-card-narrow {
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* Base button style - auto width */
.tdq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}
.tdq-btn:hover { background: rgba(255,255,255,0.1); }

.tdq-btn-primary {
  border-color: rgba(90,148,255,0.55);
  background: rgba(90,148,255,0.18);
}
.tdq-btn-primary:hover { background: rgba(90,148,255,0.26); }
.tdq-btn-ghost { background: transparent; }
.tdq-btn-ghost:hover { background: rgba(255,255,255,0.07); }

/* Force buttons in Forms to be 100% width (Login/Register) */
.tdq-form input[type="submit"],
.tdq-form button[type="submit"],
.tdq-form .tdq-btn {
  display: block;
  width: 100%;
  text-align: center;
}

.tdq-form { display: grid; gap: 12px; margin-top: 12px; }
.tdq-label { margin-top: 4px; font-size: 0.95rem; color: var(--muted); }
.tdq-input {
  width: 100%;
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 30, 0.55);
  color: var(--text);
}
.tdq-input:focus { border-color: rgba(90,148,255,0.65); outline: none; }

.tdq-flashes { margin: 8px 0 14px; display:grid; gap: 8px; }
.tdq-flash {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
}
.tdq-alert {
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.4);
  color: #ffb3b3;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}
/* =========================================
   CUSTOM SCROLLBAR (Glassy/Modern Style)
   ========================================= */

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(150, 150, 150, 0.4) transparent; 
}

/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px; /* Width of the vertical scrollbar */
  height: 8px; /* Height of the horizontal scrollbar */
}

/* The track (background) of the scrollbar */
::-webkit-scrollbar-track {
  background: transparent; 
}

/* The draggable thumb of the scrollbar */
::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.3); /* Semi-transparent gray */
  border-radius: 10px; /* Fully rounded edges */
}

/* Hover state for the thumb */
::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 150, 150, 0.6); /* Darkens slightly when hovered */
}

/* ===============================
   DASHBOARD — PREMIUM POLISH PASS
=============================== */
.dash { padding: 28px 18px 70px; width: 100%; }
.dash-shell { max-width: 1120px; margin: 0 auto; }

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.dash-head-text { flex: 1; }
.dash-title { font-size: 30px; margin: 0 0 6px; letter-spacing: .2px; }
.dash-sub { margin: 0; opacity: .82; max-width: 68ch; line-height: 1.55; }
.dash-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr .95fr;
  gap: 24px; /* Increased gap between columns */
  align-items: start;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 24px; /* This gives beautiful vertical breathing room between cards */
}

/* Dashboard Cards */
.dash-card {
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 44px rgba(0,0,0,0.30);
  padding: 24px; /* Increased padding */
  backdrop-filter: blur(10px);
}
.dash-card-soft {
  background: rgba(255,255,255,0.04);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.dash-card h2 { margin: 0; font-size: 16px; letter-spacing: .2px; }
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px;
}
.dash-pill {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  background: rgba(80,150,255,0.12); border: 1px solid rgba(80,150,255,0.22); opacity: .95;
}

/* Dashboard List Items */
.dash-list { display: grid; gap: 12px; }
.dash-item {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.12); text-decoration: none; color: inherit;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
.dash-item:hover {
  transform: translateY(-2px); border-color: rgba(120,180,255,0.38); background: rgba(0,0,0,0.18);
}
.dash-item-title { font-weight: 800; letter-spacing: .2px; margin-bottom: 4px; }
.dash-item-meta { font-size: 13px; opacity: .78; line-height: 1.35; }
.dash-item-side { text-align: end; min-width: 120px; }
.dash-date { font-size: 12px; opacity: .68; }
.dash-date-strong { font-weight: 800; }

/* Empty States */
.dash-empty {
  padding: 20px; border-radius: 14px; border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.10);
}
.dash-empty-title { font-weight: 900; margin-bottom: 6px; }
.dash-empty-sub { opacity: .8; font-size: 13px; max-width: 56ch; line-height: 1.5; }
.dash-empty-actions { margin-top: 16px; display: flex; gap: 12px; flex-wrap: wrap; }

/* Feature Aside */
.dash-feature::before {
  content: ""; position: absolute; inset: -40px -60px auto -60px; height: 180px;
  background: radial-gradient(closest-side, rgba(80,150,255,0.28), transparent 70%);
  pointer-events: none;
}
.dash-feature-top { position: relative; }
.dash-kicker { font-size: 12px; opacity: .78; letter-spacing: .6px; }
.dash-feature-title { font-size: 20px; font-weight: 900; margin-top: 6px; letter-spacing: .2px; }
.dash-kv {
  position: relative; margin-top: 16px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.10); display: grid; gap: 12px;
}
.dash-kv-row { display: grid; grid-template-columns: 108px 1fr; gap: 10px; align-items: baseline; }
.dash-kv-row .k { opacity: .72; font-size: 13px; }
.dash-kv-row .v { font-weight: 650; }
.dash-kv-row .v-strong { font-weight: 900; }

/* The aside buttons look best full width, so we grid them */
.dash-btns { position: relative; margin-top: 20px; display: grid; gap: 12px; }
.dash-btns .tdq-btn { width: 100%; }

.dash-ul { margin: 12px 0 0; padding-inline-start: 18px; opacity: .86; display: grid; gap: 8px; }

/* ===============================
   FOOTER
=============================== */
.tdq-footer { border-top: 1px solid var(--line); color: var(--muted); padding: 14px 0; }
.tdq-footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display:flex; gap: 10px; align-items:center; justify-content:center;
}
.tdq-dot { opacity: 0.6; }

/* ===============================
   PASSWORD TOGGLE
=============================== */
.tdq-password-wrap { position: relative; }
.tdq-password-toggle {
  position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; padding: 6px; cursor: pointer; z-index: 5;
}
.tdq-password-toggle .tdq-eye { width: 20px; height: 20px; display: inline-flex; }
.tdq-password-toggle .tdq-eye-closed { display: none; }
.tdq-password-wrap.is-revealed .tdq-eye-open { display: none; }
.tdq-password-wrap.is-revealed .tdq-eye-closed { display: inline-flex; }
[dir="ltr"] .tdq-input-password { padding-right: 46px !important; padding-left: 14px !important; }
[dir="rtl"] .tdq-input-password { padding-left: 46px !important; padding-right: 14px !important; }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

/* =========================
   CLEANED UP RTL GLOBAL SUPPORT
========================= */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
  font-family: system-ui, "Vazirmatn", "IRANSans", Tahoma, Arial, sans-serif;
}

/* Reverse Header layout */
html[dir="rtl"] .tdq-header-inner { flex-direction: row-reverse; }
html[dir="rtl"] .tdq-brand { flex-direction: row-reverse; text-align: right; }
html[dir="rtl"] .tdq-nav { flex-direction: row; justify-content: center !important; }


/* Reverse elements alignment */
html[dir="rtl"] .dash-item-side,
html[dir="rtl"] .dash-row-side { text-align: start; }

/* Ensure Cards obey RTL */
html[dir="rtl"] .tdq-card,
html[dir="rtl"] .dash-card,
html[dir="rtl"] .tdq-card *,
html[dir="rtl"] .dash-card * {
  direction: rtl;
  text-align: right;
}

/* Keep form inputs strictly LTR (for emails/passwords) */
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] input::placeholder {
  direction: ltr !important;
  text-align: left !important;
}

/* Keep Submit button text centered */
html[dir="rtl"] input[type="submit"] { text-align: center !important; }

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 920px) {
  .dash-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-feature { position: static; }
  .tdq-header-inner { flex-wrap: nowrap; }
}

/* Ensure the modal content allows the dropdown to pop out */
.modal-content, .edit-modal-container { 
    overflow: visible !important; 
}

/* Ensure the select/dropdown wrapper has a high z-index when open */
.form-group select, .custom-select {
    position: relative;
    z-index: 1050; /* Higher than the modal background */
}

/* If you are using a custom styled list for the dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1100;
    display: block; /* Ensure it's not hidden by default if testing */
}
/* Force the dropdown to stay on top of everything else */
select:focus + .dropdown-list, .status-dropdown-options {
    position: absolute;
    width: 100%;
    background: #1a2238; /* Match your theme color */
    border: 1px solid var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 9999;
}
/* Fix the dropdown appearance */
select.form-select, .form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none; /* Removes default browser styling */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Ensure the dropdown list is visible and stays inside the modal */
select option {
    background-color: #1a1a2e; /* Match your modal background */
    color: white;
    padding: 10px;
}

/* Crucial: Prevent the modal from clipping its children */
.modal-content {
    overflow: visible !important;
}

.modal-body {
    position: relative;
    z-index: 10;
}
/* Styling for Flash Messages */
.flash-messages-container {
  margin-bottom: 20px;
}

.flash-message {
  padding: 12px 20px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 500;
}

.flash-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.flash-error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}
.status-badge {
    padding: 5px 12px; 
    border-radius: 20px; 
    font-size: 11px; 
    font-weight: bold; 
    text-transform: uppercase; 
    display: inline-block;
}

.status-approved {
    background: rgba(16, 185, 129, 0.2); 
    color: #10b981; 
    border: 1px solid #10b981;
}

.status-rejected {
    background: rgba(239, 68, 68, 0.2); 
    color: #ef4444; 
    border: 1px solid #ef4444;
}

.status-pending {
    background: rgba(148, 163, 184, 0.2); 
    color: #94a3b8; 
    border: 1px solid #94a3b8;
}
/* ===================================
   Admin User Management Page Styles
   =================================== */

/* Use the same shell as other dash pages */
.dash-shell {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dash-header h1 {
    margin: 0;
}

/* Table container to allow for scrolling on small screens if needed */
.table-container {
    overflow-x: auto;
    background-color: var(--shell-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.tdq-table {
    width: 100%;
    border-collapse: collapse;
}

.tdq-table th, .tdq-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.tdq-table thead th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tdq-table tbody tr:last-child td {
    border-bottom: none;
}

.tdq-table tbody tr:hover {
    background-color: var(--hover-color);
}

/* Status badges for roles */
.status-badge.status-admin {
    background-color: rgba(118, 75, 224, 0.1);
    color: #a182ff;
}

.status-badge.status-client {
    background-color: rgba(0, 150, 255, 0.1);
    color: #4bafff;
}


/* ===================================
   Modal Fixes (Centering and Styling)
   =================================== */

.modal-backdrop {
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    
    /* This is the magic for centering */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1e2530; /* Fallback solid dark color */
    background-color: var(--shell-color, #1e2530); /* Uses your existing panel color */
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* Made shadow slightly darker for depth */
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}


/* Form styles within the modal */
.modal-form .form-group {
    margin-bottom: 1.2rem;
}

.modal-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}
/* ===================================
   Action Buttons (Edit/Delete)
   =================================== */

/* Base small button adjustments */
.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Outline button (for Edit) */
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color, #4a5568);
    color: var(--text-color, #e2e8f0);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #718096;
}

/* Danger button (for Delete) */
.btn-danger {
    background-color: transparent;
    border: 1px solid rgba(231, 76, 60, 0.5);
    color: #e74c3c;
}

.btn-danger:hover {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Add a little gap between the buttons */
.tdq-table td button {
    margin-right: 5px;
}
/* Solid Danger button (for Modal Confirm) */
.btn-danger-solid {
    background-color: #e74c3c;
    color: white;
    border: 1px solid #e74c3c;
}

.btn-danger-solid:hover {
    background-color: #c0392b;
    border-color: #c0392b;
    color: white;
}
/* =========================================
   GLOBAL TABLE & MOBILE CARD STYLES
   ========================================= */
.table-container {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 24px;
}

.tdq-table {
    width: 100%;
    border-collapse: collapse;
}

.tdq-table th, .tdq-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

/* RTL Support */
html[dir="rtl"] .tdq-table th, 
html[dir="rtl"] .tdq-table td {
    text-align: right;
}

.tdq-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-weight: 600;
}

.tdq-table tr:last-child td {
    border-bottom: none;
}

/* Flex container for action buttons */
.actions-flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Mobile Vertically Responsive (Card View) --- */
@media (max-width: 768px) {
    /* Responsive Headers */
    .admin-header, .dash-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .admin-header h2, .dash-header h1 {
        font-size: 1.5rem;
    }

    .admin-header .tdq-btn, .dash-header .tdq-btn, .dash-header button {
        width: 100%;
        justify-content: center;
        padding: 12px;
        font-size: 1.1rem;
    }

    /* Card Styles */
    .table-container {
        background: transparent;
        border: none;
    }

    .tdq-table thead {
        display: none; /* Hide top headers */
    }

    .tdq-table, .tdq-table tbody, .tdq-table tr, .tdq-table td {
        display: block;
        width: 100%;
    }

    /* Turn rows into cards */
    .tdq-table tr {
        margin-bottom: 16px;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 8px 16px;
    }

    .tdq-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right; /* Values align right on mobile */
    }
    
    html[dir="rtl"] .tdq-table td {
        text-align: left; /* Values align left on mobile in RTL */
    }

    /* Use data-label for mobile headers */
    .tdq-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        text-align: left;
        padding-right: 16px;
    }
    
    html[dir="rtl"] .tdq-table td::before {
        text-align: right;
        padding-right: 0;
        padding-left: 16px;
    }

    /* Style the actions row (last cell) */
    .tdq-table tr td:last-child {
        border-bottom: none;
        flex-direction: column;
        align-items: stretch; /* Stretch content */
        gap: 12px;
        padding-bottom: 8px;
    }

    /* Make buttons flex nicely at the bottom of the card */
    .actions-flex, .tdq-table td:last-child {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Make all buttons inside actions fill space equally */
    .actions-flex .tdq-btn, .tdq-table td:last-child .btn, .tdq-table td:last-child button, .tdq-table td:last-child a {
        flex: 1;
        text-align: center;
        justify-content: center;
        min-width: 80px;
        width: 100%;
    }
}
/* --- Mobile Fixes for Client Portal --- */
@media (max-width: 768px) {
    /* 1. Shrink panel padding on mobile to give cards more breathing room */
    .client-panel {
        padding: 1rem !important;
    }

    /* 2. Allow breadcrumbs to wrap nicely if project names are long */
    .custom-breadcrumb {
        flex-wrap: wrap;
        row-gap: 8px;
        line-height: 1.5;
    }

    /* 3. Force long filenames to wrap to the next line instead of stretching the screen */
    .tdq-table td {
        gap: 16px; /* Adds space between the label and the value */
    }

    .tdq-table td > a, 
    .tdq-table td > strong, 
    .tdq-table td > span {
        max-width: 65%; /* Prevents the text from crushing the label */
        word-wrap: break-word;
        word-break: break-word;
        text-align: right;
        line-height: 1.4;
    }
    
    html[dir="rtl"] .tdq-table td > a, 
    html[dir="rtl"] .tdq-table td > strong, 
    html[dir="rtl"] .tdq-table td > span {
        text-align: left;
    }

    /* Keep the status badge centered/styled correctly when it wraps */
    .tdq-table td > .status-badge {
        text-align: center;
        max-width: max-content;
    }
}
/* =========================================
   GLOBAL MODAL STYLES (Fixes positioning)
   ========================================= */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed; /* Floats over the entire page */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6); /* Dark semi-transparent background */
    backdrop-filter: blur(3px); /* Optional: blurs the table behind it */
    z-index: 9999; /* Ensures it sits on top of all other elements */
    align-items: center; /* Centers vertically */
    justify-content: center; /* Centers horizontally */
}

/* When the JS adds the 'active' class, change display to flex to show it */
.modal-overlay.active {
    display: flex; 
}

.modal-content {
    background-color: #161b26; /* Changed from var(--panel) to a solid hex color */
    padding: 24px;
    border-radius: var(--radius, 12px);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7); /* Made shadow slightly darker */
    max-height: 90vh;
    overflow-y: auto;
}


/* =========================================
   TABLE ACTIONS FLEX (Fixes mobile buttons)
   ========================================= */
.actions-flex {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap; /* Important: Allows buttons to wrap to the next line on narrow mobile screens */
}
.admin-header {
    margin-bottom: 24px; /* Adds space below the create button */
}
/* =========================================
   TABLE ACTIONS GRID (2 Top, 1 Bottom Full-Width)
   ========================================= */
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Creates exactly two equal-width columns */
    gap: 8px;                       /* Adds space between the buttons */
    align-items: center;
}

/* Force the form containing the Delete button to span across both columns */
.actions-grid form {
    grid-column: 1 / -1; 
    margin: 0; 
}

/* Ensure buttons take up the full width of their assigned grid cells */
.actions-grid a,
.actions-grid button {
    width: 100%;
    margin: 0; 
    box-sizing: border-box;
    text-align: center;
}
/* Styling for the client portal tables and panels */
    .custom-breadcrumb {
        display: flex;
        list-style: none;
        padding: 0;
        margin-bottom: 1.5rem;
        font-size: 0.95rem;
    }
    .custom-breadcrumb li {
        display: flex;
        align-items: center;
    }
    .custom-breadcrumb a {
        color: #63b3ed;
        text-decoration: none;
    }
    .custom-breadcrumb a:hover {
        text-decoration: underline;
    }
    .breadcrumb-sep {
        margin: 0 10px;
        color: #718096;
    }
    
    .status-badge {
        padding: 4px 10px;
        border-radius: 12px;
        font-size: 0.8rem;
        font-weight: 500;
        background: rgba(255, 255, 255, 0.1);
        display: inline-block;
    }
    .status-pending { background: rgba(221, 107, 32, 0.2); color: #fbd38d; border: 1px solid #dd6b20; }
    .status-approved { background: rgba(56, 161, 105, 0.2); color: #9ae6b4; border: 1px solid #38a169; }
    .status-rejected { background: rgba(229, 62, 62, 0.2); color: #feb2b2; border: 1px solid #e53e3e; }
    
    .btn-action {
        border: none;
        padding: 6px 14px;
        border-radius: 6px;
        font-size: 0.85rem;
        cursor: pointer;
        transition: all 0.2s;
        font-weight: 500;
    }
    .btn-approve {
        background: rgba(56, 161, 105, 0.2);
        color: #9ae6b4;
        border: 1px solid #38a169;
    }
    .btn-approve:hover { background: #38a169; color: white; }
    
    .btn-reject {
        background: rgba(229, 62, 62, 0.2);
        color: #feb2b2;
        border: 1px solid #e53e3e;
    }
    .btn-reject:hover { background: #e53e3e; color: white; }
    
    .btn-download {
        background: transparent;
        color: #a0aec0;
        border: 1px solid #718096;
        padding: 4px 10px;
        border-radius: 4px;
        text-decoration: none;
        font-size: 0.8rem;
        display: inline-block;
    }
    .btn-download:hover { background: #718096; color: white; }
/* =========================================
   UNIFORM GLOBAL TABLE DESIGN (Reference style)
   ========================================= */

/* 1. The Glassy Container Panel */
.table-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* Keeps mobile responsive */
}

/* 2. Uniform Dimensions and Spacing */
.tdq-table {
    width: 100%;
    table-layout: fixed; /* THE MAGIC PROPERTY: Forces all columns to be equally proportioned */
    border-collapse: collapse;
    margin: 0;
}

/* 3. Handling text to prevent layout breaking */
.tdq-table th, 
.tdq-table td {
    padding: 1rem;
    text-align: left;
    vertical-align: middle;
    word-wrap: break-word;     /* Breaks long filenames or emails */
    overflow-wrap: break-word; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Uniform row dividers */
}

.tdq-table th {
    color: #a0aec0;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Optional: Remove border from the very last row for a clean look */
.tdq-table tbody tr:last-child td {
    border-bottom: none;
}
/* Button styling for "View Files" */
.btn-view {
    background: rgba(49, 130, 206, 0.2);
    color: #63b3ed;
    border: 1px solid #3182ce;
    padding: 6px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease-in-out;
    text-align: center;
    display: inline-block;
}

.btn-view:hover {
    background: #3182ce;
    color: #ffffff;
    text-decoration: none;
}
/* --- Recent Activity Card Styles --- */
.dash-activity-list {
    margin-top: 1rem;
}

.dash-activity-item {
    padding: 1rem;
    border-bottom: 1px solid #334155;
}

.dash-activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.dash-activity-desc {
    color: #f8fafc;
    font-size: 0.95rem;
}

/* Activity Badge Colors */
.act-badge {
    font-weight: bold;
}
.act-release { color: #3b82f6; }  /* Blue for packages */
.act-approved { color: #10b981; } /* Green for approvals */
.act-rejected { color: #ef4444; } /* Red for rejections */
.act-comment { color: #f59e0b; }  /* Yellow for comments */

    /* Mobile Optimization for Dashboard *//* Mobile Optimization for Dashboard */
@media (max-width: 992px) {
    /* Stack the main dashboard columns vertically */
    .dash-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Ensure the left column takes full width */
    .dash-col {
        width: 100%;
    }

    /* Ensure the sidebar/featured project takes full width and stacks nicely */
    .dash-aside {
        width: 100%;
        min-width: 100%;
    }

    /* Target the INNER container to stack and center logo + nav on mobile */
    .tdq-header-inner {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 1.2rem;
        padding: 1rem;
    }

    /* Reverse the RTL row-reverse on mobile so it stays perfectly centered */
    html[dir="rtl"] .tdq-header-inner {
        flex-direction: column !important;
    }

    /* Target the navigation links container to center them */
    .tdq-nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center !important;
        align-items: center;
        gap: 0.8rem 1.2rem !important;
        width: 100%;
    }
    
    /* Center the brand logo and text */
    .tdq-brand {
        display: flex;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 8px;
    }

    html[dir="rtl"] .tdq-brand-text {
        text-align: center;
    }

    /* Prevent horizontal scrolling SAFELY without breaking sticky header */
    html, body, .tdq-body {
        max-width: 100%;
        overflow-x: clip; /* Fixes page shifting right in Farsi without breaking position: sticky! */
    }

    

     /* Center the card header (Title and Active Pill) */
  .dash-card-head {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  /* Stack and center each project item */
  .dash-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px; /* Adds space between project info and due date */
    padding: 16px;
  }

  /* Ensure text inside main section is centered */
  .dash-item-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Ensure the due date section is centered */
  .dash-item-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
    /* Fix Card 3: Recent Activity text overflow on mobile */
  .dash-activity-item {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Contains any stray elements */
  }

  .dash-activity-header {
    display: flex;
    flex-direction: column; /* Stacks the Action/Email above the Date */
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }

  /* Target the spans inside the header to allow email addresses to wrap */
  .dash-activity-header span {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .dash-activity-desc {
    margin-top: 10px;
    width: 100%;
    /* These three properties force long file names to wrap nicely inside the card */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word; 
  }
}
/* --- DESKTOP HEADER LAYOUT --- */
.tdq-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tdq-controls {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between Nav and Lang buttons */
}

/* Container for the language buttons */
.lang-toggles {
    display: flex;
    gap: 5px;
    background: transparent; /* Removes the box around both languages */
    padding: 0;
}

/* The individual EN / FA buttons */
.lang-toggles a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.3s ease-in-out;
}

/* The nice glassy highlight when you hover over EN or FA */
.lang-toggles a:hover {
    background: rgba(255, 255, 255, 0.15); 
    color: #ffffff;
}


.hamburger-btn {
    display: none; /* Hidden on Desktop */
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    padding: 8px 6px;
    flex-direction: column;
    gap: 5px; /* Space between lines */
    align-items: center;
    justify-content: center;
    width: 40px; 
    height: 36px;
}

/* The 3 lines of the hamburger */
.hamburger-btn .bar {
    display: block;
    width: 22px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

/* --- ANIMATE TO "X" WHEN ACTIVE --- */
.hamburger-btn.is-active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger-btn.is-active .bar:nth-child(2) {
    opacity: 0; /* Hide middle line */
}
.hamburger-btn.is-active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* --- MOBILE HAMBURGER MENU FIX --- */
@media (max-width: 992px) {
    .tdq-header-inner {
        position: relative; /* Anchors the dropdown to the header */
        flex-wrap: wrap;
        padding: 1rem;
    }

    .tdq-controls {
        gap: 15px;
    }

    /* Force the hamburger icon to show ONLY on mobile */
    .hamburger-btn {
        display: flex !important; 
    }

        /* The Dropdown Menu */
    .tdq-nav {
        display: flex !important; /* Keep it flex so it structures correctly */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%; 
        flex-direction: column !important;
        align-items: center;
        gap: 15px;
        padding: 20px 0;
        background: rgba(15, 31, 56, 0.95);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 999;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
        
        /* --- SMOOTH ANIMATION MAGIC --- */
        visibility: hidden;
        opacity: 0;
        transform: translateY(-15px); /* Starts slightly above */
        transition: all 0.3s ease-in-out; /* Smoothly transitions everything */
        pointer-events: none; /* Prevents clicking invisible links */
    }

    /* Show the navigation smoothly when active */
    .tdq-nav.active {
        visibility: visible;
        opacity: 1;
        transform: translateY(0); /* Glides into place */
        pointer-events: auto; /* Re-enables clicking */
    }

}
/* Active state for navigation links */
.tdq-navlink.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.5rem 1rem; /* Adjust padding if your navlinks don't already have it */
}

/* Optional: specific styling for RTL (Farsi) if needed */
/* html[dir="rtl"] .tdq-navlink.active { */
    /* Add any Farsi-specific active state tweaks here */
/* } */
/* =========================================
   EMPTY STATES (Glassy/Modern)
   ========================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    margin: 2rem auto;
    text-align: center;
    max-width: 450px;
    
    /* Glassmorphism effects */
    background: rgba(255, 255, 255, 0.05); /* Very subtle white */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    /* You can change this color based on your theme */
    color: #a0a0a0; 
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333; /* Use a lighter color like #eee if you are on a dark theme */
}

.empty-state-text {
    font-size: 0.95rem;
    color: #666; /* Use #aaa for dark themes */
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.empty-state-action {
    /* Styles for the button container if needed */
    margin-top: 0.5rem;
}
/* ==========================================================================
   LOADING STATES & SKELETONS
   ========================================================================== */

/* 1. Button Loading Spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tdq-btn.is-loading {
    position: relative;
    color: transparent !important; /* Hides the text temporarily */
    pointer-events: none; /* Prevents double-clicking */
}

/* Adds the actual spinning circle */
.tdq-btn.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.2rem;
    height: 1.2rem;
    margin-left: -0.6rem;
    margin-top: -0.6rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 2. Skeleton Loading Animation (For empty blocks before data loads) */
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    background: linear-gradient(110deg, 
        rgba(255, 255, 255, 0.05) 8%, 
        rgba(255, 255, 255, 0.1) 18%, 
        rgba(255, 255, 255, 0.05) 33%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s linear infinite;
    border-radius: 0.5rem;
    color: transparent !important;
    border-color: transparent !important;
}

    .rev-color-blue { color: #38bdf8; }
    .rev-color-yellow { color: #eab308; }
    .rev-color-red { color: #ef4444; }
    .rev-color-green {
    color: #22c55e !important; /* Adjust hex to match your theme's green */
}



