/* AMI Global Styles (Admin, Auditor, Auditee)
   Consolidated from inline layout styles and harmonized for consistency. */

:root {
  --primary-color: #0d6efd;
  --sidebar-bg: #212529;
  --sidebar-text: #adb5bd;
  --sidebar-text-hover: #ffffff;
  --content-bg: #f8f9fa;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --font-family-base: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Base */
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-family-base);
  font-size: 1rem;
  color: #212529;
  background-color: var(--content-bg);
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  will-change: transform;
  transition: transform 0.25s ease;
  z-index: 1040;
}
.sidebar-header {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid #495057;
}
.sidebar-header img {
  width: 60px;
  height: auto;
  max-width: 60px;
  margin-bottom: 0.5rem;
}
.sidebar-header h3 {
  color: #fff;
  margin: 0;
  font-size: 1.2rem;
}
.sidebar-nav { flex-grow: 1; padding-bottom: 1rem; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0.5rem 0; }
.sidebar-nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.2s;
}
.sidebar-nav a.active,
.sidebar-nav a:hover {
  background-color: var(--primary-color);
  color: var(--sidebar-text-hover);
}
.sidebar-nav a i { margin-right: 0.75rem; width: 20px; text-align: center; }

/* Main content */
.main-content {
  margin-left: 280px;
  width: calc(100% - 280px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
  min-height: 60px;
  z-index: 1025;
}
.topbar .left-actions { display: flex; align-items: center; gap: 0.5rem; }
.topbar .right-actions { display: flex; align-items: center; gap: 0.75rem; }
.profile { display: flex; align-items: center; }
.profile-name { margin-right: 1rem; font-weight: 500; }
.logout-btn { background: var(--danger-color); color: #fff; border: none; padding: 0.5rem 1rem; border-radius: 5px; text-decoration: none; cursor: pointer; }
.content { padding: 2rem; flex-grow: 1; }
.content > * + * { margin-top: 0; }

/* Buttons */
.btn { padding: 0.5rem 1rem; border-radius: 5px; text-decoration: none; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-warning { background: var(--warning-color); color: #212529; }
.btn-danger { background: var(--danger-color); color: #fff; }
.btn-success { background: var(--success-color); color: #fff; }
.auth-body .btn-primary {
  background: linear-gradient(135deg, #4e73df, #224abe);
  border: none;
  box-shadow: 0 8px 18px rgba(78, 115, 223, 0.25);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.auth-body .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(34, 74, 190, 0.3);
  filter: brightness(0.95);
}
.auth-body .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(34, 74, 190, 0.2);
}
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }

/* Tables & cards */
.table-container { background: #fff; border-radius: 8px; box-shadow: 0 0 15px rgba(0,0,0,0.05); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
.table-responsive { width: 100%; overflow-x: auto; }
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 999px; }
.table-responsive::-webkit-scrollbar-thumb { background: rgba(13,110,253,0.3); border-radius: 999px; }
.table-responsive table { width: 100%; min-width: 100%; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid #dee2e6; }
thead { background-color: #f8f9fa; }
.actions { display: flex; gap: 0.5rem; }
.form-container { background: #fff; padding: 2rem; border-radius: 8px; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group select { width: 100%; padding: 0.75rem; border: 1px solid #ced4da; border-radius: 4px; box-sizing: border-box; }
.form-group small { color: #6c757d; margin-top: 0.25rem; display: block; }

/* Card system */
.card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}
.card + .card { margin-top: 0; }
.card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-header > * { margin: 0; }
.card-body { padding: 1rem; flex: 1 1 auto; }
.card-footer { padding: 0.75rem 1rem; border-top: 1px solid #e9ecef; background: #fafbfc; }
.card-title { margin: 0; font-size: 1.05rem; }

/* Borders & shadows */
.border { border: 1px solid #dee2e6 !important; }
.border-0 { border: 0 !important; }
.border-light { border-color: #e9ecef !important; }
.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important; }
.shadow { box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; }

/* Spacing utilities */
.mt-1{margin-top: .25rem;} .mt-2{margin-top: .5rem;} .mt-3{margin-top: 1rem;} .mt-4{margin-top:1.5rem;} .mt-5{margin-top:3rem;}
.mb-1{margin-bottom: .25rem;} .mb-2{margin-bottom: .5rem;} .mb-3{margin-bottom: 1rem;} .mb-4{margin-bottom:1.5rem;} .mb-5{margin-bottom:3rem;}
.pt-1{padding-top:.25rem;} .pt-2{padding-top:.5rem;} .pt-3{padding-top:1rem;} .pt-4{padding-top:1.5rem;} .pt-5{padding-top:3rem;}
.pb-1{padding-bottom:.25rem;} .pb-2{padding-bottom:.5rem;} .pb-3{padding-bottom:1rem;} .pb-4{padding-bottom:1.5rem;} .pb-5{padding-bottom:3rem;}
.px-1{padding-left:.25rem;padding-right:.25rem;} .px-2{padding-left:.5rem;padding-right:.5rem;} .px-3{padding-left:1rem;padding-right:1rem;} .px-4{padding-left:1.5rem;padding-right:1.5rem;} .px-5{padding-left:3rem;padding-right:3rem;}
.py-1{padding-top:.25rem;padding-bottom:.25rem;} .py-2{padding-top:.5rem;padding-bottom:.5rem;} .py-3{padding-top:1rem;padding-bottom:1rem;} .py-4{padding-top:1.5rem;padding-bottom:1.5rem;} .py-5{padding-top:3rem;padding-bottom:3rem;}
.p-1{padding:.25rem;} .p-2{padding:.5rem;} .p-3{padding:1rem;} .p-4{padding:1.5rem;} .p-5{padding:3rem;}

/* Forms: focus state */
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(13,110,253,.15); }

/* Auth (login/register) */
.auth-wrapper { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f4f6f9; }
.auth-card { background: #fff; width: 100%; max-width: 420px; border-radius: 12px; border: 1px solid #e9ecef; box-shadow: 0 10px 20px rgba(0,0,0,0.06); overflow: hidden; }
.auth-header { text-align: center; padding: 1.5rem 1rem 0.5rem; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: .5rem; }
.auth-title { margin: 0; font-size: 1.25rem; font-weight: 700; color: #343a40; }
.auth-body { padding: 1rem 1.25rem 1.25rem; }
.auth-actions {
  padding: 0 1.25rem 1.5rem;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
}
.auth-actions .btn {
  width: 100%;
  justify-content: center;
  border-radius: 8px;
}
.btn-block { width: 100%; }
.text-muted { color: #6c757d; }

/* Simple Grid helpers */
.grid { display: grid; }
.cols-2-1 { grid-template-columns: 2fr 1fr; }
.gap-2 { gap: 2rem; }

@media (max-width: 992px) {
  .cols-2-1 { grid-template-columns: 1fr; }
}

/* Sizing helpers */
.h-30 { height: 30px; }

/* Button sizes */
.btn-lg { padding: 0.8rem 2rem; font-size: 1.2rem; }

/* Notifications (dropdown) */
.notification-bell { position: relative; cursor: pointer; color: #6c757d; font-size: 1.5rem; }
.notification-count { position: absolute; top: -5px; right: -10px; background: var(--danger-color); color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.notification-dropdown { display: none; position: absolute; top: 44px; right: 0; background: #fff; border-radius: 8px; box-shadow: 0 5px 20px rgba(15,23,42,0.15); min-width: 320px; z-index: 1000; overflow: hidden; transition: width 0.2s ease, transform 0.2s ease; }
.notification-dropdown.show { display: block; }
.notification-dropdown-header { padding: 0.75rem 1rem; font-weight: bold; border-bottom: 1px solid #eee; background: #f8fafc; }
.notification-dropdown-body { max-height: 300px; overflow-y: auto; }
.notification-dropdown-item { padding: 0.75rem 1rem; border-bottom: 1px solid #eee; display: block; text-decoration: none; color: #333; }
.notification-dropdown-item:hover { background: #f8f9fa; }
.notification-dropdown-item p { margin: 0.25rem 0 0; font-size: 0.85rem; color: #6c757d; }
.notification-dropdown-footer { text-align: center; padding: 0.5rem; display: block; text-decoration: none; color: var(--primary-color); }

/* Hamburger button */
.hamburger-btn { display: none; background: transparent; border: 1px solid #dee2e6; color: #495057; padding: 0.375rem 0.5rem; border-radius: 4px; }
.hamburger-btn .bar { display: block; width: 22px; height: 2px; background: currentColor; margin: 4px 0; }

/* Responsive Design */
@media (max-width: 992px) {
  .content { padding: 1rem; }
}

@media (max-width: 768px) {
  .hamburger-btn { display: inline-block; }
  .sidebar { transform: translateX(-100%); height: 100%; max-height: 100%; }
  .sidebar.active { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
  .topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1025;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
  }
  .topbar .left-actions { flex: 0 0 auto; display: flex; align-items: center; }
  .topbar .right-actions {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  .topbar .profile {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }
  .logout-btn { width: auto; }
  .accordion-item.expanded .accordion-body { max-height: 420px; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive table { min-width: 640px; }
  .actions { flex-direction: column; gap: 0.75rem; width: 100%; }
  .actions .btn { width: 100%; justify-content: center; }
  .btn { font-size: 0.95rem; padding: 0.5rem 0.85rem; }
  .content-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .content-header .btn { width: 100%; justify-content: center; }
  .content-header .search-box { width: 100%; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .card-header > * { width: 100%; }
  .card-header .btn { justify-content: center; }
  .card-body, .table-container, .form-container { padding: 1.25rem; }
  .stat-card { flex-direction: row; padding: 1.25rem; }
  .stat-card .info p { font-size: 1.5rem; }
  .chart-card { padding: 1.25rem; }
  .score-summary { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .score-values { flex-direction: column; gap: 0.75rem; }
  .finding-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .findings-list { grid-template-columns: 1fr; }
  .search-box { width: 100%; min-width: 0; }
  .search-box input { width: 100%; }
  .document-list { grid-template-columns: 1fr; }
  .notification-dropdown {
    min-width: 0;
    width: min(360px, 92vw);
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .notification-dropdown-header {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .notification-dropdown-item {
    padding: 0.75rem 1rem;
  }

  .notification-dropdown::before {
    display: none;
  }
}

@media (max-width: 576px) {
  .notification-dropdown {
    width: 92vw;
  }

  .notification-dropdown-header {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }

  .notification-dropdown-item {
    padding: 0.65rem 0.9rem;
  }
}

/* Utility classes (add more as needed) */
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.p-3 { padding: 1rem; }
.rounded { border-radius: 0.5rem; }

/* Opacity helpers */
.opacity-80 { opacity: 0.8; }

/* Display helpers */
.d-none { display: none !important; }
.d-block { display: block !important; }

/* Padding-left helpers (LTR-safe) */
.pl-1{padding-left:.25rem;} .pl-2{padding-left:.5rem;} .pl-3{padding-left:1rem;} .pl-4{padding-left:1.5rem;} .pl-5{padding-left:3rem;}

/* Text highlight helper */
.mark-highlight { background-color: #fef9c3; font-weight: 500; }

/* Background helpers */
.bg-info { background-color: #17a2b8 !important; color: #fff; }
.bg-success { background-color: #28a745 !important; color: #fff; }
.bg-warning { background-color: #ffc107 !important; color: #000; }
.bg-danger { background-color: #dc3545 !important; color: #fff; }

/* Height/Width helpers */
.h-200 { height: 200px; }
.h-320 { height: 320px; }
.h-360 { height: 360px; }
.w-300 { width: 300px; max-width: 100%; }

/* ===== Admin Dashboard Styles ===== */
.dashboard-header { margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid #dee2e6; }
.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; }
.stat-card { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 1rem; }
.stat-card .icon { font-size: 2rem; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.stat-card .info p { margin: 0; font-size: 2rem; font-weight: 700; }
.stat-card .info span { font-size: 0.9rem; color: #6c757d; }
.chart-card { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.06); }
.grid-col-2 { grid-column: span 12; }
.grid-col-4 { grid-column: span 12; }
.grid-col-8 { grid-column: span 12; }
@media (min-width: 768px) { .grid-col-2 { grid-column: span 6; } .grid-col-4 { grid-column: span 6; } }
@media (min-width: 992px) { .grid-col-2 { grid-column: span 3; } .grid-col-4 { grid-column: span 4; } .grid-col-8 { grid-column: span 8; } }

/* Accordion refinements */
.accordion-item { background-color: #fff; border: 1px solid #dee2e6; margin-bottom: 0.5rem; border-radius: 8px; }
.accordion-header { background-color: #f8f9fa; padding: 1rem 1.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; border-radius: inherit; transition: border-radius 0.15s ease-out; }
.accordion-header:hover { background-color: #e9ecef; }
.accordion-item.expanded .accordion-header { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid #dee2e6; }
.accordion-body { padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.accordion-body > .card { border-radius: 6px; box-shadow: 0 4px 15px rgba(0,0,0,0.06); border: 1px solid #e9ecef; }
.accordion-container { margin-bottom: 1.25rem; background: transparent; box-shadow: none; padding: 0; }
.accordion-item.expanded .accordion-body { max-height: 520px; overflow-y: auto; padding: 0.75rem 1rem; margin-top: 0.75rem; border-top: 1px solid #dee2e6; }
.accordion-item.expanded .accordion-body::-webkit-scrollbar { width: 6px; }
.accordion-item.expanded .accordion-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); border-radius: 999px; }
.accordion-item.expanded .accordion-body::-webkit-scrollbar-thumb { background: rgba(13,110,253,0.25); border-radius: 999px; }
.accordion-item.expanded .accordion-body > *:last-child { margin-bottom: 0; }
.score-summary { display: flex; gap: 1rem; font-size: 0.9rem; }
.score-summary span { font-weight: bold; }
.score-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.score-table th { background: #f8f9fa; padding: 0.75rem 1rem; font-weight: 600; text-align: left; }
.score-table td { padding: 0.75rem 1rem; border-top: 1px solid #dee2e6; vertical-align: middle; }
.score-col { text-align: center; width: 100px; }
.standard-block { border: none; padding: 0.5rem 0; margin-bottom: 0.5rem; }
.accordion-item.expanded .standard-block { border: 1px solid #e9ecef; border-radius: 6px; padding: 1rem; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; padding: 1rem; background: #f8f9fa; border-radius: 6px; }
.info-item { display: flex; flex-direction: column; }
.info-item label { font-size: 0.85rem; color: #6c757d; margin-bottom: 0.25rem; }
.info-item span { font-weight: 500; }
.score-summary-detail { background: #fff; padding: 1rem; border-radius: 6px; margin: 1rem 0; }
.score-box { display: flex; flex-direction: column; gap: 0.5rem; }
.score-label { font-weight: 600; color: #495057; }
.score-values { display: flex; gap: 2rem; }
.score-item { display: flex; align-items: center; gap: 0.5rem; }
.score { padding: 0.25rem 0.5rem; border-radius: 4px; font-weight: 600; }
.score.high { background: #d4edda; color: #155724; }
.score.medium { background: #fff3cd; color: #856404; }
.score.low { background: #f8d7da; color: #721c24; }
.findings-section { background: #f8f9fa; padding: 1rem; border-radius: 6px; margin-top: 1rem; }
.findings-list { display: grid; gap: 1rem; margin-top: 1rem; }
.finding-item { background: #fff; padding: 1rem; border-radius: 6px; border: 1px solid #dee2e6; }
.finding-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.finding-detail { font-size: 0.9rem; }
.finding-detail p { margin: 0.5rem 0; }

/* Modal styles */
.modal { display: none; position: fixed; z-index: 1055; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); }
.modal-content { position: relative; background-color: #fff; margin: 5% auto; padding: 20px; width: 80%; max-width: 800px; border-radius: 8px; }
.close-modal { position: absolute; right: 20px; top: 10px; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-modal:hover { color: #666; }
.evidence-content { margin-top: 20px; max-height: 70vh; overflow-y: auto; }
.evidence-img { max-width: 100%; }
.evidence-frame { width: 100%; height: 500px; border: none; }
/* Keep backdrop beneath modal content */
.modal-backdrop { z-index: 1050; }

/* Search styles */
.search-box { position: relative; min-width: 250px; }
.search-box input { width: 100%; padding: 0.5rem 1rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.9rem; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #ddd; border-radius: 4px; margin-top: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 1000; max-height: 300px; overflow-y: auto; }
.search-item { padding: 0.75rem 1rem; border-bottom: 1px solid #eee; cursor: pointer; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f8f9fa; }
.search-item.highlighted { background: #e9ecef; }
.search-item h6 { margin: 0; font-size: 0.9rem; color: #333; }
.search-item p { margin: 0; font-size: 0.8rem; color: #6c757d; }

/* Generic notifications list (used by generic notifications view) */
.notification-list { display: flex; flex-direction: column; gap: 1rem; }
.notification-item { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 1rem; border-left: 5px solid var(--primary-color); border-radius: 5px; }
.notification-item.read { border-left-color: #ccc; opacity: 0.85; }
.notification-item p { margin: 0.25rem 0; }

/* Sidebar backdrop (mobile overlay) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1030; /* below sidebar, above content */
}
.sidebar-backdrop.show { display: block; }
body.sidebar-open { overflow: hidden; }
@media (min-width: 769px) {
  .sidebar-backdrop { display: none !important; }
  body.sidebar-open { overflow: auto; }
}
