/* ================================================
   CONSOLIDATED BASE STYLES (style.css)
   All common/shared styles used across pages
   ================================================ */

/* CSS Variables */
:root {
  --primary-color: #00a651;
  --secondary-color: #006837;
  --sidebar-bg: #f8f9fa;
  --text-dark: #2c3e50;
  --text-muted: #6c757d;
  --border-color: #e0e0e0;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f5f6fa;
  color: var(--text-dark);
  overflow-x: hidden;
}

/* ── DVG Logo Box (shared across all pages) ── */
.dvg-logo-box {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #00a651, #006837);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dvg-logo-box span {
  color: white;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -1px;
}

/* ── Header Styles ── */
.top-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-weight: 700;
  font-size: 24px;
  color: var(--primary-color);
}

.logo-subtext {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: -3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: flex-end;
}

.notification-badge {
  position: relative;
  cursor: pointer;
}

.notification-badge .badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #dc3545;
  font-size: 10px;
  padding: 3px 3px;
  border-radius: 50%;
  line-height: 14px;
  font-weight: 400;
  text-align: center;
  width: 22px;
  height: 22px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.user-profile:hover {
  background: var(--sidebar-bg);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-info {
  text-align: left;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

/* ── Sidebar Styles ── */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: 260px;
  height: calc(100vh - 60px);
  background: white;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  transition: all 0.3s ease;
  z-index: 999;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.nav-item {
  margin: 4px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-dark);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.nav-link:hover {
  background: var(--sidebar-bg);
  color: var(--primary-color);
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(
    90deg,
    rgba(0, 166, 81, 0.1) 0%,
    rgba(0, 166, 81, 0.05) 100%
  );
  color: var(--primary-color);
  font-weight: 600;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-color);
  border-radius: 0 4px 4px 0;
}

.nav-link i {
  font-size: 18px;
  width: 20px;
}

.nav-badge {
  margin-left: auto;
  background: #dc3545;
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.nav-badge.warning {
  background: #ffc107;
  color: #000;
}

.nav-section {
  margin: 20px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.collapse-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
}

.nav-link[aria-expanded="true"] .collapse-arrow {
  transform: rotate(180deg);
}

.sub-menu {
  margin-left: 32px;
}

.sub-menu .nav-link {
  font-size: 13px;
  padding: 8px 16px;
}

/* ── Main Content ── */
.main-content {
  margin-left: 260px;
  margin-top: 100px;
  padding: 30px;
  transition: all 0.3s ease;
}

/* ── Common Page Headers ── */
.pg-header,
.page-header,
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.pg-title,
.page-title,
.dashboard-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 4px;
}

.pg-subtitle,
.page-subtitle,
.dashboard-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ── Common Alert Banners ── */
.pg-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.pg-alert.orange {
  background: rgba(253, 126, 20, 0.06);
  border: 1px solid rgba(253, 126, 20, 0.28);
  color: #854d0e;
}

.pg-alert.blue {
  background: rgba(13, 110, 253, 0.05);
  border: 1px solid rgba(13, 110, 253, 0.2);
  color: #084298;
}

.pg-alert.purple {
  background: rgba(111, 66, 193, 0.05);
  border: 1px solid rgba(111, 66, 193, 0.2);
  color: #4a1c8c;
}

.pg-alert-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.pg-alert-icon.orange {
  color: #fd7e14;
}

.pg-alert-icon.blue {
  color: #0d6efd;
}

.pg-alert-icon.purple {
  color: #6f42c1;
}

.pg-alert strong {
  display: block;
  margin-bottom: 2px;
}

.pg-alert span {
  font-size: 13px;
  opacity: 0.9;
}

/* ── Common Table Styles ── */
.pg-table-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.pg-table {
  width: 100%;
  border-collapse: collapse;
}

.pg-table thead {
  background: var(--sidebar-bg);
}

.pg-table thead th {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.pg-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

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

.pg-table tbody tr:hover {
  background: rgba(0, 166, 81, 0.02);
}

.pg-table tbody td {
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-dark);
  vertical-align: middle;
}

/* ── Common Operative ID ── */
.op-id-txt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Common Name Cell ── */
.op-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.op-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.op-name {
  font-weight: 600;
  font-size: 14px;
}

.op-phone-sm {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Common Role Tags ── */
.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: #f0f4f8;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ── Common Status Badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.active {
  background: rgba(0, 166, 81, 0.1);
  color: #00a651;
}

.status-badge.inactive {
  background: rgba(108, 117, 125, 0.12);
  color: #6c757d;
}

.status-badge.pending {
  background: rgba(253, 126, 20, 0.1);
  color: #fd7e14;
}

.status-badge.awaiting-supervisor,
.status-badge.awaiting-onsite,
.status-badge.awaiting-signup {
  background: rgba(253, 126, 20, 0.12);
  color: #c85a00;
}

.status-badge.signup-complete {
  background: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
}

.status-badge.supervisor-approved {
  background: rgba(111, 66, 193, 0.1);
  color: #6f42c1;
}

.status-badge.completed {
  background: rgba(0, 166, 81, 0.1);
  color: #00a651;
}

.status-badge.rejected {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

/* ── Common Buttons ── */
.tbl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  font-family: "Inter", sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.tbl-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.tbl-btn.review {
  border-color: #0d6efd;
  color: #0d6efd;
  font-weight: 600;
  padding: 7px 16px;
}

.tbl-btn.review:hover {
  background: #0d6efd;
  color: white;
}

.tbl-btn.signoff {
  border: 1.5px solid #6f42c1;
  background: white;
  color: #6f42c1;
  font-weight: 600;
  padding: 7px 16px;
}

.tbl-btn.signoff:hover {
  background: #6f42c1;
  color: white;
}

/* ── Common Action Buttons ── */
.pg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.pg-action-btn.blue {
  background: #0d6efd;
  color: white;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

.pg-action-btn.blue:hover {
  background: #0b5ed7;
  transform: translateY(-2px);
}

/* ── Common Date Text ── */
.date-txt {
  font-size: 13px;
}

/* ── Common Contact Display ── */
.op-contact,
.op-contact-sm {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}

.op-contact i {
  margin-right: 4px;
}

/* ── Mobile Toggle ── */
.mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
  z-index: 1001;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 166, 81, 0.4);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ── Responsive Styles (Common) ── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    margin-top: 90px;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .user-info {
    display: none;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 20px 15px;
  }

  .pg-title,
  .page-title,
  .dashboard-title {
    font-size: 22px;
  }

  /* Common mobile table layout */
  .pg-table thead {
    display: none;
  }

  .pg-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
  }

  .pg-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border: none;
    font-size: 13px;
  }

  .pg-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-right: 10px;
  }

  .pg-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pg-action-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .header-right {
    gap: 10px;
  }

  .logo-text {
    font-size: 20px;
  }
}

/* ── User Dropdown Menu Styles ── */
.user-dropdown-menu {
  min-width: 280px;
  padding: 8px 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  margin-top: 8px;
}

.user-dropdown-menu .dropdown-header {
  padding: 12px 20px;
  margin-bottom: 0;
}

.user-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-dropdown-info strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.user-dropdown-info span {
  font-size: 13px;
  color: var(--text-muted);
}

.user-dropdown-menu .dropdown-item {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.user-dropdown-menu .dropdown-item i {
  font-size: 18px;
  width: 20px;
  flex-shrink: 0;
}

.user-dropdown-menu .dropdown-item:hover {
  background: var(--sidebar-bg);
  color: var(--primary-color);
  padding-left: 24px;
}

.user-dropdown-menu .dropdown-item.text-danger {
  color: #dc3545;
}

.user-dropdown-menu .dropdown-item.text-danger:hover {
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
}

.user-dropdown-menu .dropdown-divider {
  margin: 8px 0;
  border-color: var(--border-color);
}

.user-dropdown-menu .badge {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 6px;
}

/* Make user profile clickable indicator */
.user-profile {
  cursor: pointer;
}

.user-profile:hover {
  background: var(--sidebar-bg);
}

/* Links and buttons carry no underline anywhere in the app. Bootstrap 5
   underlines every anchor by default and several of the page styles add the
   underline back on hover, so this sits last in the shared sheet to win. */
a,
a:hover,
a:focus,
a:active,
a:focus-visible,
button,
button:hover,
button:focus,
.btn,
.btn:hover,
.btn:focus,
.page-link,
.dropdown-item {
  text-decoration: none !important;
}
