/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  --black: #545454;
  --grey: #a6a6a6;
  --white: #ffffff;
  --orange: #ff8b3d;
  --teal: #3caea3;
  --lightblue: #50b7e0;
  --medblue: #295fdb;
  --darkblue: #1b4b9d;
  --paleblue: #b6c7e6;
  --bg-grey: #f5f5f5;
}

/* ============================================
   BASE STYLES / TYPOGRAPHY
   ============================================ */

body {
  border-radius: 20px !important;
  font-family: 'Source Sans 3', Helvetica, Arial, Lucida, sans-serif;
  font-size: 1.2em;
}

h1, h2, h3 {
  font-family: 'Work Sans', Helvetica, Arial, Lucida, sans-serif;
}

/* ============================================
   LAYOUT
   ============================================ */

#app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app-root > :first-child {
  flex: 1 0 auto;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
  background: var(--grey);
  color: var(--white);
  border-color: var(--white);
}

.btn,
.nav-item .nav-link.active,
.nav-item .nav-link:hover {
  background-color: var(--darkblue);
  border-color: var(--darkblue);
  color: var(--white);
}

.btn,
.btn-outline-default,
.btn-default:not(.btn-primary,.btn-secondary,.btn-info,.btn-success,.btn-danger,.btn-warning,.btn-light,.btn-dark,.btn-link,[class*="btn-outline-"]) {
  --bs-btn-color: var(--darkblue);
  --bs-btn-border-color: var(--darkblue);
  --bs-btn-hover-color: var(--white);
  --bs-btn-hover-bg: var(--orange);
  --bs-btn-hover-border-color: var(--orange);
  --bs-btn-focus-shadow-rgb: 27, 75, 157;
  --bs-body-font-family: 'Source Sans 3', Helvetica, Arial, Lucida, sans-serif;
  --bs-btn-font-size: 1rem;
  --bs-btn-active-color: var(--white);
  --bs-btn-active-bg: var(--darkblue);
  --bs-btn-active-border-color: var(--darkblue);
  --bs-btn-active-shadow: inset 0 3px 5px rgba(84, 84, 84, 0.125);
  --bs-btn-disabled-color: var(--darkblue);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--darkblue);
  --bs-btn-bg: transparent;
  --bs-gradient: none;
  --bs-btn-border-radius: 8px;
}

/* ============================================
   NAVIGATION & SIDEBAR
   ============================================ */

.navbar-header {
  display: flex;
}

.nav-title {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--black);
  visibility: hidden;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 3em;
}

.page-json-ld-to-excel .nav-title,
.page-excel-to-json-ld .nav-title {
  visibility: visible;
}

/* Hamburger Menu */
#toggle-slot > * {
  position: relative !important;
  width: 40px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--bs-body-color);
  padding: 0;
  line-height: 1;
  font-size: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#toggle-slot > * svg,
#toggle-slot > * i {
  display: none !important;
}

#toggle-slot > *::before {
  content: '';
  position: absolute;
  left: 9px;
  right: 9px;
  top: 10px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 8px 0 0 currentColor, 0 16px 0 0 currentColor;
}

#toggle-slot > *:focus {
  outline: none;
}

#toggle-slot > *:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

/* Hide sidebar handle unless in header slot */
.bslib-sidebar-handle,
.sidebar .sidebar-toggle,
.sidebar .collapse-toggle {
  display: none !important;
}

#toggle-slot .bslib-sidebar-handle,
#toggle-slot .sidebar-toggle,
#toggle-slot .collapse-toggle {
  display: inline-flex !important;
}

/* Sidebar Layout */
.bslib-sidebar-layout > .sidebar {
  padding: var(--_padding);
  border-right: solid 2px var(--grey);
}

.bslib-sidebar-layout > .sidebar > .sidebar-content {
  padding: 0;
}

/* List Group / Menu Items */
.list-group {
  border-radius: 0;
}

.list-group-item {
  border: 0px none;
  border-bottom: 2px solid var(--grey);
  padding: var(--bs-list-group-item-padding-y) 0;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  background-color: transparent;
}

.list-group-item:hover {
  background: transparent;
  color: var(--darkblue);
  border-bottom-color: var(--darkblue);
  box-shadow: inset 0 -1px 0 var(--darkblue);
  padding: var(--bs-list-group-item-padding-y) 0;
}

.list-group-item.active {
  z-index: 2;
  color: var(--darkblue);
  font-weight: bold;
  background: transparent;
  border-bottom-color: var(--darkblue);
  box-shadow: inset 0 -1px 0 var(--darkblue);
}

/* ============================================
   LANGUAGE PICKER
   ============================================ */

.lang-container a {
  color: var(--black);
  font-weight: bold;
  text-decoration: underline;
}

.lang-container a:hover {
  font-weight: bold;
  color: var(--medblue);
  text-decoration: underline;
}

/* ============================================
   FORMS
   ============================================ */

/* Email Form Container */
.email-form-container .asterisk {
  color: #e74c3c;
  font-weight: bold;
}

.email-form-container .mc-field-group {
  margin-bottom: 15px;
}

.email-form-container .mc-field-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.email-form-container .form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.email-form-container .form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
  outline: 0;
}

.email-form-container .form-control::placeholder,
.email-form-container .form-control::-webkit-input-placeholder,
.email-form-container .form-control::-moz-placeholder,
.email-form-container .form-control:-ms-input-placeholder {
  color: #6c757d;
  opacity: 1;
}

.email-form-container .indicates-required {
  text-align: right;
}

/* File Input Customization */
.btn-file input[type="file"],
.input-group-btn input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

/* Shiny Input Containers */
.shiny-input-container:not(.shiny-input-container-inline) {
  width: 618px;
}

.select-data-container .shiny-input-container:not(.shiny-input-container-inline) {
  width: 100%;
}

/* ============================================
   ALERTS / MESSAGES
   ============================================ */

.alert {
  padding: 12px 18px;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 4px;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeaa7;
}

.alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

/* Error/Warning Display Container - Make scrollable */
[id*="error_warning_display"] {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
}

/* Ensure page can scroll when content overflows */
/* Override bslib fill container overflow restrictions */
body.bslib-page-fill.html-fill-container {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Main content area should allow scrolling */
.bslib-page-main.html-fill-container {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Main container should allow scrolling */
.main.html-fill-container {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Card body containing error display should allow scrolling */
.app-card .card-body {
  overflow: visible;
}

/* ============================================
   CARDS
   ============================================ */

.app-card {
  background-color: var(--bg-grey);
}

/* ============================================
   PANELS
   ============================================ */

.panel-header h1 {
  font-size: 2.5rem;
  color: var(--brand-darkblue);
  margin-bottom: 20px;
}

.panel-content {
  max-width: 960px;
  margin: auto;
}

/* ============================================
   HOME PAGE
   ============================================ */

.home-logo-container {
  display: grid;
  place-items: center;
  grid-template-areas: "stack";
  position: relative;
  width: fit-content;
}

.home-large-logo img {
  opacity: 0.3;
  max-width: 418px;
  max-height: 418px;
}

.home-large-logo,
.home-title-large {
  grid-area: stack;
}

.home-title-large {
  z-index: 1;
  text-align: center;
  width: 70%;
  padding: 1rem;
}

.home-title-large h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1em;
}

.btn-container {
  display: flex;
  gap: 20px;
}

.btn-container .btn-default {
  max-width: 240px;
}

.btn-container .download-button .btn-default {
  max-width: 400px;
}

.home-intro {
  background: var(--bg-grey);
  border-radius: 20px;
}

.home-intro-title {
  font-weight: bold;
}

.home-intro a {
  font-weight: bold;
  color: var(--darkblue);
}

.home-intro a:hover {
  color: var(--orange);
}

.home-intro div,
.home-intro li {
  margin-bottom: 1rem;
}

/* ============================================
   SELECT DATA STEP LAYOUT
   ============================================ */

.select-year,
.select-tabs {
  flex: 1;
  min-width: 0;
}

.select-data-container {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* ============================================
   MODAL
   ============================================ */

.modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  font-size: 90%;
  margin: auto;
}

.modal-header {
  padding-bottom: 0;
}

.modal-dialog .indicates-required {
  font-size: 0.85rem;
  color: #333;
}

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
  font-size: 90%;
  flex-shrink: 0;
  color: #ffffff;
  background: #676767;
  padding: 3rem 0 2rem 0;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-footer .container {
  max-width: 960px;
}

.app-footer .row {
  margin-bottom: 1.5rem;
}

/* Footer Typography */
.app-footer h6 {
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff !important;
  letter-spacing: 2px;
  line-height: 1.5em;
  font-size: 1rem;
  margin-bottom: 1rem;
  font-family: 'Work Sans', Helvetica, Arial, Lucida, sans-serif;
}

.app-footer .right-col h3 {
  font-weight: 700;
  color: #FFFFFF !important;
  font-size: 20px;
  line-height: 27px;
  padding-bottom: 20px;
}

.app-footer p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6em;
  margin-bottom: 0.75rem;
  font-family: 'Source Sans 3', Helvetica, Arial, Lucida, sans-serif;
}

.app-footer a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  transition: color 0.2s ease;
  font-family: 'Source Sans 3', Helvetica, Arial, Lucida, sans-serif;
  line-height: 1.6em;
}

.app-footer a.link {
  color: var(--orange);
}

.app-footer a.underline {
  text-decoration: underline;
}

.app-footer a:hover {
  color: #ffffff;
  text-decoration: none;
}

/* Footer Layout */
.app-footer .left-col {
  padding-left: 0;
  padding-right: 3.5rem;
  border-right: 1px solid rgba(166, 166, 166, 0.56);
}

.app-footer .right-col {
  padding-left: 3.5rem;
  padding-right: 0;
  font-size: 0.95rem;
}

/* Footer Newsletter Form */
.app-footer .newsletter-container {
  color: rgba(255, 255, 255, 0.9);
  background-color: rgb(226, 226, 226);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0;
}

.app-footer .newsletter-container,
.app-footer .newsletter-container p {
  color: #333;
}

.app-footer .email-form-container .indicates-required {
  font-size: 0.85rem;
  color: #333;
}

.app-footer .email-form-container .form-control {
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #333;
}

.app-footer .email-form-container .form-control:focus {
  background-color: #ffffff;
  border-color: var(--teal);
  box-shadow: 0 0 0 0.2rem rgba(60, 174, 163, 0.25);
}

.app-footer .email-form-container .btn-primary {
  background-color: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.app-footer .email-form-container .btn-primary:hover {
  background-color: var(--darkblue);
  border-color: var(--darkblue);
}

.app-footer .mc-field-description p,
.app-footer .mc-field-footer p {
  color: #333;
}

.app-footer .mc-field-title h3 {
  color: #333;
  font-size: 30px;
  font-weight: 800;
  padding-bottom: 20px;
}

/* Footer Social Links */
.app-footer .social-links {
  margin-bottom: 1rem;
}

.app-footer .social-links ul {
  text-align: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.app-footer .social-links .list-inline-item {
  margin-right: 6px;
}

.app-footer .social-links .list-inline-item:last-child {
  margin-right: 0;
}

.app-footer .social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  border-radius: 4px;
  transition: opacity 0.2s ease;
  color: #ffffff !important;
  line-height: 1;
  vertical-align: middle;
}

.app-footer .social-links a i {
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-footer .social-links a:hover {
  opacity: 0.8;
  text-decoration: none;
}

.app-footer .social-links a[href*="linkedin"] {
  background-color: #0077b5;
}

.app-footer .social-links a[href*="github"] {
  background-color: #333333;
}

.app-footer .social-links a[href*="youtube"] {
  background-color: #FF0000;
}

.app-footer .social-links a[href*="instagram"] {
  background-color: #E4405F;
}

/* Footer Newsletter Subscribe Button */
#newsletter-subscribe {
  clear: both;
  background-color: #666 !important;
  border: 0 none;
  border-radius: 4px;
  transition: all 0.23s ease-in-out 0s;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-block;
  font-size: 16px;
  font-weight: 700 !important;
  height: 32px;
  line-height: 32px;
  margin: 0 5px 10px 0;
  padding: 0 22px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
  vertical-align: top;
  white-space: nowrap;
  width: auto;
}

/* ============================================
   PAGE ROUTING CLASSES
   ============================================ */
/* Page-specific styles can be added here as needed */

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .btn-container {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .btn-container .btn-default {
    max-width: 280px;
    width: 100%;
  }

  .select-data-container {
    flex-direction: column;
    gap: 15px;
  }

  .select-year,
  .select-tabs {
    width: 100%;
  }

  .app-footer {
    padding: 2rem 0 1.5rem 0;
  }

  .app-footer .row > div {
    margin-bottom: 2rem;
  }

  .app-footer .row > div:last-child {
    margin-bottom: 0;
  }
}
