/* SAJ Vrancea — site styles. Se încarcă după assets/css/tailwind.css. */

/* Smooth scroll for in-page anchors */
html { scroll-behavior: smooth; }

/* ─── Skip link (WCAG 2.4.1) ───
   Ascuns până primeşte focus din tastatură; permite navigarea peste bara de
   contact, logo şi meniul cu ~40 de link-uri direct la conţinut. */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100%;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: #0a2a52;
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 0.5rem 0.5rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #1c91ff;
  outline-offset: 2px;
}

/* Ancora de conţinut nu trebuie să ajungă sub headerul sticky */
#continut-principal { scroll-margin-top: 6rem; }

/* Focus vizibil consecvent pentru navigare din tastatură */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #1c91ff;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Heading rhythm in prose blocks */
.prose h2 { font-size: 1.25rem; font-weight: 700; color: #0a2a52; margin: 1.5rem 0 0.5rem; }
.prose h3 { font-size: 1.1rem; font-weight: 600; color: #15579e; margin: 1.25rem 0 0.4rem; }
.prose p  { margin: 0.5rem 0; line-height: 1.65; }
.prose a  { color: #1971cc; text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: #0f3d72; }
.prose ul { list-style: disc; padding-left: 1.25rem; margin: 0.5rem 0; }
.prose ol { list-style: decimal; padding-left: 1.25rem; margin: 0.5rem 0; }
.prose em { color: #0f3d72; font-style: italic; }
.prose strong { color: #0a2a52; }

/* Tailwind e compilat fără pluginul typography, deci clasa `not-prose` nu există
   în tailwind.css — o implementăm aici. Fără ea, regula `.prose ul` de mai sus
   punea buline şi pe grilele de carduri marcate explicit ca fiind în afara
   zonei de text (liste de documente, galerii). */
.not-prose ul,
.not-prose ol { list-style: none; padding-left: 0; margin: 0; }

/* Plasă de siguranţă: listele de documente nu au marcatori nici dacă ajung
   randate direct în `.prose`, fără wrapper. */
.prose .doc-list,
.prose .doc-group-grid { list-style: none; padding-left: 0; }

/* Document list */
.doc-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc-item { margin: 0; }
.doc-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  text-decoration: none;
  color: #0f172a;
  transition: all 0.15s ease;
}
.doc-link:hover {
  border-color: #1971cc;
  background: #f8fafc;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.doc-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.doc-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.doc-title {
  font-weight: 500;
  color: #15579e;
  word-break: break-word;
}
.doc-info {
  font-size: 0.8rem;
  color: #64748b;
}
.doc-arrow {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eff6ff;
  color: #1971cc;
  font-weight: 700;
  transition: all 0.15s ease;
}
.doc-link:hover .doc-arrow {
  background: #1971cc;
  color: #fff;
}
.doc-empty {
  padding: 1.5rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  color: #64748b;
  text-align: center;
  font-style: italic;
}

/* ── Document groups (concursuri, etc.) ── */
.doc-group {
  border: 1.5px solid #bfdbfe;
  border-radius: 0.625rem;
  background: #fff;
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.doc-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #e2e8f0;
}
.doc-group-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0f3d72;
  line-height: 1.35;
  letter-spacing: 0.005em;
}
.doc-group-date {
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  padding: 0.125rem 0.5rem;
  background: #f1f5f9;
  border-radius: 999px;
}
.doc-group-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.doc-tile { margin: 0; }
.doc-tile-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.875rem 0.875rem 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: all 0.15s ease;
}
.doc-tile-link:hover {
  border-color: #1971cc;
  box-shadow: 0 2px 6px rgba(15,61,114,0.08);
  transform: translateY(-1px);
}
.doc-tile-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}
.doc-tile-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  width: 100%;
}
.doc-tile-title {
  font-weight: 500;
  font-size: 0.9375rem;
  color: #15579e;
  line-height: 1.3;
  word-break: break-word;
}
.doc-tile-link:hover .doc-tile-title { color: #0f3d72; }
.doc-tile-download {
  font-size: 0.78rem;
  color: #1971cc;
  font-weight: 500;
}

/* Section divider for "Alte documente" inside a grouped page */
.doc-section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0a2a52;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e2e8f0;
}

/* ─── Shared docs card (e.g. Formular Înscriere on concursuri pages) ─── */
.shared-docs {
  display: grid;
  gap: 0.625rem;
  margin: 0.75rem 0 1.25rem;
}
.shared-doc-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  background: linear-gradient(to right, #eff6ff 0%, #fff 60%);
  border: 1.5px solid #bfdbfe;
  border-left: 4px solid #1971cc;
  border-radius: 0.5rem;
  text-decoration: none;
  color: #0f172a;
  transition: all 0.15s ease;
}
.shared-doc-card:hover {
  border-color: #1971cc;
  background: linear-gradient(to right, #dbeafe 0%, #f8fafc 70%);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15,61,114,0.1);
}
.shared-doc-icon { flex-shrink: 0; }
.shared-doc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.shared-doc-title {
  font-weight: 600;
  color: #15579e;
  font-size: 0.95rem;
}
.shared-doc-meta {
  font-size: 0.8rem;
  color: #1971cc;
}

/* ─── Page layout: main + sidebar grid ─── */
.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
  }
}
.page-main { min-width: 0; }

/* ─── Sidebar widgets — modern SVG cards ─── */
.sidebar-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  align-content: start;
}
@media (min-width: 1024px) {
  .sidebar-widgets {
    grid-template-columns: 1fr;
    gap: 0.625rem;
    position: sticky;
    top: 5.5rem;
  }
}

.sb-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.sb-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sb-tone, #1971cc);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sb-card:hover {
  border-color: var(--sb-tone, #1971cc);
  box-shadow: 0 6px 16px -4px rgba(15, 61, 114, 0.12);
  transform: translateY(-1px);
}
.sb-card:hover::before { opacity: 1; }

.sb-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--sb-tone-bg, #eff6ff);
  color: var(--sb-tone, #1971cc);
  transition: transform 0.18s ease;
}
.sb-card:hover .sb-icon { transform: scale(1.06); }
.sb-icon svg {
  width: 1.875rem;
  height: 1.875rem;
  display: block;
}

.sb-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}
.sb-title {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25;
  color: #0f3d72;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.sb-card:hover .sb-title { color: var(--sb-tone-dark, #0f3d72); }
.sb-tagline {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.3;
}
.sb-ext {
  width: 0.75rem;
  height: 0.75rem;
  color: #94a3b8;
  flex-shrink: 0;
}

/* ─── Tone palette ─── */
.sb-tone-red    { --sb-tone: #dc2626; --sb-tone-bg: #fee2e2; --sb-tone-dark: #991b1b; }
.sb-tone-amber  { --sb-tone: #d97706; --sb-tone-bg: #fef3c7; --sb-tone-dark: #92400e; }
.sb-tone-green  { --sb-tone: #059669; --sb-tone-bg: #d1fae5; --sb-tone-dark: #065f46; }
.sb-tone-violet { --sb-tone: #7c3aed; --sb-tone-bg: #ede9fe; --sb-tone-dark: #5b21b6; }
.sb-tone-blue   { --sb-tone: #1971cc; --sb-tone-bg: #dbeafe; --sb-tone-dark: #0f3d72; }

/* On mobile (2-column), make cards more compact */
@media (max-width: 1023px) {
  .sb-card { padding: 0.625rem; gap: 0.5rem; }
  .sb-icon { width: 2.25rem; height: 2.25rem; }
  .sb-icon svg { width: 1.5rem; height: 1.5rem; }
  .sb-title { font-size: 0.8125rem; }
  .sb-tagline { font-size: 0.6875rem; }
}

/* ─── Theme cards (homepage with photos) ─── */
.theme-card {
  display: block;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}
.theme-card:hover {
  border-color: #1971cc;
  box-shadow: 0 8px 20px rgba(15,61,114,0.1);
  transform: translateY(-3px);
}
.theme-card-img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f1f5f9;
}
.theme-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.theme-card:hover .theme-card-img img { transform: scale(1.04); }
.theme-card-body { padding: 1.125rem 1.25rem 1.25rem; }
.theme-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f3d72;
  margin-bottom: 0.25rem;
}
.theme-card-desc {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
}

/* ─── PNRR gallery ─── */
.pnrr-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.pnrr-gallery a {
  display: block;
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 1;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pnrr-gallery a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15,61,114,0.15);
}
.pnrr-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pnrr-gallery .pnrr-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.25rem 0.625rem 0.625rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  line-height: 1.2;
}

/* Admin */
.admin-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 0.5rem; }
.admin-table th { font-weight: 600; background: #f8fafc; }
.admin-table td, .admin-table th { padding: 0.625rem 0.75rem; text-align: left; border-bottom: 1px solid #f1f5f9; }
.admin-table tbody tr:hover { background: #f8fafc; }
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 0.875rem; border-radius: 0.375rem; font-weight: 500; font-size: 0.875rem; transition: all 0.15s; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: #1971cc; color: #fff; }
.btn-primary:hover { background: #15579e; }
.btn-secondary { background: #fff; color: #15579e; border-color: #cbd5e1; }
.btn-secondary:hover { border-color: #1971cc; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.form-input, .form-select { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 0.375rem; font-size: 0.95rem; }
.form-input:focus, .form-select:focus { outline: none; border-color: #1971cc; box-shadow: 0 0 0 3px rgba(25,113,204,0.15); }
.form-label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 0.375rem; color: #334155; }

/* Banner / hero */
.hero {
  background: linear-gradient(135deg, rgba(10,42,82,0.92) 0%, rgba(21,87,158,0.85) 50%, rgba(25,113,204,0.75) 100%),
              center/cover no-repeat url('/assets/img/hero.jpg');
  color: #fff;
}

/* Cards on homepage */
.card-link {
  display: block;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
}
.card-link:hover {
  border-color: #1971cc;
  box-shadow: 0 4px 12px rgba(15,61,114,0.08);
  transform: translateY(-2px);
}

/* Mobile nav specifics (so sticky header doesn't get too tall) */
@media (max-width: 1023px) {
  #main-nav { max-height: calc(100vh - 140px); overflow-y: auto; padding-bottom: 1rem; }
  #main-nav ul ul { background: #f8fafc; }

  /* Părintele cu submeniu: link în stânga, buton de extindere în dreapta. */
  #main-nav li.has-submenu {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  #main-nav li.has-submenu > ul { grid-column: 1 / -1; }

  /* Buton de extindere de 44×44 px — minimul recomandat de WCAG 2.5.5
     pentru ţinte de atingere. Înainte, zona activă era iconiţa de 14 px. */
  .submenu-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #15579e;
    background: transparent;
    border: 0;
    border-radius: 0.375rem;
    cursor: pointer;
  }
  .submenu-toggle:hover { background: #eff6ff; }
  .submenu-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.18s ease;
  }
  .submenu-toggle.is-open svg { transform: rotate(180deg); }
}

/* Desktop dropdown navigation — explicit hover (don't rely on Tailwind JIT) */
@media (min-width: 1024px) {
  /* First-level dropdown: hidden by default, visible on parent hover/focus */
  #main-nav > ul > li.group > ul {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 260px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
    padding: 0.375rem 0;
    z-index: 50;
    list-style: none;
    margin: 0;
  }
  #main-nav > ul > li.group:hover > ul,
  #main-nav > ul > li.group:focus-within > ul {
    display: block;
    animation: navDropFade 0.12s ease-out;
  }

  /* Second-level submenu (grandchildren) */
  #main-nav li ul li ul {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.12);
    padding: 0.375rem 0;
    list-style: none;
    margin: 0;
  }
  #main-nav li ul li:hover > ul,
  #main-nav li ul li:focus-within > ul {
    display: block;
  }

  /* Invisible bridge so cursor can travel from parent to dropdown without gap loss */
  #main-nav > ul > li.group > ul::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
  }

  /* Submenu link styling consistency */
  #main-nav li ul a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #334155;
    text-decoration: none;
    transition: background 0.1s ease, color 0.1s ease;
  }
  #main-nav li ul a:hover {
    background: #eff6ff;
    color: #15579e;
  }

  /* Caret rotation on hover */
  #main-nav > ul > li.group:hover > a > svg:last-child {
    transform: rotate(180deg);
    transition: transform 0.15s ease;
  }
  #main-nav > ul > li.group > a > svg:last-child {
    transition: transform 0.15s ease;
  }
}

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

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
