/* ckanext-vigo — recolour CKAN's default theme to the Vigo palette.
 *
 * Almost every rule below does the same thing: swap CKAN's blue/teal accent
 * for Vigo red. It only looks long because CKAN applies that accent across
 * many separate components. All colours come from the variables in :root —
 * change them here and the whole portal follows.
 */

:root {
  --vigo-red:         #c14531;
  --vigo-red-dark:    #8f3224;
  --vigo-topbar-dark: #a02b23; /* franja superior — tono exacto del portal actual */
  --vigo-footer-text: #cccccc;
}

/* ── Page background ────────────────────────────────────────────────────── */
body {
  background-color: #ffffff !important;
}

.module-content {
  background-color: #ffffff !important;
  border: none !important;
  box-shadow: none !important;
}

/* ── Top bars: account masthead + main navbar ──────────────────────────── */
.account-masthead {
  background: var(--vigo-topbar-dark);
}

/* Header widened to ~1320px to match the production portal's centred bar.
 * Scoped to the two header rows only — the rest of CKAN keeps its 1200px. */
.masthead > .container,
.account-masthead > .container {
  max-width: 1320px;
}

.masthead,
.navbar {
  background: #dd3333 !important;
}

/* The masthead carries the drop shadow so it reads as one flat red bar.
 * Putting it on the inset `.navbar` instead drew a floating "box" inside
 * the wider masthead, since both share the same red. */
.masthead {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) !important;
}

.navbar {
  border-bottom: none !important;
  box-shadow: none !important;
}

/* ── Header sizing: match the production bar (~79px tall) ───────────────── */
/* CKAN stacks masthead + navbar vertical padding around a 60px-capped logo,
 * giving a 92px bar. Production is ~79px: the logo shows at its natural 66px
 * height, flush to the container's left edge, with minimal padding. */
.masthead {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.masthead .navbar {
  padding-top: 0.375rem !important;
  padding-bottom: 0.375rem !important;
}

.masthead > .container {
  padding-left: 0;
  padding-right: 0;
}

.masthead .logo img {
  max-height: 66px !important;
}

.navbar li.active > a,
.masthead .navigation .nav-pills li.active a,
.masthead .navigation .nav-pills li a:hover,
.navbar .nav-pills li.active > a,
.navbar .nav-pills li > a:hover,
.navbar li > a:hover {
  background-color: var(--vigo-red-dark) !important;
  color: #ffffff !important;
}

.navbar li.active > a {
  font-weight: 600;
}

/* Search button sitting inside the navbar */
.site-search .btn,
.navbar .btn {
  background-color: var(--vigo-red-dark) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
}

/* ── Links ─────────────────────────────────────────────────────────────── */
/* Content links are red; links inside coloured bars/buttons stay white.
 * The white rules below are more specific, so they win over plain `a`. */
a {
  color: var(--vigo-red) !important;
}

a:hover,
a:focus {
  color: var(--vigo-red-dark) !important;
}

.account-masthead a,
.navbar a,
.btn-primary,
.site-footer a {
  color: rgba(255, 255, 255, 0.85) !important;
}

.module-heading a {
  color: #222222 !important;
}

.account-masthead a:hover,
.navbar a:hover,
.site-footer a:hover {
  color: #ffffff !important;
}

.module-heading a:hover {
  color: #000000 !important;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background-color: var(--vigo-red) !important;
  border-color: var(--vigo-red) !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--vigo-red-dark) !important;
  border-color: var(--vigo-red-dark) !important;
}

/* ── Module headings (sidebar section titles) ──────────────────────────── */
.module-heading {
  background-color: #e8e8e8 !important;
  color: #222222 !important;
  border-top-color: #d0d0d0 !important;
  border-bottom-color: #d0d0d0 !important;
}

/* ── Dataset / group listing links ─────────────────────────────────────── */
.group-listing .media-heading a,
.group-list .media-heading a,
.dataset-heading a,
.dataset-item .heading a {
  color: #222222 !important;
}

.group-listing .media-heading a:hover,
.group-list .media-heading a:hover,
.dataset-heading a:hover,
.dataset-item .heading a:hover {
  color: #000000 !important;
}

/* ── Breadcrumb links ───────────────────────────────────────────────────── */
.breadcrumb a,
.breadcrumb li a {
  color: #444444 !important;
}

.breadcrumb a:hover,
.breadcrumb li a:hover {
  color: #222222 !important;
}

/* ── Tags ──────────────────────────────────────────────────────────────── */
.tag {
  background-color: var(--vigo-red) !important;
  border-color: var(--vigo-red) !important;
  color: #ffffff !important;
}

/* ── Resource format badges ─────────────────────────────────────────────── */
/* The `a { color: var(--vigo-red) }` rule would bleed onto these — force white. */
.badge[data-format] {
  color: #ffffff !important;
}

/* ── Sidebar facet / filter links ──────────────────────────────────────── */
.module-narrow .nav-facet a,
.module-narrow .nav-item > a,
.module-narrow .module-footer a {
  color: #444444 !important;
  font-size: 14px;
}

.module-narrow .nav-facet a:hover,
.module-narrow .nav-item > a:hover {
  color: #222222 !important;
}

/* ── Sidebar count badges: plain text, not grey pills ──────────────────── */
.item-count.badge {
  background: transparent !important;
  color: #888888 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  font-size: 0.85em !important;
  font-weight: normal !important;
  box-shadow: none !important;
}

/* ── Nav tabs (group/org page tabs) ────────────────────────────────────── */
.nav-tabs > li > a,
.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus {
  color: #444444 !important;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: #222222 !important;
}

/* Active sidebar / pill nav item */
.sidebar .nav-item.active > a,
.nav-pills .nav-link.active {
  background-color: var(--vigo-red) !important;
  color: #ffffff !important;
}

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination .page-link {
  color: var(--vigo-red) !important;
}

.pagination .page-item.active .page-link,
.pagination .active > a {
  background-color: var(--vigo-red) !important;
  border-color: var(--vigo-red) !important;
  color: #ffffff !important;
}

/* ── Homepage search box ───────────────────────────────────────────────── */
.homepage .module-search .search-form {
  background-color: var(--vigo-red) !important;
}

.homepage .module-search .tags {
  background-color: var(--vigo-red-dark) !important;
}

.homepage .module-feeds {
  background-color: #f0f0f0 !important;
  background-image: none !important;
}

/* ── Main navigation menu (replicated from datos.vigo.org) ─────────────── */
/* Uppercase tabs on the flat red bar, matching the production WordPress menu. */
.navbar .navbar-nav .nav-link {
  text-transform: uppercase;
  font-weight: 400;
  font-size: 14px;
  padding: 0.5rem 0.75rem;
  border-radius: 0;
}

/* No underline: production shows a subtle brightness change only. */
.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link:focus,
.navbar .navbar-nav .nav-item.show > .nav-link {
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.75) !important;
}

.navbar .navbar-nav .nav-link.active {
  color: #ffffff !important;
  background-color: transparent !important;
}

/* Dropdown items keep normal casing (they're long titles). */
.navbar .dropdown-menu .dropdown-item {
  text-transform: none;
}

/* Language selector: flag next to the label, like the production portal. */
.vigo-flag {
  display: inline-block;
  width: 20px;
  height: auto;
  vertical-align: -3px;
  margin-left: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.navbar .dropdown-menu .dropdown-item .vigo-flag {
  margin-left: 0;
  margin-right: 0.5rem;
}

/* Dropdown toggles sit in the red navbar: caret + spacing tweaks. */
.navbar .nav-item.dropdown .dropdown-toggle::after {
  vertical-align: middle;
}

.navbar .dropdown-menu {
  background-color: #ffffff !important;
  border: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 0.25rem 0;
  margin-top: 0;
}

.navbar .dropdown-menu .dropdown-item {
  background-color: transparent !important;
  color: #333333 !important;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  white-space: normal;
  max-width: 320px;
}

.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
  background-color: var(--vigo-red) !important;
  color: #ffffff !important;
}

/* Keep the active top-level tab legible on the red bar. */
.navbar .nav-link.active {
  font-weight: 400;
  color: #ffffff !important;
}

/* ── Dropdown menus ────────────────────────────────────────────────────── */
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background-color: var(--vigo-red) !important;
  color: #ffffff !important;
}

/* ── Form focus rings ──────────────────────────────────────────────────── */
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--vigo-red) !important;
  box-shadow: 0 0 0 0.2rem rgba(193, 69, 49, 0.25) !important; /* --vigo-red */
}

/* ── Misc ──────────────────────────────────────────────────────────────── */
.context-info {
  background-color: #f8f8f8 !important;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--vigo-red-dark);
  color: var(--vigo-footer-text) !important;
  border-top: 3px solid var(--vigo-red) !important;
}

.site-footer label,
.site-footer small,
.site-footer .small,
.site-footer .attribution p {
  color: var(--vigo-footer-text) !important;
}

/* ── Homepage: hero ─────────────────────────────────────────────────────── */
.vigo-hero {
  min-height: 420px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    var(--vigo-red) url('/vigo-hero.jpg') center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.vigo-hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
}

.vigo-hero-title {
  color: #ffffff;
  font-size: 2.4rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.vigo-hero-form {
  display: flex;
  width: 100%;
  max-width: 700px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.vigo-hero-input {
  flex: 1;
  padding: 0.85rem 1.1rem;
  font-size: 1.1rem;
  border: none;
  outline: none;
  color: #333;
}

.vigo-hero-input::placeholder {
  color: #999;
}

.vigo-hero-btn {
  padding: 0.85rem 1.2rem;
  background: var(--vigo-red-dark);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.vigo-hero-btn:hover,
.vigo-hero-btn:focus {
  background: #722819;
  outline: none;
}

/* ── Homepage: groups section ───────────────────────────────────────────── */
.vigo-home-body {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 3rem;
}

.vigo-groups-title {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  color: #222;
  margin-bottom: 0.75rem;
}

.vigo-groups-lead {
  text-align: center;
  color: #555;
  max-width: 820px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.vigo-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.vigo-group-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px solid #e4e4e4;
  border-radius: 6px;
  text-decoration: none !important;
  color: inherit;
  background: #fff;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.vigo-group-card:hover,
.vigo-group-card:focus {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  border-color: #ccc;
}

.vigo-group-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 0.75rem;
}

.vigo-group-name {
  color: var(--vigo-red) !important;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.vigo-group-desc {
  font-size: 0.82rem;
  color: #666;
  flex: 1;
  line-height: 1.4;
}

.vigo-group-count {
  font-size: 0.82rem;
  color: #444;
  margin-top: 0.6rem;
  font-weight: 500;
}
