/* ============================
   RESET & BASE STYLES
============================ */
:root {
  --primary: #2980b9;
  --danger: #e74c3c;
  --danger-dark: #c0392b;
  --success: #27ae60;
  --success-dark: #219150;
  --warning: #f39c12;
  --warning-dark: #e67e22;
  --neutral: #7f8c8d;
  --neutral-light: #95a5a6;
  --info: #3498db;
  --text-dark: #333;
  --background-light: #f5f7fa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

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

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============================
   HEADER & NAVIGATION
============================ */
.main-header {
  background-color: var(--primary);
  color: #fff;
  padding: 1rem;
  width: 100%;
}

.header-bar-3col {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.left-brand {
  display: flex;
  align-items: center;
  padding-left: 1rem;
  gap: 0.5rem;
}

.logo1 {
  display: block;
  max-height: 60px;
  height: auto;
  width: auto;
  margin: -0.5rem auto 1rem auto; /* moved up slightly */
}

.center-title {
  flex: 1;
  text-align: center;
  transform: translateX(-1rem);
}

.app-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  white-space: nowrap;
}

.right-nav {
  display: flex;
  gap: 1rem;
  padding-right: 1rem;
}

.btn.logout {
  background-color: var(--danger);
  color: white;
}

.btn.logout:hover {
  background-color: var(--danger-dark);
}

@media (max-width: 768px) {
  .header-bar-3col {
    flex-direction: column;
    gap: 1rem;
  }
  .left-brand,
  .right-nav {
    justify-content: center;
  }
  .center-title {
    transform: none;
  }
}

/* ============================
   FOOTER
============================ */
.main-footer {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  margin-top: 3rem;
}

/* ============================
   DASHBOARD SUMMARY CARDS
============================ */
.dashboard-container {
  width: 100%;
  margin: 0 auto;
  padding: 1rem 0;
  margin-bottom: 0.5rem;
}

.dashboard-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 0;             /* No margin on sides */
  padding: 0.5rem 0;     /* No horizontal padding */
  width: 100%;
  box-sizing: border-box;
}
.summary-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}



.department-row-table {
  flex: 1 1 100%;
  background: #fff;
  padding: 1rem 0;
  border-radius: 1px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
}

.department-row-table table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.department-row-table th,
.department-row-table td {
  padding: 0.6rem;
  text-align: center;
  font-size: 0.9rem;
  word-break: break-word;
  white-space: normal;
}

@media (max-width: 600px) {
  .dashboard-top-row {
    flex-direction: column;
  }

  .department-row-table {
    padding: 0.75rem;
  }

  .department-row-table th,
  .department-row-table td {
    font-size: 0.8rem;
    padding: 0.4rem;
  }
}

/* ============================
   SEARCH BAR
============================ */
.actions-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.search-bar {
  padding: 0.6rem 1rem;
  width: 300px;
  max-width: 90%;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

/* ============================
   TABLE STYLES
============================ */
.table-responsive {
  overflow-x: auto;
  width: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.table-responsive table {
  width: 100%;
  min-width: 800px;
}

thead th {
  background-color: var(--info);
  color: white;
  padding: 0.625rem;
  text-align: center;
}

thead th a {
  color: white;
  font-weight: bold;
}

tbody td {
  padding: 0.625rem;
  text-align: center;
  border-bottom: 1px solid #eee;
}

tbody tr:hover {
  background-color: #f1f1f1;
}

@media (max-width: 1024px) {
  .table-responsive table {
    width: 100%;
    min-width: unset;
  }
}

/* ============================
   BUTTONS
============================ */
.btn {
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  display: inline-block;
}

.btn:focus {
  outline: 2px dashed var(--info);
  outline-offset: 2px;
}

.btn.primary {
  background-color: var(--success);
  color: white;
}

.btn.primary:hover {
  background-color: var(--success-dark);
}

.btn.edit {
  background-color: var(--warning);
  color: white;
}

.btn.edit:hover {
  background-color: var(--warning-dark);
}

.btn.delete {
  background-color: var(--danger);
  color: white;
}

.btn.delete:hover {
  background-color: var(--danger-dark);
}

.btn.cancel {
  background-color: var(--neutral);
  color: white;
}

.btn.cancel:hover {
  background-color: var(--neutral-light);
}

/* ============================
   FORMS & INPUTS
============================ */
.form-container {
  background: #ffffff;
  max-width: 90vw;
  margin: 2rem auto;
  padding: 1.5rem 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
}

.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="date"],
.form-container input[type="file"],
.form-container select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  background-color: #fefefe;
}

.form-container input:focus,
.form-container select:focus {
  outline: none;
  border-color: var(--info);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .form-container {
    padding: 1rem;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar {
    width: 100%;
  }

  table {
    min-width: 800px;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem 1.5rem;
  margin-top: 1rem;
}

.form-grid > div {
  display: flex;
  flex-direction: column;
}

@media (max-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================
   LOGIN SECTION
============================ */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.2rem;
}

.login-container {
  max-width: 420px;
  width: 100%;
  background-color: #ffffff;
  padding: 2rem 2.5rem;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.08);
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  background-color: #f9f9f9;
}

.login-form input:focus {
  border-color: var(--info);
  outline: none;
}

.login-form .btn {
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: bold;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-weight: 600;
}

@media (max-width: 480px) {
  .login-container {
    padding: 1.5rem;
    margin: 3rem auto;
  }

  .login-form input {
    font-size: 0.95rem;
    padding: 0.6rem;
  }

  .login-form .btn {
    font-size: 1rem;
    padding: 0.7rem;
  }
}

/* ============================
   IMAGE PREVIEW POPUP
============================ */
.thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  cursor: pointer;
}

.thumb:hover {
  transform: scale(1.05);
}

.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.popup-content {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}
