/* =========================================================
   PyPath Dashboard — Oceanic Precision Theme
   A refined scientific interface for ecosystem modeling
   ========================================================= */

/* --- Design Tokens --- */
:root {
  /* Ocean palette */
  --pp-navy: #0d1b2a;
  --pp-ocean: #1b3a5c;
  --pp-deep: #1e3a5f;
  --pp-marine: #2c5282;
  --pp-teal: #0ea5e9;
  --pp-teal-hover: #38bdf8;
  --pp-teal-dark: #0284c7;
  --pp-seafoam: #67e8f9;
  --pp-sand: #f59e0b;

  /* Surfaces */
  --pp-bg: #f1f5f9;
  --pp-card: #ffffff;
  --pp-border: #e2e8f0;
  --pp-border-light: #f1f5f9;

  /* Text */
  --pp-text: #0f172a;
  --pp-text-secondary: #475569;
  --pp-text-muted: #94a3b8;

  /* Feedback */
  --pp-success: #10b981;
  --pp-warning: #f59e0b;
  --pp-error: #ef4444;

  /* Shapes */
  --pp-radius: 10px;
  --pp-radius-lg: 14px;
  --pp-radius-pill: 50px;

  /* Shadows */
  --pp-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --pp-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --pp-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --pp-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --pp-shadow-teal: 0 4px 14px rgba(14, 165, 233, 0.25);

  /* Motion */
  --pp-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --pp-duration: 0.25s;
}

/* =========================================================
   BASE TYPOGRAPHY
   ========================================================= */

body {
  font-family: "Outfit", system-ui, -apple-system, sans-serif;
  background: var(--pp-bg);
  color: var(--pp-text);
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  color: var(--pp-navy);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h4, h5, h6 {
  font-family: "Outfit", system-ui, sans-serif;
  font-weight: 600;
  color: var(--pp-text);
}

a {
  color: var(--pp-teal-dark);
  transition: color var(--pp-duration) var(--pp-ease);
}

a:hover {
  color: var(--pp-teal);
}

/* =========================================================
   DARK SIDEBAR NAVIGATION
   ========================================================= */

.well {
  background: linear-gradient(180deg, var(--pp-navy) 0%, var(--pp-ocean) 100%);
  border: none;
  border-radius: var(--pp-radius-lg);
  padding: 1rem 0.65rem;
  box-shadow: var(--pp-shadow);
}

.nav-pills .nav-link {
  color: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 2px;
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--pp-duration) var(--pp-ease);
  border: 1px solid transparent;
}

.nav-pills .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.06);
}

.nav-pills .nav-link.active {
  background: var(--pp-teal);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--pp-shadow-teal);
  border-color: transparent;
}

.nav-pills .nav-link .bi {
  font-size: 0.95rem;
  opacity: 0.85;
  transition: opacity var(--pp-duration) var(--pp-ease);
}

.nav-pills .nav-link:hover .bi,
.nav-pills .nav-link.active .bi {
  opacity: 1;
}

/* Advanced dropdown header */
.nav-pills .dropdown-toggle {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.5rem 0.85rem;
  margin-top: 0.5rem;
}

.nav-pills .dropdown-toggle:hover {
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
}

/* Dropdown items */
.nav-pills .dropdown-menu {
  background: var(--pp-ocean);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.25rem;
  box-shadow: var(--pp-shadow-lg);
}

.nav-pills .dropdown-menu .dropdown-item {
  color: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 0.85rem;
}

.nav-pills .dropdown-menu .dropdown-item:hover,
.nav-pills .dropdown-menu .dropdown-item:focus {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Settings button */
.well .btn-link {
  color: rgba(255, 255, 255, 0.45) !important;
  text-decoration: none !important;
  font-size: 0.85rem;
  transition: color var(--pp-duration) var(--pp-ease);
  margin-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem !important;
}

.well .btn-link:hover {
  color: rgba(255, 255, 255, 0.85) !important;
  background: transparent !important;
}

/* =========================================================
   BRANDING HEADER
   ========================================================= */

.pypath-brand {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem 0.75rem;
}

.pypath-brand img {
  transition: transform 0.3s var(--pp-ease);
}

.pypath-brand:hover img {
  transform: scale(1.06) rotate(-2deg);
}

.pypath-brand .brand-name {
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--pp-navy);
  letter-spacing: -0.03em;
}

/* =========================================================
   HERO SECTION (Home page)
   ========================================================= */

.hero-section {
  background: linear-gradient(135deg, var(--pp-navy) 0%, var(--pp-ocean) 50%, var(--pp-deep) 100%);
  border-radius: var(--pp-radius-lg);
  padding: 3.25rem 2.75rem 3.75rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}

/* Underwater caustic light effect */
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 80% 20%, rgba(14, 165, 233, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 15% 80%, rgba(103, 232, 249, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 165, 233, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

/* Wave transition at bottom */
.hero-section::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 45px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80'%3E%3Cpath d='M0 40C200 75 400 5 600 40C800 75 1000 5 1200 40L1200 80 0 80Z' fill='%23f1f5f9'/%3E%3C/svg%3E") no-repeat bottom;
  background-size: 100% 100%;
  pointer-events: none;
}

.hero-tagline {
  font-family: "Outfit", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--pp-seafoam);
  margin-bottom: 0.6rem;
  position: relative;
}

.hero-title {
  font-family: "Lora", Georgia, serif !important;
  font-size: 2.6rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  line-height: 1.15 !important;
  margin-bottom: 1.1rem;
  position: relative;
}

.hero-description {
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.02rem;
  line-height: 1.75;
  max-width: 600px;
  margin-bottom: 1.75rem;
  position: relative;
}

.hero-actions {
  position: relative;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Hero primary button */
.btn-hero-primary {
  background: var(--pp-teal) !important;
  color: #fff !important;
  border: none !important;
  padding: 0.65rem 1.65rem !important;
  border-radius: var(--pp-radius-pill) !important;
  font-family: "Outfit", sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  transition: all 0.3s var(--pp-ease) !important;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.3) !important;
}

.btn-hero-primary:hover {
  background: var(--pp-teal-hover) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.35) !important;
}

/* Hero secondary button */
.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  padding: 0.65rem 1.65rem !important;
  border-radius: var(--pp-radius-pill) !important;
  font-family: "Outfit", sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.92rem !important;
  transition: all 0.3s var(--pp-ease) !important;
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: #fff !important;
  transform: translateY(-2px) !important;
}

/* =========================================================
   CARDS
   ========================================================= */

.card {
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow-xs);
  transition: all var(--pp-duration) var(--pp-ease);
  overflow: hidden;
  background: var(--pp-card);
}

.card:hover {
  box-shadow: var(--pp-shadow);
  transform: translateY(-3px);
  border-color: rgba(14, 165, 233, 0.15);
}

.card-header {
  background: var(--pp-card);
  border-bottom: 2px solid var(--pp-teal);
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--pp-navy);
  padding: 0.8rem 1.2rem;
}

.card-header .bi {
  color: var(--pp-teal);
  font-size: 1.05rem;
}

.card-header .badge {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3em 0.65em;
  border-radius: 4px;
}

.card-body {
  padding: 1.2rem;
}

.card-body ul {
  padding-left: 1rem;
  margin-bottom: 0.75rem;
}

.card-body li {
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
  color: var(--pp-text-secondary);
  line-height: 1.55;
}

.card-body li::marker {
  color: var(--pp-teal);
}

/* "What's New" card accent */
.card.border-success {
  border-color: var(--pp-teal) !important;
  border-width: 1px !important;
  border-left: 4px solid var(--pp-teal) !important;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.025) 0%, var(--pp-card) 100%);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  border-radius: 8px;
  transition: all var(--pp-duration) var(--pp-ease);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--pp-marine);
  border-color: var(--pp-marine);
}

.btn-primary:hover {
  background: var(--pp-navy);
  border-color: var(--pp-navy);
  transform: translateY(-1px);
  box-shadow: var(--pp-shadow-sm);
}

.btn-success {
  background: var(--pp-success);
  border-color: var(--pp-success);
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
  transform: translateY(-1px);
  box-shadow: var(--pp-shadow-sm);
}

.btn-info {
  background: var(--pp-teal);
  border-color: var(--pp-teal);
  color: #fff;
}

.btn-info:hover {
  background: var(--pp-teal-dark);
  border-color: var(--pp-teal-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #64748b;
  border-color: #64748b;
}

.btn-secondary:hover {
  background: var(--pp-text-secondary);
  border-color: var(--pp-text-secondary);
  transform: translateY(-1px);
}

.btn-outline-secondary {
  color: var(--pp-text-secondary);
  border-color: var(--pp-border);
}

.btn-outline-secondary:hover {
  background: var(--pp-bg);
  color: var(--pp-text);
  border-color: var(--pp-text-secondary);
}

/* =========================================================
   TABLES & DATA GRIDS
   ========================================================= */

.table {
  font-size: 0.88rem;
  font-family: "Outfit", sans-serif;
}

.table thead th {
  background: var(--pp-bg);
  border-bottom: 2px solid var(--pp-teal);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pp-text-secondary);
  padding: 0.6rem 0.75rem;
}

.table tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--pp-border-light);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(14, 165, 233, 0.04);
}

.dataTable {
  font-size: 0.85rem;
}

.shiny-data-grid {
  border-radius: var(--pp-radius);
  overflow: hidden;
  border: 1px solid var(--pp-border);
}

/* =========================================================
   FORM CONTROLS
   ========================================================= */

.form-control,
.form-select {
  font-family: "Outfit", sans-serif;
  border-radius: 8px;
  border-color: var(--pp-border);
  transition: all var(--pp-duration) var(--pp-ease);
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--pp-teal);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-label,
.control-label {
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--pp-text-secondary);
}

/* Slider accents */
.irs--shiny .irs-bar {
  background: var(--pp-teal);
  border-color: var(--pp-teal);
}

.irs--shiny .irs-handle {
  border-color: var(--pp-teal);
}

.irs--shiny .irs-from,
.irs--shiny .irs-to,
.irs--shiny .irs-single {
  background: var(--pp-navy);
}

/* =========================================================
   TABS (in-page, not sidebar)
   ========================================================= */

.navset-card-tab .nav-tabs {
  border-bottom: 2px solid var(--pp-border);
}

.navset-card-tab .nav-tabs .nav-link {
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  color: var(--pp-text-secondary);
  border: none;
  padding: 0.6rem 1rem;
  transition: all var(--pp-duration) var(--pp-ease);
}

.navset-card-tab .nav-tabs .nav-link:hover {
  color: var(--pp-teal);
}

.navset-card-tab .nav-tabs .nav-link.active {
  font-weight: 600;
  color: var(--pp-teal-dark);
  border: none;
  border-bottom: 3px solid var(--pp-teal);
  background: transparent;
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert {
  border-radius: var(--pp-radius);
  font-family: "Outfit", sans-serif;
  border-left-width: 4px;
}

.alert-info {
  background: rgba(14, 165, 233, 0.08);
  border-color: var(--pp-teal);
  color: var(--pp-ocean);
}

.alert-success {
  border-color: var(--pp-success);
}

.alert-warning {
  border-color: var(--pp-warning);
}

.alert-danger {
  border-color: var(--pp-error);
}

/* =========================================================
   IN-PAGE SIDEBAR
   ========================================================= */

.sidebar {
  background: var(--pp-bg);
  border-right: 1px solid var(--pp-border);
}

/* =========================================================
   CODE BLOCKS
   ========================================================= */

code {
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.82rem;
  background: var(--pp-bg);
  color: var(--pp-ocean);
  padding: 0.15em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--pp-border);
}

pre {
  background: var(--pp-navy);
  color: #e2e8f0;
  border-radius: var(--pp-radius);
  padding: 1rem 1.25rem;
}

pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
}

/* =========================================================
   VALUE BOXES
   ========================================================= */

.value-box {
  border-radius: var(--pp-radius);
  transition: all var(--pp-duration) var(--pp-ease);
  overflow: hidden;
}

.value-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--pp-shadow);
}

/* =========================================================
   FOOTER
   ========================================================= */

.pypath-footer {
  padding: 0.75rem 0 0.5rem;
}

.pypath-footer hr {
  border-color: var(--pp-border);
  opacity: 0.6;
}

.pypath-footer p {
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
  color: var(--pp-text-muted);
}

.pypath-footer a {
  color: var(--pp-teal-dark) !important;
  text-decoration: none !important;
  font-weight: 500;
}

.pypath-footer a:hover {
  color: var(--pp-teal) !important;
}

/* =========================================================
   LOADING STATE — Shimmer Progress Bar
   ========================================================= */

.shiny-busy::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--pp-teal),
    var(--pp-seafoam),
    var(--pp-teal)
  );
  background-size: 200% auto;
  animation: loading-shimmer 1.5s linear infinite;
  z-index: 9999;
}

@keyframes loading-shimmer {
  from {
    background-position: 200% center;
  }
  to {
    background-position: -200% center;
  }
}

/* =========================================================
   MODALS
   ========================================================= */

.modal-content {
  border-radius: var(--pp-radius-lg);
  border: none;
  box-shadow: var(--pp-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--pp-border);
}

.modal-header .modal-title {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  color: var(--pp-navy);
}

.modal-footer {
  border-top: 1px solid var(--pp-border);
}

/* =========================================================
   PLOTS
   ========================================================= */

.shiny-plot-output {
  border-radius: var(--pp-radius);
  overflow: hidden;
}

/* =========================================================
   TOOLTIPS
   ========================================================= */

.tooltip {
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
}

.tooltip-inner {
  background: var(--pp-navy);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
}

/* =========================================================
   BOOTSTRAP ICONS
   ========================================================= */

.bi {
  vertical-align: middle;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
  .hero-section {
    padding: 2rem 1.5rem 2.5rem;
  }

  .hero-title {
    font-size: 1.85rem !important;
  }

  .value-box,
  .card {
    margin-bottom: 1rem;
  }
}
