/* ── Reset & variables ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --border: #d9d5cc;
  --primary: #4a6fa5;
  --primary-dark: #3a5a8a;
  --danger: #c0392b;
  --text: #2c2c2c;
  --muted: #6b6b6b;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.1);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: .7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.brand { color: #fff; text-decoration: none; font-size: 1.15rem; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.nav-links a { color: #ffffffcc; text-decoration: none; font-size: .9rem; padding: .3rem .5rem; border-radius: var(--radius); }
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.15); }
.user-badge { background: rgba(255,255,255,.2); padding: .25rem .6rem; border-radius: 999px; font-size: .82rem; }

/* Dropdown */
.dropdown { position: relative; }
.dropbtn {
  background: none; border: 1px solid rgba(255,255,255,.4); color: #fff;
  padding: .3rem .7rem; border-radius: var(--radius); cursor: pointer; font-size: .9rem;
}
.dropbtn:hover { background: rgba(255,255,255,.15); }
.dropdown-content {
  display: none; position: absolute; top: 110%; left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 220px; box-shadow: var(--shadow);
  z-index: 200;
}
.dropdown-content a {
  display: block; padding: .5rem 1rem; color: var(--text);
  text-decoration: none; font-size: .88rem;
}
.dropdown-content a:hover { background: var(--bg); }
.dropdown-content hr { border: none; border-top: 1px solid var(--border); margin: .25rem 0; }
.dropdown:hover .dropdown-content { display: block; }

/* ── Layout ─────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; flex: 1; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-block; padding: .45rem 1rem; border-radius: var(--radius);
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: .9rem; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; text-align: center; padding: .6rem; }

/* ── Page header ─────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; gap: .5rem; flex-wrap: wrap; }
.page-header h2 { font-size: 1.4rem; }
.page-header > div { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th { background: var(--bg); padding: .6rem .8rem; text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: .5rem .8rem; border-bottom: 1px solid var(--border); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f0efea; }
.actions { white-space: nowrap; display: flex; gap: .3rem; }

/* ── Pagination ─────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; font-size: .88rem; color: var(--muted); }

/* ── Detail card ─────────────────────────────────────── */
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; }
dt { font-weight: 600; color: var(--muted); font-size: .85rem; align-self: start; padding-top: .15rem; }
dd { word-break: break-all; }

/* ── Form card ───────────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 700px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .87rem; font-weight: 600; margin-bottom: .3rem; }
.form-control { width: 100%; padding: .45rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,111,165,.15); }
.form-actions { display: flex; gap: .6rem; margin-top: 1.4rem; }

/* ── Auth ────────────────────────────────────────────── */
.auth-wrap { display: flex; justify-content: center; padding: 3rem 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-card h2 { margin-bottom: 1.5rem; }
.auth-footer { margin-top: 1.2rem; text-align: center; font-size: .88rem; color: var(--muted); }
.auth-footer a { color: var(--primary); text-decoration: none; }

/* ── Hero / card grid (home) ─────────────────────────── */
.hero { text-align: center; padding: 2.5rem 1rem 2rem; }
.hero h1 { font-size: 2rem; margin-bottom: .5rem; }
.hero p { color: var(--muted); margin-bottom: .8rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.card { display: flex; flex-direction: column; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; text-decoration: none; color: var(--text); transition: box-shadow .15s; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); border-color: var(--primary); }
.card-icon { font-size: 2rem; }
.card-label { font-weight: 600; font-size: .9rem; text-align: center; }

/* ── Alerts ─────────────────────────────────────────── */
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fdecea; border: 1px solid #f5c6c3; color: #922b21; }

/* ── Empty state ─────────────────────────────────────── */
.empty { color: var(--muted); padding: 2rem; text-align: center; }

/* ── Footer ─────────────────────────────────────────── */
footer { text-align: center; padding: 1rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: auto; }

/* ---------CUSTOM --------------*/
.table-thumb {
    max-height: 50px;
    max-width: 50px;
    width: auto;
    height: auto;
    object-fit: cover; /* Prevents distortion if images aren't perfectly square */
}
.table-thumb-container {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}