/* RuneForge Studio global styles */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap');

:root {
  --amber:     #2E86AB;
  --black:     #101113;
  --white:     #FFFFFF;
  --off-white: #F5F3EF;
  --grey-dark: #1E2025;
  --grey-mid:  #3A3D45;
  --grey-mute: #888888;
  --font:      'Rubik', sans-serif;
  --rule-w:    107px;
  --rule-h:    5px;
  --radius:    4px;
  --transition: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--white);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }

p { color: var(--off-white); }

a {
  color: var(--amber);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.8; text-decoration: underline; }

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: var(--grey-dark);
  border-radius: var(--radius);
}
code { padding: 0.15em 0.4em; }
pre  { padding: 1rem; overflow-x: auto; }

/* ── Brand elements ─────────────────────────────────────────────────────────── */

.accent-rule {
  width: var(--rule-w);
  height: var(--rule-h);
  background: var(--amber);
  border: none;
  margin: 1rem 0;
}

.eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

/* ── Layout helpers ─────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--grey-dark);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  border: 1px solid var(--grey-mid);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
}
.btn:hover { opacity: 0.85; }

.btn-primary {
  background: var(--amber);
  color: var(--black);
}

.btn-outline {
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
}

/* ── App shell layout ───────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 56px 1fr 40px;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content"
    "sidebar footer";
  min-height: 100vh;
}

.sidebar {
  grid-area: sidebar;
  background: var(--grey-dark);
  border-right: 1px solid var(--grey-mid);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--grey-mid);
}
.sidebar-brand .brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--white);
}
.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-top: 0.15rem;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  color: var(--off-white);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
  text-decoration: none;
  opacity: 1;
}
.nav-item.active {
  color: var(--amber);
  border-left-color: var(--amber);
  background: rgba(240,166,46,0.08);
  font-weight: 500;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--grey-mid);
  margin-top: auto;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-mute);
  margin-bottom: 0.35rem;
}

.sidebar-logout {
  width: 100%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.topbar {
  grid-area: topbar;
  background: var(--grey-dark);
  border-bottom: 1px solid var(--grey-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--grey-mute);
}
.breadcrumbs a { color: var(--grey-mute); font-weight: 400; }
.breadcrumbs a:hover { color: var(--white); opacity: 1; text-decoration: none; }
.breadcrumbs .sep { color: var(--grey-mid); user-select: none; }
.breadcrumbs .current { color: var(--off-white); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.content {
  grid-area: content;
  padding: 2rem;
  overflow-y: auto;
}

.footer {
  grid-area: footer;
  background: var(--grey-dark);
  border-top: 1px solid var(--grey-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  color: var(--grey-mute);
}
.footer .git-hash {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  opacity: 0.6;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  background: var(--grey-dark);
  border: 1px solid var(--grey-mid);
  border-radius: var(--radius);
  padding: 0;
  width: min(420px, 90vw);
  color: var(--white);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.modal::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem 2rem 1.5rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* ── Document table ─────────────────────────────────────────────────────────── */

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.doc-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mute);
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--grey-mid);
}

.doc-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--off-white);
  vertical-align: middle;
}

.doc-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

.doc-table a { color: var(--white); font-weight: 500; }
.doc-table a:hover { color: var(--amber); text-decoration: none; }

.doc-date, .doc-owner {
  font-size: 0.8rem;
  color: var(--grey-mute);
  white-space: nowrap;
}

.doc-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

.doc-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: var(--radius);
  color: var(--grey-mute);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.doc-action-btn:hover {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  opacity: 1;
  text-decoration: none;
}
.doc-action-edit:hover  { color: var(--amber); background: rgba(240,166,46,0.1); }
.doc-action-delete:hover { color: #eb5757; background: rgba(235,87,87,0.1); }

/* ── View toggle ──────────────────────────────────────────────────────────── */
.view-toggle {
  display: flex;
  border: 1px solid var(--grey-mid);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  padding: 0.38rem 0.6rem;
  background: none; border: none; cursor: pointer;
  color: var(--grey-mute);
  transition: background var(--transition), color var(--transition);
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--grey-mid); }
.view-toggle-btn.active { background: var(--amber); color: var(--black); }
.view-toggle-btn:not(.active):hover { background: rgba(255,255,255,0.06); color: var(--white); }

/* ── Document grid ────────────────────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.doc-card {
  background: var(--grey-dark);
  border: 1px solid var(--grey-mid);
  border-radius: var(--radius);
  padding: 1rem 1rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  transition: border-color var(--transition);
}
.doc-card:hover { border-color: var(--grey-mute); }
.doc-card-title {
  font-size: 0.9rem; font-weight: 600; color: var(--white);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-card-date { font-size: 0.75rem; color: var(--grey-mute); flex: 1; }
.doc-card-actions {
  display: flex; align-items: center; gap: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--grey-mid);
  margin-top: 0.25rem;
}

.doc-empty {
  margin-top: 2rem;
  color: var(--grey-mute);
  font-size: 0.9rem;
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey-mute);
  margin-bottom: 0.35rem;
}

input, select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--white);
  background: var(--grey-dark);
  border: 1px solid var(--grey-mid);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber);
}

/* ── Page centering ─────────────────────────────────────────────────────────── */

.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* ── Auth / Login ───────────────────────────────────────────────────────────── */

.login-box {
  width: 100%;
  max-width: 360px;
}

.form-field { margin-bottom: 1rem; }

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 1.25rem;
}

.btn-keycloak {
  background: #006bba;
  color: var(--white);
  margin-top: 0.75rem;
}

.alert {
  background: rgba(200,0,0,.12);
  border: 1px solid rgba(200,0,0,.35);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  color: #ff7070;
  margin-bottom: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  color: var(--grey-mute);
  font-size: 0.8rem;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-mid);
}

/* ── Role badge ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  background: rgba(240,166,46,.1);
  border: 1px solid rgba(240,166,46,.35);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Dashboard placeholder card ─────────────────────────────────────────────── */

.hero-card {
  text-align: center;
  min-width: 300px;
  max-width: 420px;
}
.hero-card h1 { margin-bottom: 0.35rem; }
.hero-card > p { margin-bottom: 1.25rem; }
.hero-card .meta {
  font-size: 0.85rem;
  color: var(--grey-mute);
  margin: 0.75rem 0 1.1rem;
}
.hero-card .meta strong { color: var(--off-white); }
