* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f4f4;
}

/* HEADER */
header {
  background: #ffffff;
  padding: 15px 20px;
  border-bottom: 2px solid #006400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.header-left { width: 150px; }

.header-title { flex: 1; text-align: center; }

/* Ensure "DIRECTORATE..." larger than "DATABANK" */
.title-line1,
.title-line2 {
  margin: 0;
  color: #006400;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  word-break: break-word;
}

.title-line1 { font-size: 28px; }
.title-line2 { font-size: 18px; letter-spacing: 2px; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right img { height: 44px; }

.user-info {
  text-align: right;
  font-size: 13px;
  color: #006400;
  line-height: 1.25;
}

.logout-btn {
  background: #C00000;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 3px;
}

/* MAIN */
.container { padding: 20px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 20px;
}

/* CARDS */
.card {
  background: white;
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sub-card {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  padding: 12px;
}

/* BUTTONS */
.action-btn {
  width: 100%;
  background: #006400;
  color: white;
  border: none;
  padding: 10px;
  cursor: pointer;
  margin-bottom: 10px;
  border-radius: 3px;
}

.action-btn.red { background: #C00000; }

.action-btn.small {
  width: auto;
  padding: 8px 12px;
  margin: 0;
}

.link-danger {
  background: none;
  border: none;
  color: #C00000;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.disabled-action {
  color: #888;
  cursor: not-allowed;
}

/* FORMS */
input, select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
}

.label { font-size: 12px; color: #333; font-weight: bold; }

.hint { font-size: 12px; color: #444; margin: 6px 0 10px; }
.hint.small { font-size: 11px; color: #666; }

.folder-multiselect {
  width: 100%;
  padding: 8px;
  margin: 0;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border: 1px solid #ddd;
  padding: 10px;
  vertical-align: top;
}

th {
  background: #006400;
  color: white;
}

/* SEARCH BAR (one-row compact layout) */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: nowrap;
}

.search-input {
  padding: 10px;
  height: 42px;
  margin-bottom: 0;
}

.search-keyword { width: 260px; max-width: 50vw; }
.search-date { width: 170px; }
.search-btn {
  height: 42px;
  padding: 0 16px;
  background: #006400;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
}

/* Recent list spacing (shift upward) */
.recent-title { margin: 8px 0 10px; }
.recent-files-area { margin-top: 0; }
.recent-table { margin-top: 0; }

/* Folder banner */
.folder-banner {
  background: #e9f7ea;
  border: 1px solid #cfe8d2;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.back-link {
  margin-left: 10px;
  color: #006400;
  font-weight: bold;
  text-decoration: none;
}

/* MODALS */
.modal {
  display: none;
  position: fixed;
  z-index: 5000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  overflow: auto;
  padding: 18px 12px;
}

.modal-content {
  background: white;
  padding: 20px;
  margin: 0 auto;
  width: 420px;
  border-radius: 5px;
  position: relative;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.modal-wide {
  width: min(1200px, 98vw);
  max-width: 98vw;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

/* Full screen modal feel */
.modal-full {
  width: min(1400px, 98vw);
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
}

.close {
  position: absolute;
  right: 12px; top: 10px;
  cursor: pointer;
  font-size: 24px;
}

/* USER MANAGEMENT interactive layout */
.um-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-top: 10px;
}

.um-list {
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.um-toolbar {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.um-users { flex: 1; overflow: auto; }

.um-user {
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f1f1f1;
}
.um-user:hover { background: #f7fbf7; }
.um-user.active { background: #e9f7ea; }

.um-user-name { font-weight: bold; color: #006400; }
.um-user-meta { font-size: 12px; color: #555; margin-top: 2px; }

.um-panel { min-height: 60vh; }

.um-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.um-create,
.um-modify {
  max-height: 70vh;
  overflow: auto;
}

.um-form .um-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.um-checks label { display: inline-block; margin-right: 12px; font-size: 13px; }

.um-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

/* ================= FOLDER MANAGEMENT (3 columns) ================= */
.fm-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
  min-height: 70vh;
}

.fm-list {
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.fm-toolbar {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

/* ✅ Windows-style folder grid container */
.fm-folders {
  flex: 1;
  overflow: auto;
  padding: 12px;
}

/* ✅ Root grid */
.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  align-content: start;
}

/* Folder node wrapper (each folder, plus its children container) */
.fm-node {
  position: relative;
}

/* ✅ Folder tile button (icon + name underneath) */
.fm-tile {
  width: 100%;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 10px;
  padding: 12px 10px 10px;
  cursor: pointer;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
  position: relative;
  transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
}

.fm-tile:hover {
  border-color: #cfe8d2;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.fm-tile.active {
  border-color: #006400;
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

/* ✅ Folder icon (CSS-only) */
.fm-icon {
  width: 58px;
  height: 42px;
  position: relative;
  border-radius: 6px;
  background: #f2c14e;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.08);
}

.fm-icon::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 6px;
  width: 26px;
  height: 14px;
  background: #f6d58a;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.08);
}

.fm-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
}

/* Folder name below icon */
.fm-tile-name {
  font-size: 12px;
  font-weight: 700;
  color: #006400;
  line-height: 1.2;
  word-break: break-word;
}

/* ✅ Small expand/collapse arrow (top-right) */
.fm-toggle {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  pointer-events: auto;
  z-index: 3;
}

.fm-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 6px solid #006400;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: rotate(0deg);
  transition: transform .15s ease;
}

/* Rotate arrow when open */
.fm-node.open .fm-toggle::before {
  transform: rotate(90deg);
}

/* ✅ Children container */
.fm-children {
  margin-top: 10px;
  padding: 10px;
  border-left: 3px solid #e9f7ea;
  background: #fbfffb;
  border-radius: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}

/* Slight indent per depth */
.fm-node[data-depth="1"] { margin-left: 10px; }
.fm-node[data-depth="2"] { margin-left: 16px; }
.fm-node[data-depth="3"] { margin-left: 22px; }

/* Old list styles kept (in case other parts still use them) */
.fm-folder {
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f1f1f1;
}
.fm-folder:hover { background: #f7fbf7; }
.fm-folder.active { background: #e9f7ea; }

.fm-folder-name { font-weight: bold; color: #006400; }
.fm-folder-meta { font-size: 12px; color: #555; margin-top: 2px; }

.fm-create .sub-card,
.fm-modify .sub-card {
  min-height: 70vh;
  overflow: auto;
}

.fm-modify .action-btn { margin-top: 6px; }


/* ================= FILE MANAGEMENT MODAL (FULL SCREEN, 2 COLUMNS) ================= */
.filem-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr; /* left wider than right */
  gap: 12px;
  margin-top: 10px;
  min-height: 70vh;
}

.filem-list {
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 70vh;

  border-right: 1px solid rgba(0,0,0,0.08);
  padding-right: 16px;
}


.filem-toolbar {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.filem-folders {
  flex: 1;
  overflow: auto;
  padding:  12px 12px 12px;
}

.filem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  align-content: start;
}

.filem-tile { padding: 12px 10px 10px; }

.filem-upload .sub-card {
  min-height: 70vh;
  overflow: auto;
}

.filem-selected { margin-top: 8px; }

/* FOOTER */
footer {
  margin-top: 25px;
  background: #006400;
  color: white;
  text-align: center;
  padding: 10px;
}

/* Protected Area */
.protected-area {
  user-select: none;
  -webkit-user-select: none;
}
.protected-area.blurred { filter: blur(10px); }

/* TOAST POPUPS */
.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success { background: #006400; }
.toast-error   { background: #C00000; }
.toast-info    { background: #333; }

/* MOBILE */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .header-left { display: none; }
  .header-right img { height: 38px; }

  .title-line1 { font-size: 20px; }
  .title-line2 { font-size: 14px; }

  .um-layout { grid-template-columns: 1fr; }
  .um-panel-grid { grid-template-columns: 1fr; }
  .um-create, .um-modify { max-height: none; }
  .um-form .um-row { grid-template-columns: 1fr; }

  .fm-layout { grid-template-columns: 1fr; }
  .fm-create .sub-card, .fm-modify .sub-card { min-height: auto; }

  .search-bar { flex-wrap: wrap; }
  .search-keyword { width: 100%; max-width: 100%; }
  .search-date { width: 100%; }
  .search-btn { width: 100%; }

  .toast { left: 12px; right: 12px; max-width: unset; }

  /* tighter tiles on mobile */
  .fm-grid,
  .fm-children {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ✅ EXTRA MOBILE HEADER FIX (this is what solves your screenshot issue) */
@media (max-width: 600px) {
  header {
    padding: 10px 12px;
    flex-direction: column;          /* stack title above right-controls */
    align-items: stretch;
    gap: 8px;
    flex-wrap: nowrap;               /* stop weird wrapping patterns */
  }

  .header-title {
    order: 1;
    width: 100%;
  }

  /* Make the long title readable without splitting into letters */
  .title-line1,
  .title-line2 {
    letter-spacing: 0.5px;
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
  }

  .title-line1 { font-size: 16px; }
  .title-line2 { font-size: 12px; letter-spacing: 1px; }

  .header-right {
    order: 2;
    width: 100%;
    justify-content: space-between;  /* logo left, user+logout right */
    gap: 8px;
  }

  .header-right img { height: 32px; }

  .user-info {
    text-align: left;                /* looks cleaner on mobile */
    font-size: 12px;
    line-height: 1.15;
  }

  .logout-btn {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .filem-layout { grid-template-columns: 1fr; }
  .filem-list { min-height: auto; }
  .filem-upload .sub-card { min-height: auto; }
  .filem-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ================== HOMEPAGE (/) ================== */
.home-body {
  min-height: 100vh;
  margin: 0;
}

.home-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;

  /* PDP-themed premium banner background (no image required) */
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(0, 130, 62, 0.25), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(225, 28, 44, 0.22), transparent 62%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06) 0px,
      rgba(255, 255, 255, 0.06) 8px,
      rgba(0, 0, 0, 0.04) 8px,
      rgba(0, 0, 0, 0.04) 16px
    ),
    linear-gradient(180deg, #0a0f0c 0%, #0a1110 50%, #070b09 100%);
}

.home-glass {
  width: min(960px, 100%);
  border-radius: 18px;
  padding: 48px 28px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 20, 16, 0.62);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.home-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.home-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #ffffff;
  text-transform: uppercase;
}

.home-subtitle {
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
}

.home-accent {
  width: 140px;
  height: 4px;
  margin: 18px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #00823e, #e11c2c);
}

.home-cta {
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(90deg, rgba(0, 130, 62, 0.95), rgba(225, 28, 44, 0.95));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.home-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  filter: brightness(1.05);
}

.home-footnote {
  margin: 16px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 520px) {
  .home-glass { padding: 36px 18px; }
  .home-logo { width: 96px; height: 96px; }
  .home-title { font-size: 18px; }
  .home-subtitle { font-size: 15px; }
}


/* ================= Dashboard Pagination ================= */
.pagination{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-top:14px;
  padding-top:10px;
  border-top:1px solid rgba(0,0,0,0.08);
}
.page-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:10px;
  text-decoration:none;
  font-weight:700;
  border:1px solid rgba(0,0,0,0.14);
  background:#fff;
  color:#111;
  transition:transform .05s ease, box-shadow .12s ease;
}
.page-btn:hover{
  box-shadow:0 6px 18px rgba(0,0,0,0.08);
  transform:translateY(-1px);
}
.page-btn.disabled{
  opacity:.5;
  cursor:not-allowed;
}
.page-info{
  font-weight:700;
  color:#111;
}
