/* ============================================================
   admin.css — Panel administracyjny publikacje.moj-kosciol.pl
   Styl: klasyczny, liturgiczny, dostojny
   ============================================================ */

/* ─── Zmienne ─────────────────────────────────────────────── */
:root {
  --gold:          #C9A227;
  --gold-dark:     #8B6914;
  --gold-light:    #F5EDD0;
  --navy:          #1A1A2E;
  --navy-mid:      #2D2D44;
  --navy-light:    #3D3D56;
  --cream:         #FDFBF5;
  --cream-dark:    #F0EBD8;
  --text:          #2C2C2C;
  --text-mid:      #555;
  --text-light:    #888;
  --border:        #DDD5BE;
  --border-light:  #EDE8DB;
  --white:         #FFFFFF;
  --red:           #C0392B;
  --red-light:     #FDEDEC;
  --green:         #1A6B3C;
  --green-light:   #EAF6F0;
  --blue:          #1B4F8A;
  --blue-light:    #EBF2FA;
  --amber:         #B7770D;
  --amber-light:   #FEF9E7;

  --sidebar-w:     240px;
  --radius:        4px;
  --shadow:        0 2px 8px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.12);

  --font-main:     'EB Garamond', Georgia, serif;
  --font-ui:       'Crimson Pro', Georgia, serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;
}

/* ─── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(201,162,39,.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(201,162,39,.2);
}

.brand-cross {
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
}

.brand-name {
  color: var(--white);
  font-family: var(--font-main);
  font-size: 1.1rem;
  letter-spacing: .05em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 8px 0 4px;
}

.nav-label {
  display: block;
  font-size: .65rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 8px 20px 4px;
  font-family: var(--font-mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .95rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--white);
}

.nav-item.active {
  background: rgba(201,162,39,.12);
  color: var(--gold);
  border-left-color: var(--gold);
}

.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 1rem;
  opacity: .8;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(201,162,39,.15);
  background: rgba(0,0,0,.15);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  display: block;
  color: var(--white);
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  color: rgba(255,255,255,.4);
  font-size: .72rem;
  letter-spacing: .05em;
}

.logout-btn {
  color: rgba(255,255,255,.4);
  font-size: 1.1rem;
  text-decoration: none;
  padding: 4px;
  border-radius: var(--radius);
  transition: color .15s;
}

.logout-btn:hover { color: var(--gold); }

/* ─── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-inner {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 1300px;
}

/* ─── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border);
}

.page-title {
  font-family: var(--font-main);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-light);
  font-size: .9rem;
  margin-top: 4px;
}

/* ─── SECTION ─────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
}

.section-title {
  font-family: var(--font-main);
  font-size: 1.15rem;
  color: var(--navy);
  font-weight: 500;
}

.section-link {
  font-size: .85rem;
  color: var(--gold-dark);
  text-decoration: none;
}

.section-link:hover { text-decoration: underline; }

/* ─── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-section-title {
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--navy);
  font-weight: 500;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(to bottom, var(--cream) 0%, var(--white) 100%);
  letter-spacing: .02em;
}

/* ─── STATS GRID ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-number {
  font-family: var(--font-main);
  font-size: 2.4rem;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-dot {
  position: absolute;
  top: 0; right: 0;
  width: 4px;
  height: 100%;
}

.stat-dot.published { background: var(--green); }
.stat-dot.review    { background: var(--amber); }
.stat-dot.draft     { background: var(--text-light); }
.stat-dot.all       { background: var(--gold); }

/* ─── TABLES ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--cream);
  border-bottom: 2px solid var(--border);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-light);
  font-family: var(--font-mono);
  font-weight: 500;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--cream); }

.data-table tbody tr.row-inactive { opacity: .55; }

.doc-title { font-weight: 500; color: var(--navy); }
.doc-meta  { font-size: .78rem; color: var(--text-light); margin-top: 2px; }
.doc-number { font-family: var(--font-mono); font-size: .8rem; color: var(--text-light); }

.actions-cell { white-space: nowrap; text-align: right; }

/* ─── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .7rem;
  font-family: var(--font-mono);
  letter-spacing: .05em;
  font-weight: 500;
  text-transform: uppercase;
}

.badge-published { background: var(--green-light); color: var(--green); }
.badge-review    { background: var(--amber-light); color: var(--amber); }
.badge-archive   { background: var(--cream-dark);  color: var(--text-light); }
.badge-revoked   { background: var(--red-light);   color: var(--red); }
.badge-draft     { background: #F0F0F0;             color: #777; }

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-mid); border-color: var(--navy-mid); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--navy);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-warning {
  background: var(--amber-light);
  color: var(--amber);
  border-color: #F0C040;
}
.btn-warning:hover { background: #FEF3D0; }

.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border-color: #F5A9A0;
}
.btn-danger:hover { background: #FCDDD9; }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--cream-dark); }

.btn-block { width: 100%; justify-content: center; }
.btn-sm    { padding: 5px 12px; font-size: .82rem; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--text-mid);
  text-decoration: none;
  font-size: .9rem;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.btn-icon:hover { background: var(--navy); color: var(--gold); border-color: var(--navy); }

/* ─── FORMS ───────────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 5px;
  letter-spacing: .02em;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: normal;
}

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: .95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,.15);
}

.form-control-sm  { padding: 6px 10px; font-size: .85rem; height: 34px; }
.form-control-xs  { padding: 3px 8px;  font-size: .8rem;  height: 28px; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint {
  display: block;
  font-size: .78rem;
  color: var(--text-light);
  margin-top: 4px;
}

.form-hint a { color: var(--gold-dark); }

.form-control-file {
  font-size: .85rem;
  color: var(--text-mid);
}

.form-hint-box {
  background: var(--blue-light);
  border: 1px solid #BDD5F0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--blue);
  margin-bottom: 16px;
}

.required { color: var(--red); }

/* ─── FILTER BAR ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .form-control-sm {
  min-width: 140px;
  flex: 1;
}

/* ─── PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.page-btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-mid);
  text-decoration: none;
  font-size: .85rem;
  transition: background .1s;
}

.page-btn:hover { background: var(--cream-dark); }
.page-info { font-size: .85rem; color: var(--text-light); }

/* ─── DOC EDITOR LAYOUT ──────────────────────────────────── */
.doc-editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.doc-editor-main { display: flex; flex-direction: column; gap: 16px; }

.doc-editor-sidebar { display: flex; flex-direction: column; gap: 16px; }

.card .form-group:first-of-type { padding-top: 4px; }

/* Cards with internal padding */
.card > .form-group,
.card > .card-section-title + .form-group,
.card > .form-row {
  padding: 0 18px;
}

.card > .form-group:last-child { padding-bottom: 18px; }
.card > .card-section-title ~ .form-group { padding: 0 18px; }
.card > .card-section-title ~ .form-group:first-of-type { padding-top: 14px; }
.card > .card-section-title ~ .form-group:last-child { padding-bottom: 18px; }
.card > .card-section-title ~ .form-row { padding: 0 18px; }

/* Editor: treść główna z pełną szerokością */
.rich-editor {
  font-family: var(--font-main);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ─── ACTION CARD ────────────────────────────────────────── */
.action-card { border-top: 3px solid var(--gold); }

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
}

.status-info {
  padding: 8px 16px 14px;
  font-size: .78rem;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
}

/* ─── VERSIONS LIST ──────────────────────────────────────── */
.versions-list {
  padding: 6px 0;
}

.version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
}

.version-item:last-child { border-bottom: none; }

.version-num {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--gold-dark);
  background: var(--gold-light);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.version-meta { flex: 1; font-size: .8rem; color: var(--text-mid); }
.version-date { color: var(--text-light); font-size: .75rem; }

/* ─── EMBED CODE ─────────────────────────────────────────── */
.embed-hint { font-size: .82rem; color: var(--text-light); padding: 10px 16px 6px; }

.embed-code-block {
  margin: 8px 16px;
  padding: 12px;
  background: var(--navy);
  border-radius: var(--radius);
  overflow-x: auto;
}

.embed-code-block code {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: #D4AF37;
  white-space: pre;
  display: block;
}

.embed-modes { padding: 6px 16px 14px; font-size: .78rem; color: var(--text-light); }
.embed-modes code { font-family: var(--font-mono); background: var(--cream-dark); padding: 1px 5px; border-radius: 3px; }

/* ─── TWO-COL LAYOUT ─────────────────────────────────────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
}

/* ─── MISC ───────────────────────────────────────────────── */
.action-code {
  font-family: var(--font-mono);
  font-size: .75rem;
  background: var(--cream-dark);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--navy);
}

.role-tag {
  font-size: .82rem;
  color: var(--text-mid);
}

.invite-info {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: .9rem;
}

.invite-info p { margin-bottom: 4px; color: var(--text-mid); }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
  font-style: italic;
}

.empty-state a { color: var(--gold-dark); }

/* ─── FLASH MESSAGES ──────────────────────────────────────── */
.flash {
  padding: 11px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: .9rem;
  border-left: 4px solid;
}

.flash-success { background: var(--green-light); color: var(--green); border-color: var(--green); }
.flash-error   { background: var(--red-light);   color: var(--red);   border-color: var(--red); }
.flash-info    { background: var(--blue-light);  color: var(--blue);  border-color: var(--blue); }
.flash-warning { background: var(--amber-light); color: var(--amber); border-color: var(--amber); }

/* ─── PAGE ERROR ──────────────────────────────────────────── */
.page-error {
  text-align: center;
  padding: 80px 20px;
}

.error-icon {
  font-size: 3rem;
  color: var(--red);
  margin-bottom: 16px;
}

/* ─── AUTH PAGES ──────────────────────────────────────────── */
body.auth-page {
  background: linear-gradient(135deg, var(--navy) 0%, #0F0F1E 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-panel {
  background: var(--white);
  border-radius: 6px;
  padding: 36px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  border-top: 4px solid var(--gold);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-cross {
  font-size: 2.2rem;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-main);
  font-size: 1.4rem;
  color: var(--navy);
  font-weight: 500;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: .82rem;
  color: var(--text-light);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.auth-links {
  text-align: center;
  margin-top: 18px;
  font-size: .85rem;
}

.auth-links a { color: var(--gold-dark); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: .75rem;
  color: rgba(255,255,255,.25);
  letter-spacing: .05em;
}

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .doc-editor-layout { grid-template-columns: 1fr; }
  .doc-editor-sidebar { order: -1; }
  .two-col-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .main-inner { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .data-table { display: block; overflow-x: auto; }
}

/* ─── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ─── SELECTION ───────────────────────────────────────────── */
::selection { background: var(--gold-light); color: var(--navy); }

code { font-family: var(--font-mono); }

/* ─── BULK ACTION BAR ─────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--blue-light);
  border: 1px solid #BDD5F0;
  border-radius: var(--radius);
  animation: slideDown .15s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bulk-count {
  font-size: .85rem;
  font-weight: 600;
  color: var(--blue);
  margin-right: 6px;
}

.row-editing { background: var(--gold-light) !important; }

input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--navy);
}

/* ─── PODGLĄD DOKUMENTU ───────────────────────────────────── */
.doc-preview-btn {
  display: block;
  text-align: center;
  padding: 11px 14px;
  margin: 14px 16px 0;
  background: var(--gold-light);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  color: var(--gold-dark);
  font-weight: 600;
  text-decoration: none;
  font-size: .9rem;
  letter-spacing: .03em;
  transition: background .15s, border-color .15s;
}
.doc-preview-btn:hover {
  background: #eddfa0;
  border-color: var(--gold-dark);
}
