* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: #0f172a; background: #f8fafc; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; width: 100%; }
.site-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { font-weight: 700; }
.nav a { margin-left: 16px; text-decoration: none; color: #1e293b; }
.site-footer { margin-top: auto; background: #ffffff; border-top: 1px solid #e2e8f0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; }
.admin .site-header { background: #B9D5C8; color: #0f172a; }
.admin .site-header a { color: #0f172a; }

/* Логотип сайта (в шапке) */
.site-logo {
  height: 40px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

@media (min-width: 1400px) {
  .site-logo { height: 40px; }
}
/* Если логотип встроен как SVG (inline), применяем правила к SVG внутри ссылки .logo */
.logo svg { height: 40px; width: auto; display: inline-block; vertical-align: middle; }
@media (min-width: 1400px) {
  .logo svg { height: 40px; }
}
/* Общие кнопки для сайта и админки */
.btn {
  display: inline-block;
  background: #2b6cb0;
  color: #fff;
  padding: 8px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 300;
  border: none;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  color: #2b6cb0;
  border: 1px solid rgba(43,108,176,0.12);
}
.actions { display:flex; gap:12px; align-items:center; }

/* Breadcrumbs styling */
.breadcrumbs { font-size: 13px; margin-bottom: 16px; color: #6b7280; }
.breadcrumbs a { color: #90A69C; text-decoration: underline; margin-right:8px; }
.breadcrumbs span { margin-right:8px; color:#cbd5e1; }
/* Admin layout enforcement to ensure sidebar is always visible and consistent */
.page.admin .container { padding-left:20px; padding-right:20px; }
.admin-shell { display:flex; gap:24px; align-items:flex-start; min-height:80vh; }
.admin-sidebar {
  flex: 0 0 260px !important;
  display: block !important;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(16,24,40,0.06);
}
.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(16,24,40,0.06);
}
.admin-sidebar .section-title { font-size:13px; color:#6b7280; margin-bottom:8px; }
.admin-sidebar a.item { display:block; padding:10px 12px; color:#1f2937; border-radius:8px; text-decoration:none; margin-bottom:6px; font-weight:600; }
.admin-sidebar a.item.active, .admin-sidebar a.item:hover { background:#B9D5C8; }

/* Make card widths consistent inside admin main */
.admin-main .card { width: 100%; }
/* Categories list row hover */
.categories-list li:hover { background: #B9D5C8; }
.categories-list .action-emoji { font-size:18px; line-height:1; display:inline-block; }
.categories-list .action-emoji:hover { transform: none; }
/* Course card excerpt: clamp to 5 lines */
.course-card .excerpt {
  color: #475569;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  max-height: calc(1.4em * 5);
  word-break: break-word;
}

/* Title: single line with ellipsis */
.course-card h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 8px 0;
  font-size: 18px;
  line-height: 1.2;
  color: #3F9A6F;
  font-weight: 600;
}

/* Button hover effect for course card: brighten + subtle vertical bob */
.course-card .actions .btn {
  transition: filter 180ms ease, transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
  will-change: transform, filter;
}

@keyframes bob {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

.course-card .actions .btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(16,24,40,0.08);
  animation: bob 0.8s ease-in-out infinite;
}

/* Reduce motion users: disable animation */
@media (prefers-reduced-motion: reduce) {
  .course-card .actions .btn:hover {
    animation: none;
    transition: filter 180ms ease, box-shadow 180ms ease;
  }
}

/* Ensure buttons keep consistent widths and wrap cleanly */
.course-card .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.course-card .actions .btn {
  /* fixed base width, single-line text with ellipsis if too long */
  flex: 0 0 140px;
  min-width: 120px;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;            /* force single line */
  overflow: hidden;              /* hide overflow */
  text-overflow: ellipsis;       /* show ellipsis when truncated */
  padding: 10px 12px;
  font-weight: 300;
  border-radius: 4px;
}
/* On very small screens make buttons full width (stacked) */
@media (max-width: 480px) {
  .course-card .actions .btn {
    flex: 1 1 100%;
  }
}

/* Ensure action buttons are pinned to the bottom of the card */
.course-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.course-card .body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.course-card .actions {
  margin-top: auto;
}
/* Ensure flex children can shrink correctly inside grid cells */
.courses-grid > li { min-height: 0; }
.courses-grid > li > .course-card,
.courses-grid > li > article {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.course-card, .course-card .body { min-height: 0; }
