/* ===================================================================
   Complete CSS for Dashboard (drop into css/index.css or styles.css)
   - Includes base reset, layout, cards, deputation grid (3 rows/col),
     responsive breakpoints, modal, tables, buttons, and helpers.
   =================================================================== */

/* ==== Base Reset & Layout ==== */
* {
  box-sizing: border-box;
}
html,
body,
#main {
  height: 100%;
}
body {
  margin: 0;
  padding: 0;
  padding-top: 80px; /* space for fixed header if any */
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to right, #f0f4f8, #ffffff);
  color: #004d40;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* === Color helpers (used in HTML) === */
.bg-info {
  background: linear-gradient(135deg, #17a2b8, #0ea5b7);
  color: #fff;
}
.bg-success {
  background: linear-gradient(135deg, #28a745, #1f8a3f);
  color: #fff;
}
.bg-danger {
  background: linear-gradient(135deg, #dc3545, #b93a36);
  color: #fff;
}
.bg-warning {
  background: linear-gradient(135deg, #ffc107, #e6a500);
  color: #000;
}

/* ==== Grid & Cards ==== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card {
  background-color: transparent; /* card color comes from .bg-* wrappers */
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  border-left: 6px solid rgba(0, 0, 0, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.card h3,
.card h4 {
  margin: 0;
  color: inherit;
  font-size: 1.05rem;
  font-weight: 600;
}

.card p,
.count {
  font-size: 1.4rem;
  font-weight: 700;
  color: inherit;
  margin: 0;
}

/* Deputation single-card layout */
.new-card-grid {
  display: flex;
  gap: 16px;
  margin-top: 1.5rem;
}
.new-card {
  flex: 1;
  padding: 18px;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==== Deputation inner grid: column-first with 3 rows per column ==== */
/* Desktop: 4 columns x 3 rows (12 visible).
   Tablet: 3 columns x 3 rows (9 visible).
   Mobile: 1 column x 3 rows (3 visible).
   Use CSS var --cols to control columns. */
.deput-grid {
  --cols: 4; /* default desktop */
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(3, auto); /* exactly 3 rows per column */
  grid-auto-flow: column; /* fill down each column, then next column */
  gap: 12px;
  margin-top: 12px;
}

/* deputation item style */
.deput-item {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.deput-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.deput-item h5 {
  margin: 0;
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
  line-height: 1.1;
  text-transform: none;
}
.deput-item p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

/* 'More' tile */
.deput-item.deput-more {
  cursor: pointer;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
}
.deput-empty {
  color: #fff;
  opacity: 0.95;
  text-align: center;
  padding: 8px;
}

/* ==== Headings & Text ==== */
h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #1e3a8a;
  text-align: center;
}
h2 {
  font-size: 1.15rem;
  color: #0f172a;
  margin-top: 6px;
  text-align: center;
}

.section-heading {
  margin-top: 2rem;
  color: #00695c;
  font-weight: 600;
}

/* ==== Tables ==== */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
}
.table th {
  background-color: #e0f7fa;
  color: #004d40;
  padding: 0.75rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.95rem;
}
.table td {
  padding: 0.75rem;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.95rem;
}
.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f9feff;
}

/* ==== Buttons ==== */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}
.btn-primary {
  background: linear-gradient(90deg, #2563eb, #1e40af);
  color: #fff;
}
.btn-success {
  background: linear-gradient(90deg, #16a34a, #15803d);
  color: #fff;
}

/* ==== Modal ==== */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: #fff;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.close {
  position: absolute;
  right: 14px;
  top: 10px;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
}
.employee-details p {
  margin: 8px 0;
  color: #333;
}

/* ==== Small helpers & layout ==== */
.text-center {
  text-align: center;
}
.action-row {
  margin-top: 1rem;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

/* ==== Accessibility: focus outlines ==== */
button:focus,
a:focus,
input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

/* ==== Responsive adjustments ==== */
/* Mirror the --cols variable along breakpoints for safety */
@media (max-width: 900px) {
  .deput-grid {
    --cols: 3;
  }
  .modal-content {
    max-width: 90%;
  }
}
@media (max-width: 480px) {
  .deput-grid {
    --cols: 1;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .new-card-grid {
    flex-direction: column;
  }
  .container {
    padding: 1rem;
    border-radius: 8px;
  }
}

/* ==== Utility color/text classes (optional) ==== */
.text-blue-600 {
  color: #2563eb;
}
.text-green-600 {
  color: #059669;
}
.small {
  font-size: 0.85rem;
  color: #666;
}

/* ==== Minor tweaks for high contrast and printing ==== */
@media print {
  body {
    background: #fff;
    color: #000;
    padding-top: 0;
  }
  .container {
    box-shadow: none;
    border-radius: 0;
  }
  .deput-item,
  .card {
    box-shadow: none;
    border: 1px solid #e6e6e6;
  }
}
