/* ─────────────────────────────────────────────
   Dotykačka Intranet – Brand CSS
   Primary: #31B24A  |  Black: #191919  |  BG: #F6F7FA
   Font: Montserrat (Google Fonts, closest to Gotham)
───────────────────────────────────────────── */

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

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

:root {
  --green:        #31B24A;
  --green-dark:   #27902E;
  --green-light:  #5FD367;
  --green-pale:   #e8f7ec;
  --black:        #191919;
  --gray-dark:    #2d2d2d;
  --gray:         #6b7280;
  --gray-light:   #d1d5db;
  --bg:           #F6F7FA;
  --white:        #ffffff;
  --sidebar-w:    260px;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --shadow-md:    0 4px 24px rgba(0,0,0,.12);
}

html { font-size: 15px; }
body {
  font-family: 'Montserrat', system-ui, sans-serif;
  background: var(--bg);
  color: var(--black);
  line-height: 1.6;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
img { max-width: 100%; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--white);
  display: block;
  line-height: 1;
}
.sidebar-logo .logo-text span { color: var(--green); }
.sidebar-logo .logo-sub {
  font-size: .65rem;
  font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-section {
  padding: 16px 20px 4px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--white);
}
.nav-item.active {
  background: rgba(49,178,74,.15);
  color: var(--green-light);
  border-left-color: var(--green);
}
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--white);
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-weight: 600;
  color: var(--white);
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .65rem;
  color: rgba(255,255,255,.4);
  text-transform: capitalize;
}
.btn-logout {
  width: 100%;
  padding: 7px 12px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.6);
  border: none;
  border-radius: 6px;
  font-size: .78rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.12); color: var(--white); }

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

.topbar {
  background: var(--white);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
}
.topbar-actions { display: flex; gap: 8px; }

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

/* ── FLASH MESSAGES ── */
.flash-container { margin-bottom: 20px; }
.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: var(--green-pale); color: var(--green-dark); border: 1px solid #c3e6cb; }
.flash-error   { background: #fde8e8; color: #c0392b; border: 1px solid #f5c6cb; }
.flash-info    { background: #e3f0ff; color: #1a56db; border: 1px solid #b8d4f5; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary   { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); color: var(--white); }
.btn-secondary { background: var(--bg); color: var(--gray-dark); border: 1px solid var(--gray-light); }
.btn-secondary:hover { background: #ebebeb; }
.btn-danger    { background: #fde8e8; color: #c0392b; }
.btn-danger:hover { background: #f8c6c6; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-icon { padding: 7px; border-radius: 6px; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray);
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -.5px;
}
.page-header p {
  color: var(--gray);
  font-size: .875rem;
  margin-top: 4px;
}

/* ── STATS ROW ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
}
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--black);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ── ARTICLE CARDS ── */
.article-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: box-shadow .2s, transform .2s;
  border-left: 4px solid transparent;
}
.article-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.article-card.pinned { border-left-color: var(--green); }
.article-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 6px;
  line-height: 1.3;
}
.article-card-title a { color: inherit; }
.article-card-title a:hover { color: var(--green); }
.article-card-meta {
  font-size: .75rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.article-card-excerpt {
  font-size: .85rem;
  color: var(--gray);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-green  { background: var(--green-pale); color: var(--green-dark); }
.badge-gray   { background: #f0f0f0; color: var(--gray); }
.badge-admin  { background: #fef3c7; color: #92400e; }
.badge-editor { background: #dbeafe; color: #1e40af; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--gray);
  background: var(--bg);
  border-bottom: 1px solid var(--gray-light);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-dark);
  margin-bottom: 6px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: .875rem;
  color: var(--black);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49,178,74,.15);
}
textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .75rem; color: var(--gray); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--green);
}
.checkbox-row label { margin: 0; font-weight: 500; cursor: pointer; }

/* ── FILE UPLOAD ── */
.upload-area {
  border: 2px dashed var(--gray-light);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--green);
  background: var(--green-pale);
}
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-text { font-size: .875rem; color: var(--gray); }
.upload-text strong { color: var(--green); }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 24px;
}
.page-link {
  padding: 7px 13px;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-dark);
  background: var(--white);
  border: 1px solid var(--gray-light);
  transition: all .15s;
}
.page-link:hover { background: var(--green-pale); border-color: var(--green); color: var(--green); }
.page-link.active { background: var(--green); color: var(--white); border-color: var(--green); }

/* ── WIKI ── */
.wiki-sidebar { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.wiki-nav { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.wiki-nav-category {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--green);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--green-pale);
}
.wiki-nav-category:first-child { margin-top: 0; }
.wiki-nav a {
  display: block;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: .84rem;
  color: var(--gray-dark);
  transition: background .12s;
}
.wiki-nav a:hover { background: var(--bg); color: var(--green); }

/* ── ARTICLE CONTENT ── */
.article-content { line-height: 1.75; }
.article-content h1, .article-content h2, .article-content h3 {
  font-weight: 700;
  color: var(--black);
  margin: 1.4em 0 .6em;
}
.article-content h1 { font-size: 1.5rem; }
.article-content h2 { font-size: 1.2rem; }
.article-content h3 { font-size: 1rem; }
.article-content p { margin-bottom: .85em; }
.article-content ul, .article-content ol { padding-left: 1.5em; margin-bottom: .85em; }
.article-content li { margin-bottom: .3em; }
.article-content strong { font-weight: 700; }
.article-content a { color: var(--green); text-decoration: underline; }
.article-content blockquote {
  border-left: 3px solid var(--green);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--green-pale);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}
.article-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85em;
  font-family: monospace;
}
.article-content pre {
  background: var(--black);
  color: #f3f4f6;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: .85em;
}

/* ── QUILL EDITOR ── */
.ql-toolbar { border-radius: 8px 8px 0 0 !important; border-color: var(--gray-light) !important; }
.ql-container { border-radius: 0 0 8px 8px !important; border-color: var(--gray-light) !important; min-height: 260px; font-family: inherit !important; font-size: .9rem !important; }
.ql-editor { min-height: 240px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--black);
}
.login-brand {
  flex: 1;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  border: 60px solid rgba(255,255,255,.1);
  top: -100px; right: -100px;
}
.login-brand::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  border: 40px solid rgba(255,255,255,.07);
  bottom: -80px; left: -80px;
}
.login-brand-inner { position: relative; z-index: 1; color: var(--white); text-align: center; }
.login-brand-logo { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; }
.login-brand-claim { font-size: .95rem; opacity: .85; font-weight: 500; }

.login-form-wrap {
  width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-box { width: 100%; }
.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 6px;
}
.login-sub { font-size: .875rem; color: rgba(255,255,255,.5); margin-bottom: 28px; }
.login-box label { color: rgba(255,255,255,.7); }
.login-box input[type="text"],
.login-box input[type="password"] {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.15);
  color: var(--white);
}
.login-box input::placeholder { color: rgba(255,255,255,.3); }
.login-box input:focus {
  border-color: var(--green);
  background: rgba(255,255,255,.1);
  box-shadow: 0 0 0 3px rgba(49,178,74,.25);
}
.login-remember { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.6); font-size: .82rem; }
.login-remember input { accent-color: var(--green); }

/* ── FILTERS ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-light);
  background: var(--white);
  color: var(--gray-dark);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.filter-btn:hover { border-color: var(--green); color: var(--green); }
.filter-btn.active { background: var(--green); color: var(--white); border-color: var(--green); }

/* ── RESPONSIVE ── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--black);
  padding: 4px;
}

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wiki-sidebar { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-wrap { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── UTILITIES ── */
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm  { font-size: .8rem; }
.text-gray { color: var(--gray); }
.text-green { color: var(--green); }
.font-bold { font-weight: 700; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }
