:root {
  --primary-blue: #1e3a8a;
  --secondary-blue: #3b82f6;
  --accent-gold: #fbbf24;
  --dark-gray: #374151;
  --light-gray: #f3f4f6;
  --success-green: #10b981;
  --danger-red: #ef4444;
  --white: #ffffff;
  --text-dark: #1f2937;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-gray);
  color: var(--text-dark);
  line-height: 1.6;
}

.header-gov {
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--secondary-blue) 100%
  );
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
}

.header-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 300;
}

.navbar-gov {
  background-color: var(--dark-gray);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar-gov .nav-link {
  color: white !important;
  font-weight: 500;
  padding: 12px 20px;
  transition: all 0.3s ease;
  border-radius: 5px;
  margin: 0 5px;
}

.navbar-gov .nav-link:hover,
.navbar-gov .nav-link.active {
  background-color: var(--secondary-blue);
  color: white !important;
}

.main-content {
  min-height: calc(100vh - 200px);
}

.hero-section {
  background:
    linear-gradient(
      135deg,
      rgba(30, 58, 138, 0.9) 0%,
      rgba(59, 130, 246, 0.9) 100%
    ),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><polygon fill="%23ffffff10" points="0,400 300,300 600,500 900,200 1200,300 1200,800 0,800"/></svg>');
  background-size: cover;
  background-position: center;
  color: white;
  padding: 80px 0;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-description {
  font-size: 1.2rem;
  margin-bottom: 40px;
  line-height: 1.7;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--accent-gold);
}

.stat-card p {
  font-size: 0.9rem;
  margin: 0;
}

.login-card {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-card h4 {
  color: var(--primary-blue);
  margin-bottom: 25px;
  text-align: center;
  font-weight: 600;
}

.modules-section {
  padding: 80px 0;
  background: white;
}

.section-title {
  text-align: center;
  color: var(--primary-blue);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 60px;
}

.module-card {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  border: 1px solid #e5e7eb;
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.module-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(
    135deg,
    var(--secondary-blue),
    var(--primary-blue)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-icon i {
  font-size: 2rem;
  color: white;
}

.module-card h4 {
  color: var(--primary-blue);
  margin-bottom: 15px;
  font-weight: 600;
}

.module-card p {
  color: var(--dark-gray);
  margin-bottom: 20px;
}

.news-section {
  padding: 60px 0;
  background: var(--light-gray);
}

.news-item {
  background: white;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid var(--secondary-blue);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.news-date {
  color: var(--secondary-blue);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.news-item h5 {
  color: var(--primary-blue);
  margin-bottom: 10px;
  font-weight: 600;
}

.quick-links {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.quick-links h4 {
  color: var(--primary-blue);
  margin-bottom: 20px;
  font-weight: 600;
}

.quick-links ul {
  list-style: none;
}

.quick-links li {
  margin-bottom: 12px;
}

.quick-links a {
  color: var(--dark-gray);
  text-decoration: none;
  padding: 8px 0;
  display: block;
  transition: color 0.3s ease;
}

.quick-links a:hover {
  color: var(--secondary-blue);
}

.quick-links i {
  margin-right: 10px;
  width: 20px;
  color: var(--secondary-blue);
}

.footer-gov {
  background: var(--dark-gray);
  color: white;
  padding: 40px 0 20px;
}

.footer-gov h5 {
  color: var(--accent-gold);
  margin-bottom: 15px;
  font-weight: 600;
}

.footer-gov a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-gov a:hover {
  color: white;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--secondary-blue),
    var(--primary-blue)
  );
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-outline-primary {
  border: 2px solid var(--secondary-blue);
  color: var(--secondary-blue);
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-outline-primary:hover {
  background: var(--secondary-blue);
  color: white;
  transform: translateY(-2px);
}
/* Large tile buttons to match stat cards */
.btn-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 80px; /* approximate height of the stat icon cards */
  padding: 18px 24px; /* ensure consistent vertical rhythm */
  border-radius: 12px;
  font-weight: 600;
}

.btn-tile i {
  font-size: 1.25rem;
}

.form-control,
.form-select {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 15px;
  transition: border-color 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--secondary-blue);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  background: #f9fafb;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.05);
}

.upload-area.dragover {
  border-color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.1);
}

.table-responsive {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.table {
  margin: 0;
  background: white;
}

.table th {
  background: var(--primary-blue);
  color: white;
  border: none;
  font-weight: 600;
  padding: 15px;
}

.table td {
  padding: 12px 15px;
  border-bottom: 1px solid #e5e7eb;
}

.table tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-green);
  color: white;
}

.badge-warning {
  background: var(--accent-gold);
  color: var(--text-dark);
}

.badge-danger {
  background: var(--danger-red);
  color: white;
}

.pagination {
  justify-content: center;
  margin-top: 30px;
}

.page-link {
  color: var(--secondary-blue);
  border: 1px solid #e5e7eb;
  padding: 10px 15px;
}

.page-link:hover {
  background: var(--secondary-blue);
  color: white;
}

.page-item.active .page-link {
  background: var(--secondary-blue);
  border-color: var(--secondary-blue);
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .header-title {
    font-size: 1.4rem;
  }

  .stat-card h3 {
    font-size: 2rem;
  }

  .module-card {
    margin-bottom: 20px;
  }
}

.navbar-toggler {
  border: none;
  padding: 4px 8px;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.alert {
  border: none;
  border-radius: 10px;
  padding: 15px 20px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-green);
  border-left: 4px solid var(--success-green);
}

.alert-warning {
  background: rgba(251, 191, 36, 0.1);
  color: #d97706;
  border-left: 4px solid var(--accent-gold);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-red);
  border-left: 4px solid var(--danger-red);
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

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

.dropdown-menu {
  border: none;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.dropdown-item:hover {
  background: var(--light-gray);
  color: var(--primary-blue);
}

.card {
  border: none;
  border-radius: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card-header {
  background: var(--light-gray);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 15px 15px 0 0 !important;
  padding: 20px;
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
}

.progress-bar {
  background: linear-gradient(
    90deg,
    var(--secondary-blue),
    var(--primary-blue)
  );
}

/* Authentication-based UI visibility */
#userDropdown {
  display: none !important;
}

#userDropdown.d-inline-block {
  display: inline-block !important;
}

/* Ensure dropdown is hidden for unauthenticated users */
.user-info #userDropdown:not(.d-inline-block) {
  display: none !important;
}

/* Prevent navigation flash before role-based rendering */
.navbar-nav {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease-in;
}

.navbar-nav.nav-ready {
  visibility: visible;
  opacity: 1;
}

/* Table wrapper for left alignment */
.table-wrapper-left {
  display: block;
  width: 100%;
  overflow-x: auto;
}

/* Table styling for jenis ketidakpatuhan */
.jenis-ketidakpatuhan-table {
  width: 50%;
  margin: 0;
  margin-left: 0 !important;
  margin-right: auto;
  border-collapse: collapse;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 3px solid #0a58ca;
  display: table;
  float: none;
}

@media (max-width: 768px) {
  .jenis-ketidakpatuhan-table {
    width: 100%;
  }
}

.jenis-ketidakpatuhan-table th {
  background-color: #0d6efd;
  color: white;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  border: 2px solid #0a58ca;
}

.jenis-ketidakpatuhan-table td {
  padding: 12px;
  border: 2px solid #6c757d;
  background-color: #fff;
}

.jenis-ketidakpatuhan-table tbody tr:hover {
  background-color: #f8f9fa;
}

.jenis-ketidakpatuhan-table td:first-child {
  font-weight: 500;
}

.jenis-ketidakpatuhan-table td:not(:first-child) {
  text-align: center;
}

/* Radio button styling for visibility */
.jenis-ketidakpatuhan-table input[type='radio'] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #0d6efd;
  transform: scale(1.3);
}

.jenis-ketidakpatuhan-table input[type='radio']:checked {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Bold numbered labels */
.form-label {
  font-weight: 600;
}

.jenis-ketidakpatuhan-label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: block;
}

/* Date range styling */
.form-label.text-muted.small {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6c757d !important;
  margin-bottom: 0.5rem;
}

.date-time-group {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  transition: all 0.2s ease;
}

.date-time-group:hover {
  border-color: #adb5bd;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

input[type='date'].form-control,
input[type='time'].form-control {
  padding: 0.625rem 0.75rem;
  font-size: 0.95rem;
}

input[type='date'].form-control:focus,
input[type='time'].form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Centered tab navigation for all pages */
.nav-tabs {
  justify-content: center !important;
  border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-item {
  margin: 0 5px;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  padding: 12px 20px;
  font-weight: 500;
  transition: all 0.3s ease;
  color: #6c757d;
  background-color: #f8f9fa;
}

.nav-tabs .nav-link:hover {
  border-color: #e9ecef #e9ecef #dee2e6;
  background-color: #e9ecef;
  color: #495057;
}

.nav-tabs .nav-link.active {
  color: #0d6efd;
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
  border-bottom: 3px solid #0d6efd;
  font-weight: 600;
}

/* Ensure tab content is properly aligned */
.tab-content {
  padding: 20px 0;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .nav-tabs {
    flex-wrap: wrap;
  }
  
  .nav-tabs .nav-item {
    margin: 2px;
    flex: 1;
    min-width: 120px;
  }
  
  .nav-tabs .nav-link {
    padding: 10px 12px;
    font-size: 0.9rem;
    text-align: center;
  }
}

/* Center main navbar navigation items */
.navbar-gov .navbar-collapse {
  justify-content: center;
}

.navbar-gov .navbar-nav.me-auto {
  margin-right: 0 !important;
  margin-left: 0 !important;
}

.navbar-gov .navbar-nav.ms-auto {
  position: absolute;
  right: 0;
}

@media (max-width: 991.98px) {
  .navbar-gov .navbar-collapse {
    justify-content: flex-start;
  }
  
  .navbar-gov .navbar-nav.ms-auto {
    position: static;
  }
}
