/* ============================================================
   Registry Portal – Main Stylesheet
   Color scheme: Black & White (no framework)
   ============================================================ */

/* ---- Self-hosted fonts (admin panel) ---- */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-400.woff2') format('woff2'),
       url('../fonts/Inter-400.woff')  format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-500.woff2') format('woff2'),
       url('../fonts/Inter-500.woff')  format('woff');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-600.woff2') format('woff2'),
       url('../fonts/Inter-600.woff')  format('woff');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'DM Serif Display';
  src: url('../fonts/DMSerifDisplay-Regular.woff2') format('woff2'),
       url('../fonts/DMSerifDisplay-Regular.woff')  format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --black:       #0A0A0A;
  --white:       #FFFFFF;
  --surface:     #111111;
  --surface-2:   #1A1A1A;
  --border:      #2A2A2A;
  --border-light:#E0E0E0;
  --muted:       #6B6B6B;
  --muted-light: #999999;
  --bg:          #F5F5F5;
  --bg-card:     #FFFFFF;
  --text:        #0A0A0A;
  --text-light:  #444444;
  --success:     #1a7a3c;
  --success-bg:  #e8f5ee;
  --error:       #8b1a1a;
  --error-bg:    #fce8e8;
  --warn:        #6b5a00;
  --warn-bg:     #fdf7e3;
  --radius:      4px;
  --radius-lg:   8px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  --shadow-heavy:0 2px 8px rgba(0,0,0,.14), 0 8px 32px rgba(0,0,0,.08);
  --font-display:'DM Serif Display', Georgia, serif;
  --font-body:   'Inter', system-ui, -apple-system, sans-serif;
  --transition:  .18s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.auth-brand {
  width: 45%;
  background: var(--black);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
}
.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 220px; height: 220px;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 50%;
}
.auth-brand .brand-logo {
  width: 72px; height: 72px;
  border: 2px solid rgba(255,255,255,.4);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.auth-brand .brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-brand .brand-logo .logo-initials {
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 2px;
}
.auth-brand h1 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 2rem;
  line-height: 1.2;
  text-align: center;
  margin-bottom: .75rem;
}
.auth-brand p {
  color: rgba(255,255,255,.5);
  text-align: center;
  font-size: .9rem;
  max-width: 280px;
}
.auth-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--white);
}
.auth-form-inner {
  width: 100%;
  max-width: 420px;
}
.auth-form-inner h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: .5rem;
}
.auth-form-inner .subtitle {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 2rem;
}

/* ============================================================
   LAYOUT – SIDEBAR + MAIN
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--black);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-brand .brand-img {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .brand-img img { width: 100%; object-fit: contain; }
.sidebar-brand .brand-name {
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.2;
}
.sidebar-brand .brand-role {
  color: rgba(255,255,255,.35);
  font-size: .75rem;
}
.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
}
.sidebar-section {
  padding: .25rem .75rem .1rem;
  color: rgba(255,255,255,.25);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: .75rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.6);
  font-size: .88rem;
  border-left: 2px solid transparent;
  transition: var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: #fff;
  border-left-color: #fff;
  background: rgba(255,255,255,.05);
}
.sidebar-nav a svg { flex-shrink: 0; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer a {
  color: rgba(255,255,255,.4);
  font-size: .82rem;
  display: flex; align-items: center; gap: .5rem;
  transition: var(--transition);
}
.sidebar-footer a:hover { color: #fff; }

.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  padding: .9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 {
  font-size: 1.1rem;
  font-weight: 600;
}
.topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--black);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.page-body {
  padding: 2rem;
  flex: 1;
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}
.card-body { padding: 1.5rem; }

/* Stats row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}
.stat-card .stat-label {
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-card.dark {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 1.1rem;
}
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid #D0D0D0;
  border-radius: var(--radius);
  background: #fafafa;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--black);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10,10,10,.07);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-text {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}
.field-error {
  font-size: .78rem;
  color: var(--error);
  margin-top: .25rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  white-space: nowrap;
}
.btn-primary {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}
.btn-primary:hover { background: #2a2a2a; border-color: #2a2a2a; }
.btn-outline {
  background: transparent;
  color: var(--black);
  border-color: #C0C0C0;
}
.btn-outline:hover { border-color: var(--black); background: #f5f5f5; }
.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: #f0c0c0;
}
.btn-danger:hover { background: #f8d0d0; }
.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #b0d8c0;
}
.btn-sm {
  padding: .35rem .8rem;
  font-size: .8rem;
}
.btn-lg {
  padding: .8rem 1.8rem;
  font-size: 1rem;
}
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: var(--success-bg); border-color: #a0d8b0; color: var(--success); }
.alert-error   { background: var(--error-bg);   border-color: #f0b0b0; color: var(--error); }
.alert-warn    { background: var(--warn-bg);     border-color: #e0d090; color: var(--warn); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  background: #f0f0f0;
  padding: .7rem 1rem;
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}
tbody td {
  padding: .8rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-active   { background: #e0f2e8; color: #1a7a3c; }
.badge-pending  { background: #fdf7e3; color: #6b5a00; }
.badge-approved { background: #e0f2e8; color: #1a7a3c; }
.badge-rejected { background: var(--error-bg); color: var(--error); }
.badge-suspended{ background: #f0e8e8; color: #7a1a1a; }
.badge-reviewed { background: #e0e8f8; color: #1a3a7a; }
.badge-inactive { background: #f0f0f0; color: #666; }

/* ============================================================
   DOCUMENT UPLOAD AREA
   ============================================================ */
.upload-zone {
  border: 2px dashed #C0C0C0;
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafafa;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--black);
  background: #f0f0f0;
}
.upload-zone input[type=file] { display: none; }
.upload-zone .upload-icon { margin: 0 auto .75rem; color: var(--muted); }
.upload-zone p { color: var(--muted); font-size: .88rem; }
.upload-zone strong { color: var(--text); }

/* Document list */
.doc-list { display: flex; flex-direction: column; gap: .6rem; }
.doc-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: var(--radius);
}
.doc-item .doc-icon {
  width: 36px; height: 36px;
  background: var(--black);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.doc-item .doc-info { flex: 1; min-width: 0; }
.doc-item .doc-name {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-item .doc-meta { font-size: .75rem; color: var(--muted); }
.doc-item .doc-actions { display: flex; gap: .5rem; }

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-header {
  background: var(--black);
  color: #fff;
  padding: 2rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
}
.profile-header::after {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 200px; height: 200px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 50%;
}
.profile-avatar {
  width: 72px; height: 72px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
}
.profile-header h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: .2rem;
}
.profile-header .profile-meta {
  color: rgba(255,255,255,.5);
  font-size: .85rem;
}

/* Share link box */
.share-link-box {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: .7rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.share-link-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .82rem;
  color: var(--muted);
  outline: none;
  min-width: 0;
}

/* ============================================================
   ADMIN DASHBOARD
   ============================================================ */
.audit-table tbody td { font-size: .82rem; }
.audit-table .action-col { font-weight: 600; }

/* ============================================================
   PUBLIC SHARE PAGE
   ============================================================ */
.share-page { max-width: 860px; margin: 0 auto; padding: 3rem 1.5rem; }
.share-page-header {
  background: var(--black);
  color: #fff;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.share-page-header .avatar {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
  flex-shrink: 0;
}
.share-page-header h1 { font-family: var(--font-display); font-size: 1.75rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .auth-brand { display: none; }
  .auth-form-wrap { padding: 2rem 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: .9rem 1rem; }
  .page-body { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-heavy);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none;
  cursor: pointer; color: var(--muted);
  font-size: 1.25rem; line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: .75rem;
}

/* Misc */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 1.5rem 0;
}
.text-muted   { color: var(--muted); }
.text-small   { font-size: .82rem; }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-1        { gap: .5rem; }
.gap-2        { gap: 1rem; }
.mb-1         { margin-bottom: .5rem; }
.mb-2         { margin-bottom: 1rem; }
.mb-3         { margin-bottom: 1.5rem; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.justify-between { justify-content: space-between; }
.w-full       { width: 100%; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
