/* Google Font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100..900&display=swap');

/* ====== Base Styles ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

:root {
  --body-color: #E4E9F7;
  --sidebar-color: #FFF;
  --primary-color: #1E5A94;
  --primary-color-light: #F6FSFF;
  --toggle-color: #DDD;
  --text-color: #707070;

  --tran-02: all 0.2s ease;
  --tran-03: all 0.3s ease;
  --tran-04: all 0.4s ease;
  --tran-05: all 0.5s ease;
}

body {
  height: 100vh;
  background: var(--body-color);
  display: flex;
}

/* ====== Sidebar ====== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 250px;
  padding: 10px 14px;
  background: var(--sidebar-color);
}

.sidebar .text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
}

.sidebar .image {
  min-width: 60px;
  display: flex;
  align-items: center;
}

.sidebar li {
  height: 50px;
  margin: 10px;
  list-style: none;
  display: flex;
  align-items: center;
}

.sidebar li .icon,
.sidebar li .text {
  color: var(--text-color);
  transition: var(--tran-03);
}

.sidebar li .icon {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 60px;
  font-size: 20px;
}

.sidebar header {
  position: relative;
}

.sidebar .image-text {
  display: flex;
  align-items: center;
}

.sidebar .image-text img {
  width: 60px;
  border-radius: 6px;
}

.header-text {
  display: flex;
  flex-direction: column;
}

.header-text .name {
  font-weight: 600;
}

.sidebar header .toggle {
  position: absolute;
  top: 50%;
  right: -25px;
  transform: translateY(-50%);
  height: 25px;
  width: 25px;
  background: var(--primary-color);
  color: var(--sidebar-color);
  font-size: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar li a {
  text-decoration: none;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: var(--tran-04);
}

.sidebar li a:hover {
  background: var(--primary-color);
}

.sidebar li a:hover .icon,
.sidebar li a:hover .text {
  color: var(--sidebar-color);
}

/* Active nav-link glow */
.sidebar li a.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 0 10px #1E5A94, 0 0 20px #1E5A94;
}

.sidebar li a.active .icon,
.sidebar li a.active .text {
  color: #fff;
}

.sidebar .search-box,
.menu-bar .mode {
  background: var(--primary-color-light);
}

.sidebar .menu-bar {
  height: calc(100% - 50px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Dropdown Menu */
/* Dropdown container */
.nav-link.dropdown {
  position: relative;
}

/* Dropdown toggle styling */
.dropdown-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 100%;
}

/* Dropdown menu hidden by default */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--sidebar-color, #f5f5f5);
  padding: 10px 0;
  min-width: 200px;
  z-index: 999;
}

/* Show menu on hover */
.nav-link.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li a {
  text-decoration: none;
  color: var(--text-color, #333);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Initial chevron style */
.dropdown-icon {
  transition: transform 0.3s ease;
}

/* Rotate chevron when hovering over the parent */
.nav-link.dropdown:hover .dropdown-icon {
  transform: rotate(180deg);
}

/* ====== Dashboard Content ====== */
.dashboard-content {
  margin-left: 250px;
  padding: 2rem;
  width: 100%;
  min-height: 100vh;
  background: var(--body-color);
  position: relative;
  overflow: hidden;
}

/* Ensures main content stays above the logo */
.dashboard-content > * {
  position: relative;
  z-index: 1;
}



/* ====== Cards ====== */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-bottom: 40px;
}

.card {
  background: var(--sidebar-color);
  border-radius: 10px;
  padding: 20px;
  flex: 1 1 calc(33.333% - 40px);
  max-width: calc(33.333% - 40px);
  display: flex;
  flex-direction: column; /* stack chart & title vertically */
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: var(--tran-03);
  text-align: center; /* center text for chart card */
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card i {
  font-size: 2.5rem;
  color: var(--primary-color);
}

.card h3 {
  font-size: 18px; /* smaller for chart card */
  color: var(--primary-color);
  margin-bottom: 10px;
}

.card p {
  font-size: 14px;
  color: var(--text-color);
  margin-top: 5px;
}

.card canvas {
    width: 100% !important;   /* responsive full width */
    max-width: 250px;         /* maximum width */
    max-height: 250px !important; /* max height */
    margin: auto;             /* center horizontally */
    display: block;           /* ensure block display for centering */
}



/* ====== Modals ====== */
#addModal > div > form,
#updateModal > div > form,
#updateProgramModal > div > form,
#updateSfrModal > div > form,
#updateTrbaModal > div > form,
#updateDocuModal > div > form,
#updateUserModal > div > form {
  padding-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px; /* spacing between input fields */
}

#deleteModal > div > h1,
#addModal > div > h1,
#updateModal > div > h1,
#deleteProgramModal > div > h1,
#updateProgramModal > div > h1,
#deleteSfrModal > div > h1,
#updateSfrModal > div > h1,
#deleteTrbaModal > div > h1,
#updateTrbaModal > div > h1,
#deleteDocuModal > div > h1,
#updateDocuModal > div > h1,
#updateUserModal > div > h1,
#deleteUserModal > div > h1  {
  color: #1E5A94;
  margin-bottom: 20px; /* space below the modal heading */
}

.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding-top: 80px;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 24px 20px;
  width: 340px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Input and Labels */
.modal-content label {
  display: block;
  text-align: left;
  font-weight: 500;
  margin-bottom: 5px;
  color: #333;
}

.modal-content input[type="text"],
.modal-content input[type="date"],
.modal-content input[type="role"],
.modal-content input[type="password"],
.modal-content input[type="file"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.modal-content button,
.modal-buttons button {
  background-color: #28a745;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-size: 14px;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.modal-buttons button {
  width: 120px;
}

.modal-content button:hover,
.modal-buttons button:hover {
  background-color: #a00000;
}

.close {
  color: #aaa;
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  margin-top: -12px;
  margin-right: -8px;
}

/* ====== Table ====== */
.table-section h2 {
  background-color: #1E5A94;
  padding: 10px 15px;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 10px;
  font-size: 20px;
  color: #fff;
}

.table-section table {
  background: #fff;
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 15px;
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.table-section th,
.table-section td {
  padding: 12px 15px;
  border: 4px solid rgba(0, 0, 0, 0.15);
  text-align: left;
}

.table-section th {
  background-color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.table-section tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.table-container {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 6px;
  background-color: transparent;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 15px;
  color: #000;
}

.table-container th,
.table-container td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.table-container thead th {
  position: sticky;
  top: 0;
  background-color: #fff;
  font-weight: 700;
  padding: 12px 15px;
  border: 4px solid rgba(0, 0, 0, 0.15); /* Full border */
  z-index: 1;
  text-align: center;
}

.table-section td,
.table-section th {
  text-align: center;
}

.table-section tr:last-child td {
  border-bottom: 4px solid rgba(0, 0, 0, 0.15); /* Ensures last row has bottom border */
}

/* Left-align only the first column (Program) */
.table-section td:first-child,
.table-section th:first-child {
  text-align: left;
}

/* ====== Buttons ====== */
.btn-update,
.btn-view,
.btn-delete,
.btn-add {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: #101010;
  text-decoration: none;
}

.btn-view {
  background-color: #ccc;
}

.btn-view:hover {
  background-color: #2980b9;
}

.btn-update {
  background-color: #17a2b8;
}

.btn-update:hover {
  background-color: #0056b3;
}

.btn-delete {
  background-color: #dc3545;
}

.btn-delete:hover {
  background-color: #c82333;
}

.btn-add {
  background-color: #28a745;
  font-size: 16px;
}

.btn-add:hover {
  background-color: #218838;
}

.add-button-container {
  width: 100%;
  margin: 20px auto;
  text-align: center;
}

.add-button-container button {
  padding: 10px 20px;
  display: inline-block;
}

/* ====== Search Bar ====== */
.search-bar {
  margin: 30px 0 10px;
}

#searchInput{
  width: 100%;
  padding: 10px;
  border-radius: 25px;
}

.search-container {
  display: flex;
  align-items: center;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-container input[type="text"] {
  width: 100%;
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  background: transparent;
}

.search-container i {
  font-size: 20px;
  color: #800000;
  margin-left: 8px;
  cursor: pointer;
}

/* ====== Responsive ====== */
@media screen and (max-width: 992px) {
  .card {
    flex: 1 1 45%;
    max-width: 45%;
  }
}

@media screen and (max-width: 600px) {
  .card {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .dashboard-content {
    padding: 1rem;
    margin-left: 0;
  }

  .sidebar {
    width: 100%;
    position: static;
  }
}

.form-box {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.form-box input[type="text"],
.form-box input[type="date"],
.form-box input[type="password"],
.form-box input[type="file"],
.form-box input[type="email"] {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.form-buttons {
  display: flex;
  justify-content: center; /* center buttons horizontally */
  gap: 20px;               /* space between the buttons */
  margin-top: 20px;        /* spacing above the button group */
}

.btn-cancel {
  padding: 10px 20px;
  background-color: gray;
  color: white;
  border: none;
  border-radius: 8px;
  text-decoration: none;
}

.btn-cancel:hover {
  background-color: #555;
}

.form-box select {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  appearance: none; /* Removes default arrow in some browsers */
  -webkit-appearance: none;
  -moz-appearance: none;
  font-size: 16px;
}

.form-box select:focus {
  outline: none;
  border-color: #5b9bd5; /* highlight border on focus */
  box-shadow: 0 0 5px rgba(91, 155, 213, 0.5);
}

.form-box option {
  padding: 10px;
}

/* Wrapper to position icon */
.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.select-wrapper select {
  width: 100%;
  padding: 10px;
  padding-right: 40px; /* space for icon */
  margin-top: 5px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  appearance: none;
  background-color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.select-wrapper select:focus {
  outline: none;
  border-color: #5b9bd5;
  box-shadow: 0 0 5px rgba(91, 155, 213, 0.5);
}

.select-wrapper .select-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none; /* so clicks go through to the select */
  color: #666;
  font-size: 20px;
}

/* ====== Add Program Page Styles ====== */
.container {
  max-width: 500px;
  margin: 80px auto;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.container h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--primary-color);
  font-size: 24px;
}

.container label {
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
  color: #333;
}

.container input[type="text"] {
  width: 100%;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 20px;
  font-size: 15px;
  transition: border-color 0.3s ease;
}

.container input[type="text"]:focus {
  border-color: var(--primary-color);
  outline: none;
}

.container button[type="submit"] {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background-color: var(--primary-color);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.container button[type="submit"]:hover {
  background-color: #a00000;
}

.message {
  text-align: center;
  margin-top: 15px;
  font-weight: 500;
  color: green;
}

.message.error {
  color: red;
}

.container .back {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.container .back:hover {
  text-decoration: underline;
}

.modal {
  display: none; 
  position: fixed; 
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%;
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.5); 
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  width: 400px;
  position: relative;
}

.modal-content .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

/* alert notification */

.alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #d1e7dd; /* Light green background */
  color: #0f5132;            /* Dark green text */
  padding: 14px 24px;
  border-left: 6px solid #198754; /* Accent green border */
  border-radius: 8px;
  z-index: 1000;
  animation: fadeIn 0.4s ease-out, fadeOut 0.4s ease-in 3.6s forwards;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  max-width: 90%;
  width: auto;
}

.delete-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #f8d7da; /* Light red background */
  color: #842029;            /* Dark red text */
  padding: 14px 24px;
  border-left: 6px solid #dc3545; /* Accent border */
  border-radius: 8px;
  z-index: 1000;
  animation: fadeIn 0.4s ease-out, fadeOut 0.4s ease-in 3.6s forwards;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  max-width: 90%;
  width: auto;
}

/* Optional: fade out after a few seconds */
@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* Logs Print Button */
/* Print only the table + heading */
@media print {
    body * { 
        visibility: hidden; /* Hide everything else */
    }

    /* Heading for print */
    #printHeading { 
        display: block;
        text-align: center;
        font-family: Arial, sans-serif; 
        font-size: 10pt; /* Slightly smaller for print */
        font-weight: bold;
        margin-bottom: 10px;
    }

    /* Table and its contents */
    #printableTable, #printableTable * { 
        visibility: visible;
        font-family: Arial, sans-serif; 
        font-size: 8pt; /* Small font like Word size 8 */
    }

    #printableTable { 
        position: absolute; 
        top: 50px; /* space for heading */
        left: 0; 
        width: 100%; 
    }
}

/* Hide print heading on screen */
#printHeading { display: none; }

/* Print button styling (if needed inline) */
#printTableBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
}

#printTableBtn:hover {
    background-color: #45a049;
}

.input-wrapper {
  position: relative;
  display: block; /* allows full-width input */
  width: 100%;    /* wrapper takes full width */
}

.input-wrapper input {
  width: 100%;    /* input fills the wrapper */
  padding-right: 30px; /* space for the icon */
  box-sizing: border-box; /* includes padding in width */
}

.input-wrapper i {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}


/* ====== Approve / Reject Buttons ====== */
.btn-approve {
  background-color: #28a745;
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-approve:hover {
  background-color: #218838;
}

.btn-reject {
  background-color: #dc3545;
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-reject:hover {
  background-color: #c82333;
}

/* ===== User Approval Confirmation Modal ===== */
.user-confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.user-confirm-content {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  animation: userPop 0.25s ease;
}

@keyframes userPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* PASSWORD STRENGTH */
.password-strength {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.strength-box {
  flex: 1;
  height: 6px;
  background: #ddd;
  border-radius: 5px;
  transition: background 0.3s ease;
}

.strength-box.active.weak {
  background: #e74c3c;
}

.strength-box.active.medium {
  background: #f1c40f;
}

.strength-box.active.strong {
  background: #2ecc71;
}

.password-message {
  font-size: 12px;
  margin-top: 5px;
  display: block;
  color: #555;
}

.notif-badge {
  background-color: #dc3545;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 12px;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
  display: inline-block;
  line-height: 1.2;
}

.password-message {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
}

.password-message.match {
    color: #2e7d32; /* green */
}

.password-message.mismatch {
    color: #c62828; /* red */
}