:root {
  --brand-primary: #1E3A8A; /* Deep blue */
  --brand-secondary: #3B82F6; /* Lighter blue */
  --brand-accent: #06B6D4; /* Cyan accent */
  --bg-color: #F8FAFC;
  --surface-color: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #F8FAFC;
  --border-color: #E2E8F0;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --sidebar-bg: #FFFFFF;
  --sidebar-hover: #F1F5F9;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sidebar-border: #E2E8F0;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

/* Utilities */
.hidden { display: none !important; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}
.btn-primary {
  background-color: var(--brand-primary);
  color: var(--text-light);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background-color: var(--brand-secondary);
  box-shadow: var(--shadow-md);
}
.btn-logout {
  background-color: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fee2e2 !important;
}
.btn-logout:hover {
  background-color: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

/* App Loading & Layouts */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Login View */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--sidebar-bg) 100%);
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  width: 120px;
  margin-bottom: 2rem;
}

.input-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease-in-out;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--sidebar-hover);
}

.sidebar-logo {
  height: 40px;
  width: auto;
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
}

.nav-item {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
  cursor: pointer;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--sidebar-hover);
  color: var(--brand-primary);
  border-left: 3px solid var(--brand-accent);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--surface-color);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 93vh;
  display: flex;
  flex-direction: column;
}
.modal-xl {
  max-width: 1600px;
  width: 98vw;
}
.modal-lg {
  max-width: 1400px; 
  width: 95vw;
}
.submodal-overlay {
  z-index: 10000 !important;
}
.modal-compact {
  max-width: 1200px !important;
  width: 95vw !important;
}
.modal-compact .modal-body {
  padding: 0.4rem 0.75rem !important;
}
.modal-compact .form-grid {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.3rem 0.5rem !important;
}
.modal-compact .input-group {
  margin-bottom: 0.1rem !important;
}
.modal-compact .input-group.full {
  grid-column: span 4 !important;
}
.modal-compact .input-group.half {
  grid-column: span 2 !important;
}
.modal-compact .input-group:not(.full):not(.half) {
  grid-column: span 1 !important;
}
.modal-compact label {
  font-size: 0.7rem !important;
  margin-bottom: 0.1rem !important;
  font-weight: 600 !important;
}
.modal-compact input[type="text"],
.modal-compact input[type="number"],
.modal-compact input[type="date"],
.modal-compact select,
.modal-compact textarea {
  padding: 0.2rem 0.35rem !important;
  font-size: 0.7rem !important;
  height: auto !important;
}
.modal-compact hr {
  margin: 0.25rem 0 !important;
}
.modal-compact h3,
.modal-compact h2 {
  font-size: 0.8rem !important;
  margin-top: 0.25rem !important;
  margin-bottom: 0.15rem !important;
}


.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}
.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid.full { grid-template-columns: 1fr; }
.form-grid .full { grid-column: 1 / -1; }


/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  overflow-x: hidden;
}

.top-bar {
  height: 64px;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.impersonate-container {
  margin-left: auto;
  margin-right: 1rem;
  width: auto;
  min-width: 200px;
  max-width: 300px;
}

.content-area {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

.card {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.dashboard-card {
  flex: 1;
  min-width: 280px;
  max-width: 320px;
}

/* Responsive side nav */
@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    position: fixed;
    z-index: 50;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: block;
    cursor: pointer;
  }
  .job-ref-header {
    font-size: 1.1rem !important;
  }
  .bugnub-trigger {
    display: none !important;
  }
  .top-bar {
    height: auto !important;
    flex-wrap: wrap !important;
    padding: 0.5rem 1rem !important;
    gap: 0.5rem !important;
  }
  .top-bar-left {
    order: 1;
  }
  .top-bar-right {
    order: 2;
    margin-left: auto;
  }
  .impersonate-container {
    order: 3;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0.25rem 0 !important;
  }
  .user-identity {
    display: none !important;
  }
  .top-bar-right {
    gap: 0.5rem !important;
  }
  .top-bar-right .btn {
    padding: 0.45rem 0.6rem !important;
    font-size: 0.8rem !important;
  }
  .fc .fc-header-toolbar {
    flex-direction: column !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }
  .fc .fc-toolbar-chunk {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
  }
  .fc .fc-toolbar-title {
    font-size: 1.1rem !important;
    margin: 0 !important;
  }
  .fc .fc-button {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    line-height: 1.25 !important;
  }
  .content-area {
    padding: 1rem !important;
  }
  .dashboard-card {
    min-width: 100% !important;
    max-width: 100% !important;
  }
}
@media (min-width: 769px) {
  .mobile-toggle {
    display: none;
  }
}

/* FullCalendar Custom Theme Mappings */
.fc-event-pending { background-color: #fee2e2 !important; border-color: #fca5a5 !important; color: #991b1b !important; }
.fc-event-pending-partial, .fc-event-booked-partial { background-color: #fde68a !important; border-color: #facc15 !important; color: #78350f !important; }
.fc-event-offered { background-color: #e9d5ff !important; border-color: #d8b4fe !important; color: #581c87 !important; }
.fc-event-assigned, .fc-event-booked { background-color: #bbf7d0 !important; border-color: #86efac !important; color: #14532d !important; }

.status-badge { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.status-pending { background: #fee2e2; color: #991b1b; }
.status-pending-partial, .status-booked-partial { background: #fef3c7; color: #92400e; }
.status-offered { background: #f3e8ff; color: #6b21a8; }
.status-assigned, .status-booked { background: #dcfce7; color: #166534; }
.status-accepted { background: #dcfce7; color: #166534; }
.status-in_progress { background: #ccfbf1; color: #115e59; }
.status-completed { background: #e2e8f0; color: #475569; }
.status-cancelled { background: #0f172a; color: #ffffff; }
.status-quote_request { background: #e0e7ff; color: #4338ca; }
.status-waiting_on_quote { background: #fef3c7; color: #d97706; }
.status-sent_to_translator { background: #e0f2fe; color: #0369a1; }
.status-due_in { background: #ffedd5; color: #c2410c; }
.status-received { background: #ecfdf5; color: #047857; }

.fc-event-in_progress { background-color: var(--accent) !important; border-color: var(--accent) !important; color: white !important; }
.fc-event-completed { background-color: #cbd5e1 !important; border-color: #94a3b8 !important; color: #334155 !important; }
.fc-event-cancelled { background-color: #0f172a !important; border-color: #0f172a !important; color: #ffffff !important; }
.fc-event-quote_request { background-color: #6366f1 !important; border-color: #6366f1 !important; color: white !important; }
.fc-event-waiting_on_quote { background-color: #f59e0b !important; border-color: #f59e0b !important; color: white !important; }
.fc-event-sent_to_translator { background-color: #0ea5e9 !important; border-color: #0ea5e9 !important; color: white !important; }
.fc-event-due_in { background-color: #f97316 !important; border-color: #f97316 !important; color: white !important; }
.fc-event-received { background-color: #10b981 !important; border-color: #10b981 !important; color: white !important; }

/* Improve FullCalendar text legibility and click pointer */
.fc-event { cursor: pointer; padding: 2px 4px; font-weight: 500; font-size: 0.8rem; border-radius: 4px; border: none; }
.fc-toolbar-title { font-size: 1.25rem !important; font-weight: 600; color: var(--text-dark); }
.fc .fc-button-primary { background-color: var(--brand-primary); border-color: var(--brand-primary); border-radius: 6px; }
.fc .fc-button-primary:hover { background-color: var(--brand-secondary); border-color: var(--brand-secondary); }
.fc .fc-button-primary:disabled { background-color: #cbd5e1; border-color: #cbd5e1; }
.fc .fc-daygrid-day-number { color: var(--text-dark); font-weight: 500; text-decoration: none; }
.fc .fc-col-header-cell-cushion { color: var(--text-dark); padding: 0.5rem; text-decoration: none; }
.fc .fc-list-event:hover td { background-color: rgba(0, 0, 0, 0.15) !important; cursor: pointer; }

/* BugNub Feedback System */
.bugnub-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  background-color: var(--brand-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  cursor: pointer;
  z-index: 99;
  transition: transform 0.2s, background-color 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.bugnub-trigger:hover {
  transform: scale(1.1);
  background-color: var(--brand-secondary);
}
.screenshot-container {
  margin-top: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
}
.screenshot-preview {
  max-width: 100%;
  max-height: 140px;
  border-radius: 4px;
  display: block;
  margin: 0.5rem auto 0 auto;
  border: 1px solid #cbd5e1;
}

/* User Documentation Module Styles */
.docs-layout {
  display: flex;
  gap: 1.5rem;
  min-height: calc(100vh - 120px);
}
@media (max-width: 992px) {
  .docs-layout {
    flex-direction: column;
    min-height: auto;
  }
}
.docs-sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  gap: 1.25rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
@media (max-width: 992px) {
  .docs-sidebar {
    width: 100%;
    max-height: 350px;
  }
}
.docs-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}
.docs-item {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border: 1px solid transparent;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.docs-item:hover {
  background: var(--sidebar-hover);
  transform: translateX(2px);
}
.docs-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--brand-primary);
}
.docs-item-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.docs-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.docs-content-pane {
  flex: 1;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}
.docs-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}
.docs-title-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.docs-title {
  margin: 0;
  font-size: 1.75rem;
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}
.docs-actions {
  display: flex;
  gap: 0.5rem;
}
.docs-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.docs-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}
.docs-badge-contractor {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.docs-badge-client {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.docs-badge-staff {
  background-color: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.docs-body {
  font-size: 1rem;
  line-height: 1.8;
  color: #334155;
}
.docs-body h1, .docs-body h2, .docs-body h3 {
  color: var(--brand-primary);
  margin-top: 1.75rem;
  margin-bottom: 0.85rem;
  font-weight: 600;
}
.docs-body h1 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.docs-body h2 { font-size: 1.3rem; }
.docs-body h3 { font-size: 1.15rem; }
.docs-body p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}
.docs-body ul, .docs-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}
.docs-body li {
  margin-bottom: 0.5rem;
}
.docs-body blockquote {
  border-left: 4px solid var(--brand-secondary);
  background: var(--bg-color);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: #475569;
}
.docs-body code {
  background: var(--bg-color);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.9em;
  color: #e11d48;
}
.docs-body pre {
  background: #1e293b;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.25rem 0;
}
.docs-body pre code {
  background: transparent;
  padding: 0;
  color: #f8fafc;
  font-size: 0.875rem;
}
.docs-body img, .docs-body video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
  display: block;
}
.doc-video-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.docs-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  padding: 3rem;
  text-align: center;
  gap: 1rem;
}
.docs-audit-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-md);
}
.docs-audit-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.docs-icon-btn:hover {
  background-color: var(--border-color) !important;
  transform: scale(1.05);
}

.job-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.job-row:hover {
  background-color: #f8fafc !important;
}

/* Jobs Table Custom Styling */
.jobs-table {
  font-size: 0.8125rem;
}
.jobs-table th,
.jobs-table td {
  padding: 0.5rem 0.75rem !important;
}
.jobs-table .status-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
}
.jobs-table .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

/* Announcement Banner */
.announcement-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease-in-out;
  overflow: hidden;
  max-height: 100px;
}

.announcement-banner.slide-up {
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-width: 0 !important;
  opacity: 0 !important;
}

.banner-info {
  background-color: #e0f2fe;
  color: #0369a1;
  border-bottom-color: #bae6fd;
}

.banner-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-bottom-color: #fde68a;
}

.banner-critical {
  background-color: #fee2e2;
  color: #991b1b;
  border-bottom-color: #fecaca;
}

.announcement-banner .banner-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.announcement-banner .close-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, background-color 0.2s;
}

.announcement-banner .close-btn:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Spinner style */
.btn-spinner {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: btn-spin 0.75s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Overview Page Compact Layout styles */
.overview-container {
  font-size: 0.8rem;
}
.overview-container .card {
  padding: 0.5rem 0.75rem !important;
  margin-bottom: 0.75rem !important;
  font-size: 0.8rem !important;
}
.overview-container .card h2,
.overview-container .card h3 {
  font-size: 0.9rem !important;
}
.overview-container .dashboard-card {
  padding: 0.5rem 0.75rem !important;
  min-width: 200px !important;
  max-width: 250px !important;
}
.overview-container table th,
.overview-container table td {
  padding: 0.4rem 0.5rem !important;
  font-size: 0.75rem !important;
}
.overview-container table tr td span {
  font-size: 0.7rem !important;
  padding: 0.1rem 0.3rem !important;
}
.overview-container button.btn {
  padding: 0.15rem 0.4rem !important;
  font-size: 0.7rem !important;
  height: auto !important;
  line-height: 1.1 !important;
}
.overview-container .dashboard-card div[onclick] {
  padding: 0.3rem !important;
  border-radius: 4px !important;
}
.overview-container .dashboard-card div[onclick] div {
  font-size: 1.25rem !important;
}
.overview-container .dashboard-card div[onclick] div + div {
  font-size: 0.7rem !important;
}



