/* Metrofile app shell — clean, self-contained layout (no framework dependency) */

:root {
  --mf-pink: #e8175d;
  --mf-navy: #1c2635;
  --mf-navy-light: #263449;
  --mf-border: #d9dee3;
  --mf-text: #2b2f36;
  --mf-muted: #8b93a1;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--mf-text);
  background: #f4f6f8;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--mf-navy);
  color: #cfd6e0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 18px 20px 12px;
}

.sidebar-brand img {
  max-width: 180px;
  height: auto;
  display: block;
}

.sidebar-brand .tagline {
  color: #8b93a1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 4px 0 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.sidebar-nav details {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-nav summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  color: #e7eaef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-nav summary::-webkit-details-marker { display: none; }

.sidebar-nav summary::after {
  content: "\203A";
  transform: rotate(90deg);
  transition: transform 0.15s ease;
  color: var(--mf-muted);
}

.sidebar-nav details[open] summary::after {
  transform: rotate(270deg);
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0 0 10px;
}

.sidebar-nav ul li a {
  display: block;
  padding: 8px 20px 8px 36px;
  color: #b7bfcb;
  text-decoration: none;
  font-size: 13.5px;
}

.sidebar-nav ul li a:hover {
  background: var(--mf-navy-light);
  color: #fff;
}

.sidebar-single {
  padding: 12px 20px;
}

.sidebar-single a {
  color: #e7eaef;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.sidebar-single a:hover { color: var(--mf-pink); }

.sidebar-footer {
  padding: 14px 20px;
  font-size: 11px;
  color: #6b7280;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--mf-border);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 600;
}

.topbar .user {
  font-size: 13px;
  color: var(--mf-muted);
}

.content {
  padding: 28px;
  flex: 1;
}

.card {
  background: #fff;
  border: 1px solid var(--mf-border);
  border-radius: 6px;
  padding: 20px 24px;
  width: 100%;
}

.card h2 {
  margin-top: 0;
  font-size: 17px;
  border-bottom: 1px solid var(--mf-border);
  padding-bottom: 12px;
}

.card p {
  color: #555;
  line-height: 1.6;
}

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--mf-border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--mf-text);
}

.form-control:focus {
  outline: none;
  border-color: var(--mf-pink);
  box-shadow: 0 0 0 3px rgba(232, 23, 93, 0.12);
}

select.form-control { appearance: auto; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--mf-pink);
  color: #fff;
}

.btn-primary:hover { background: #c81250; }

.btn-secondary {
  background: #e9ecef;
  color: var(--mf-text);
}

.btn-secondary:hover { background: #dde1e5; }

.btn-danger {
  background: #d9364a;
  color: #fff;
}

.btn-danger:hover { background: #b82a3c; }

.btn-block { display: block; width: 100%; }

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: #e6f7ed;
  color: #1a7f4b;
  border: 1px solid #b7e6cb;
}

.alert-error {
  background: #fdecee;
  color: #b3202f;
  border: 1px solid #f5c2c9;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--mf-border);
  border-radius: 6px;
}

table.data-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}

table.data-table th,
table.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--mf-border);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

table.data-table th {
  background: #f0f2f5;
  font-weight: 600;
  color: #444;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data-table tbody tr:nth-child(even) td { background: #fafbfc; }
table.data-table tbody tr:hover td { background: #fdf1f5; }

table.data-table td.wrap {
  white-space: normal;
  max-width: 280px;
}

/* Fits within the card width, no horizontal scroll -- use for tables with few, short columns */
table.data-table.fixed-width {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

table.data-table.fixed-width th,
table.data-table.fixed-width td {
  white-space: normal;
  overflow-wrap: break-word;
}

.row { display: flex; flex-wrap: wrap; gap: 20px; }
.col { flex: 1; min-width: 260px; }

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-bar .form-control { flex: 1; min-width: 200px; }


/* =====================================================================
   Responsive layout: tablet, phone. Desktop (above 1100px) is unchanged.
   ===================================================================== */

/* Small polish that applies everywhere */
.nav-toggle, .nav-overlay { display: none; }
.sidebar-nav ul li a.active { background: var(--mf-navy-light); color: #fff; box-shadow: inset 3px 0 0 var(--mf-pink); }
.card { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.btn:focus-visible, .form-control:focus-visible, .sidebar-nav a:focus-visible, .sidebar-nav summary:focus-visible, .nav-toggle:focus-visible {
  outline: 2px solid var(--mf-pink); outline-offset: 2px;
}

/* Tablets and small laptops */
@media (max-width: 1100px) {
  .sidebar { width: 236px; }
  .topbar { padding: 12px 20px; }
  .content { padding: 20px; }
}

/* Phones and tablets: the menu slides in from the left, so the page gets the full width */
@media (max-width: 1024px) {
  html { -webkit-text-size-adjust: 100%; }
  .layout { flex-direction: row; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw);
    z-index: 1001;
    transform: translateX(-102%);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.4); }
  body.nav-open { overflow: hidden; }

  .nav-overlay {
    display: block;
    position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(16, 24, 40, 0.55);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
  }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

  .topbar {
    position: sticky; top: 0; z-index: 900;
    justify-content: flex-start; gap: 10px;
    padding: 8px 12px;
  }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
    flex: 0 0 44px; width: 44px; height: 44px; padding: 0;
    background: transparent; border: 1px solid var(--mf-border); border-radius: 8px; cursor: pointer;
  }
  .nav-toggle span { display: block; width: 20px; height: 2px; background: var(--mf-navy); border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .topbar h1 { flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .user { flex: 0 1 auto; max-width: 38vw; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .content { padding: 14px; }
  .card { padding: 16px; border-radius: 10px; }
  .card h2 { font-size: 16px; padding-bottom: 10px; }

  .sidebar-nav summary { padding: 14px 20px; }
  .sidebar-nav ul li a { padding: 12px 20px 12px 36px; font-size: 14.5px; }
  .sidebar-single { padding: 14px 20px; }

  /* Stack side-by-side columns; bigger touch targets; 16px inputs so phones do not zoom in on focus */
  .row { flex-direction: column; gap: 14px; }
  .col { min-width: 0; width: 100%; }
  .form-control, select.form-control, textarea.form-control, input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], select {
    font-size: 16px; min-height: 44px;
  }
  .btn { min-height: 44px; padding: 10px 16px; }
  .search-bar { flex-direction: column; gap: 10px; }
  .search-bar .form-control { min-width: 0; width: 100%; }
  .search-bar .btn { width: 100%; }
  .alert { font-size: 14px; }
}

/* Phones and small tablets: tables become cards, one card per row, with the column name beside each value */
@media (max-width: 900px) {
  .table-wrap { border: none; background: transparent; overflow: visible; border-radius: 0; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; min-width: 0; }
  table.data-table { background: transparent; }
  table.data-table thead, table.data-table colgroup, table.data-table tr.mf-headrow { display: none; }
  table.data-table tr {
    background: #fff; border: 1px solid var(--mf-border); border-radius: 10px;
    margin-bottom: 12px; padding: 4px 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  }
  table.data-table tbody tr:nth-child(even) td, table.data-table tbody tr:hover td { background: transparent; }
  table.data-table td, table.data-table td.wrap {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    padding: 8px 14px; border-bottom: 1px solid #eef0f3;
    white-space: normal !important; max-width: none !important; overflow-wrap: anywhere; word-break: break-word;
    text-align: right; font-size: 14px;
  }
  table.data-table td:last-child { border-bottom: 0; }
  table.data-table td::before {
    content: attr(data-label); flex: 0 0 40%; max-width: 40%;
    text-align: left; font-weight: 600; font-size: 12.5px; color: var(--mf-muted);
    text-transform: uppercase; letter-spacing: 0.02em;
  }
  table.data-table td[data-label=""]::before, table.data-table td:not([data-label])::before { display: none; }
  table.data-table td[data-label=""], table.data-table td:not([data-label]) { justify-content: flex-end; }
  table.data-table td[colspan] { justify-content: center; text-align: center; }
  table.data-table td .btn, table.data-table td button { min-height: 40px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .topbar .user { display: none; }
  .content { padding: 10px; }
}

/* Sign-in / password pages */
body.auth {
  min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(rgba(16, 24, 40, 0.62), rgba(16, 24, 40, 0.62)), url('../Indiseview Storage9.jpg') center / cover no-repeat fixed;
}
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 30px 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.auth-logo { display: block; margin: 0 auto 10px; max-width: 170px; height: auto; }
.auth-card h1 { font-size: 20px; text-align: center; margin: 6px 0 4px; }
.auth-card .auth-sub { text-align: center; color: var(--mf-muted); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.auth-card .form-group label { font-size: 13px; }
.auth-card .form-control { font-size: 16px; min-height: 46px; }
.auth-card .btn-block { min-height: 46px; margin-top: 6px; }
.auth-links { text-align: center; margin: 16px 0 0; font-size: 14px; }
.auth-links a { color: var(--mf-pink); text-decoration: none; font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
.auth-msg { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; text-align: center; }
.auth-msg.error { background: #fdecee; color: #b3202f; border: 1px solid #f5c2c9; }
.auth-msg.success { background: #e6f7ed; color: #1a7f4b; border: 1px solid #b7e6cb; }
@media (max-width: 800px) {
  body.auth { align-items: flex-start; padding: 24px 16px; background-attachment: scroll; }
  .auth-card { margin-top: 6vh; padding: 26px 20px 20px; }
}
@media (max-width: 700px) { .topbar .user-label { display: none; } }
@media (max-width: 900px) { table.data-table td:empty { display: none; } table.data-table td a { color: var(--mf-pink); font-weight: 600; } }

/* No-scroll tables (Search Files): tighter side padding so ID / code columns and their headings fit */
table.data-table.fixed-width th, table.data-table.fixed-width td { padding-left: 8px; padding-right: 8px; }

/* Small, plain tables (2-3 short columns, no buttons) stay as compact tables on phones instead of cards */
@media (max-width: 900px) {
  .table-wrap:has(> table.keep-table) { border: 1px solid var(--mf-border); border-radius: 8px; overflow-x: auto; background: #fff; }
  table.data-table.keep-table { display: table; width: 100%; background: #fff; }
  table.data-table.keep-table thead { display: table-header-group; }
  table.data-table.keep-table tbody { display: table-row-group; }
  table.data-table.keep-table tr, table.data-table.keep-table tr.mf-headrow {
    display: table-row; background: transparent; border: 0; border-radius: 0; margin: 0; padding: 0; box-shadow: none;
  }
  table.data-table.keep-table th, table.data-table.keep-table td, table.data-table.keep-table td:empty {
    display: table-cell; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--mf-border);
    white-space: normal !important; font-size: 13.5px;
  }
  table.data-table.keep-table td::before { display: none !important; }
  table.data-table.keep-table tbody tr:nth-child(even) td { background: #fafbfc; }
}

.nav-badge { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px; border-radius: 999px; background: var(--mf-pink); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.muted-text { color: var(--mf-muted); font-size: 13.5px; }
.sub-head { margin: 26px 0 10px; font-size: 15px; color: var(--mf-navy); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
textarea.form-control { resize: vertical; min-height: 80px; font-family: inherit; }
