/* ===================================================
   Moris Slovakia – Interný portál
   Dizajn zladený s Moris Evidencia (Inter + #0f325b)
   =================================================== */

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

/* ── Variables ── */
:root {
  --moris-blue:       #0f325b;
  --moris-blue-hover: #0a2341;
  --moris-blue-light: #e8eef5;
  --bg:               #f9fafb;
  --white:            #ffffff;
  --border:           #e5e7eb;
  --border-light:     #f3f4f6;
  --text:             #111827;
  --text-muted:       #6b7280;
  --text-light:       #9ca3af;
  --success:          #10b981;
  --success-bg:       #ecfdf5;
  --success-border:   #a7f3d0;
  --danger:           #ef4444;
  --danger-bg:        #fef2f2;
  --danger-border:    #fca5a5;
  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        16px;
  --shadow-sm:        0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-md:        0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:        0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--moris-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: var(--text); }
h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--text); }
p  { margin: 0 0 12px; color: var(--text-muted); line-height: 1.6; }

/* ── Topbar / Navigation ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px;
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--moris-blue);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  margin-right: 16px;
  padding: 6px 4px;
  text-decoration: none !important;
  flex-shrink: 0;
}

.topbar-wordmark {
  height: 24px;
  width: auto;
  fill: var(--moris-blue);
  flex-shrink: 0;
}

/* Desktop navigation container */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.topbar-nav a {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.topbar-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.topbar-logout {
  margin-left: auto !important;
  color: var(--danger) !important;
}

.topbar-logout:hover {
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
}

.topbar-login {
  margin-left: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  color: var(--moris-blue) !important;
  font-weight: 600 !important;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.topbar-login:hover {
  background: var(--moris-blue-light) !important;
  color: var(--moris-blue) !important;
}

/* Hamburger button – shown only on mobile */
.topbar-hamburger {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.topbar-hamburger:hover {
  background: var(--bg);
  color: var(--text);
}

/* Overlay – dims page when sidebar is open */
.topbar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 300;
}

.topbar-overlay.open { display: block; }

/* Sidebar drawer */
.topbar-sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: var(--white);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.26s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.topbar-sidebar.open { right: 0; }

.topbar-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-sidebar-logo .topbar-wordmark {
  height: 20px;
}

.topbar-sidebar-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.topbar-sidebar-close:hover {
  background: var(--bg);
  color: var(--text);
}

.topbar-sidebar-link {
  display: block;
  padding: 14px 20px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s, color 0.15s;
}

.topbar-sidebar-link:hover {
  background: var(--bg);
  color: var(--moris-blue);
}

.topbar-sidebar-logout {
  margin-top: auto;
  color: var(--danger) !important;
  border-top: 1px solid var(--border);
  border-bottom: none;
}

.topbar-sidebar-logout:hover {
  background: var(--danger-bg) !important;
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open { overflow: hidden; }

/* ── Page containers ── */
.container {
  max-width: 900px;
  margin: 28px auto;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.container.full-width { max-width: 1300px; }

.home-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

/* ── Homepage header ── */
.home-header {
  text-align: center;
  margin-bottom: 40px;
}

.home-header .moris-wordmark {
  display: block;
  width: auto;
  height: 52px;
  margin: 0 auto 20px;
  fill: var(--moris-blue);
}

.home-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.home-header p {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Tile grid ── */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.tile {
  display: block;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: none !important;
}

.tile:hover {
  box-shadow: var(--shadow-md);
  border-color: #d1d5db;
  transform: translateY(-2px);
}

.tile-icon {
  width: 44px;
  height: 44px;
  background: var(--moris-blue-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.tile-icon svg {
  width: 22px;
  height: 22px;
  color: var(--moris-blue);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.tile p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ── Buttons ── */
.button, button.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  background: var(--moris-blue);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.button:hover, button.button:hover {
  background: var(--moris-blue-hover);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
}

.button.secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
  background: var(--bg);
}

.btn-delete {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--danger);
  font-size: 0.875rem;
  font-family: inherit;
}

.btn-delete:hover {
  text-decoration: underline;
}

/* ── Forms ── */
.form-box {
  /* No extra box needed — container already provides the card */
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 0 0 16px;
}

legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--moris-blue);
  letter-spacing: 0.01em;
}

.form-group { margin: 12px 0; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.no-bold-labels label { font-weight: 400; color: var(--text-muted); }

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
  box-sizing: border-box;
}

/* Date / time inputs: keep native picker UI (no appearance:none!),
   share border/padding/font styles only */
input[type="date"],
input[type="time"] {
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--moris-blue);
  box-shadow: 0 0 0 3px rgba(15,50,91,.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f325b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* Datetime row – two fields side by side */
.datetime-row { margin-bottom: 0; }
.datetime-row .form-group { flex: 1; min-width: 140px; }

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

input[type="radio"] { width: auto; margin-right: 6px; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-row .form-group { flex: 1; min-width: 160px; }

/* ── Alerts ── */
.alert {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.alert.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.alert.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
}

/* ── Detail box (incident/suggestion detail view) ── */
.detail-box {
  margin: 16px 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-box p {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  margin: 0;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}

.detail-box p:last-child { border-bottom: none; }
.detail-box p:nth-child(even) { background: #fafbfc; }

.detail-box p strong {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  align-self: start;
}

/* ── Tables ── */
.table-responsive {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  background: var(--white);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}

/* Truncated text cells — long content shown on hover via title */
td.cell-truncate {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

tr:nth-child(even) td { background: #fafbfc; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #eef2ff !important; }

/* ── Options list (settings) ── */
.options-list .option-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.option-input { flex: 1; }

.delete-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s;
}

.delete-btn:hover { background: #fee2e2; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-page .container {
  max-width: 420px;
  margin: 0;
  padding: 36px 32px;
  text-align: center;
}

.login-page .login-logo {
  display: block;
  margin: 0 auto 24px;
}

.login-page .login-logo svg {
  height: 40px;
  width: auto;
  fill: var(--moris-blue);
  display: block;
  margin: 0 auto;
}

.login-page h1 {
  font-size: 22px;
  margin-bottom: 6px;
}

.login-page .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-page .form-group { text-align: left; }

.login-page .button {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  margin-top: 8px;
}

.login-page .form-actions {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.login-page a {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Page header row ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header h1 { margin: 0; }

/* ── Responsive ── */

/* Tablet / large mobile: switch to hamburger menu */
@media (max-width: 860px) {
  .topbar-nav { display: none; }
  .topbar-hamburger { display: flex; }
  .topbar { padding: 0 14px; }
}

/* Small mobile */
@media (max-width: 640px) {
  .container { margin: 12px; padding: 16px; }
  .container.full-width { margin: 12px; }
  .home-container { padding: 24px 16px 16px; }
  .tiles { grid-template-columns: 1fr; }

  /* Date / time inputs: full width, no overflow */
  input[type="date"],
  input[type="time"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Stack all form rows vertically */
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group,
  .datetime-row .form-group { min-width: 0; width: 100%; }

  .form-actions { flex-direction: column-reverse; }
  .button { width: 100%; justify-content: center; }

  /* Admin filter row: stack nicely */
  .form-row > .button,
  .form-row > button { width: 100%; margin-top: 4px; }

  /* Detail box: single column on mobile (label above value) */
  .detail-box p {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 10px 14px;
  }

  .detail-box p strong {
    font-size: 11px;
  }

  /* Tables scroll horizontally on mobile */
  .table-responsive { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: none; border-right: none; }
}
