/* ===================================================
   Moris Slovakia – Portál aplikácií
   Vizuál zladený s Moris Evidencia / Incidenty
   =================================================== */

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

/* ── Variables ── */
:root {
  --moris-blue:       #111111;
  --moris-blue-hover: #000000;
  --moris-blue-light: #f3f4f6;
  --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;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  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: 22px;
  width: auto;
  fill: var(--moris-blue);
  flex-shrink: 0;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar 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;
}

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

/* ── Main content ── */
.home-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  flex: 1;
}

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

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

.home-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.home-header p {
  font-size: 14px;
  color: var(--text-light);
  margin: 0 auto;
  max-width: 440px;
}

/* ── Search ── */
.search-wrap {
  position: relative;
  max-width: 380px;
  margin: 0 auto 36px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.search-input::placeholder { color: var(--text-light); }

.search-input:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

/* ── Tile grid ── */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ── Tile card ── */
.tile {
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  background: var(--white);
  border: 1.5px solid #000;
  border-radius: var(--radius-lg);
  box-shadow: none;
  transition: box-shadow 0.2s, transform 0.15s;
  text-decoration: none !important;
}

.tile:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transform: translateY(-2px);
}


.tile h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.3;
}

.tile p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Tile – zablokovaná ── */
.tile-blocked {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  border-color: #aaa;
}


/* ── Empty state ── */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 80px 24px;
  color: var(--text-light);
  text-align: center;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  opacity: .5;
}

.empty-state p { margin: 0; font-size: 14px; }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 18px 24px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ── Buttons ── */
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  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;
  text-decoration: none !important;
}

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

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

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

.button.danger { background: var(--danger); }
.button.danger:hover { background: #dc2626; }

.button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

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

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

.login-card h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.login-card .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.login-card .form-group { text-align: left; margin-bottom: 14px; }

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

.login-card input {
  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;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-card input:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

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

.login-back-link {
  display: block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  text-decoration: none;
}

.login-back-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.login-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
  display: none;
  text-align: left;
}

/* ── Admin – UI ── */
.admin-container {
  max-width: 980px;
  margin: 32px auto;
  padding: 0 24px 40px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text);
}

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

/* ── Admin table ── */
.card-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th {
  background: #f8fafc;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-on      { background: var(--success-bg); color: #065f46; border: 1px solid var(--success-border); }
.badge-off     { background: var(--danger-bg);  color: #991b1b; border: 1px solid var(--danger-border); }
.badge-blocked { background: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }

.tile-icon-sm {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--moris-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.td-app {
  display: flex;
  align-items: center;
  gap: 12px;
}

.td-app-name  { font-weight: 600; font-size: 13px; }
.td-app-desc  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--text);
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

.form-group textarea { resize: vertical; min-height: 72px; }

.form-group 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: 34px;
  cursor: pointer;
}

.form-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ── Drag & drop ── */
.drag-handle {
  cursor: grab;
  color: var(--text-light);
  width: 36px;
  text-align: center;
  padding: 12px 8px;
  user-select: none;
}

.drag-handle:active { cursor: grabbing; }

tr.dragging { opacity: 0.35; }

tr.drag-over > td { border-top: 2px solid #111 !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .home-container { padding: 24px 16px 20px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topbar { padding: 0 12px; }
  .admin-container { padding: 0 16px 32px; margin-top: 24px; }
  .form-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
}
