/**
 * Main Stylesheet
 *
 * Custom styles for the Starter Kit PHP routing framework
 * This file supplements Bootstrap 5 with additional styling.
 */

/* ============================================================================
 * ROOT VARIABLES & TYPOGRAPHY
 * ============================================================================ */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-muted: #6b7280;
    --transition-speed: 0.3s;
}

/* ============================================================================
 * UNITY FRAMEWORK OVERRIDES
 * Unity main.css zeros out border-radius on most Bootstrap components and
 * overrides spacing/color defaults. These restore sensible Bootstrap styling.
 * ============================================================================ */

/* Restore border-radius on common components (Unity sets all to 0) */
.accordion-item {
  border-radius: 0.5rem !important;
  overflow: hidden;
}

.accordion-button {
  border-radius: 0 !important;
}

.accordion-item:first-of-type .accordion-button {
  border-top-left-radius: 0.5rem !important;
  border-top-right-radius: 0.5rem !important;
}

.accordion-item:last-of-type .accordion-button.collapsed {
  border-bottom-left-radius: 0.5rem !important;
  border-bottom-right-radius: 0.5rem !important;
}

.badge {
  /*border-radius: 0.35rem !important;*/
}

.badge.rounded-pill {
  border-radius: 50rem !important;
}

.card {
  border-radius: 0.5rem !important;
}

.card-header:first-child {
  border-top-left-radius: calc(0.5rem - 1px) !important;
  border-top-right-radius: calc(0.5rem - 1px) !important;
}

/* Restore padding for dismissible alerts (Unity zeros it out) */
.alert-dismissible {
  padding-right: 3rem;
}

/* Inline code: Unity makes ALL code elements block-level with full-width padding
   and NCAR adds a blue border. Reset inline <code> to standard inline styling. */
code {
  display: inline;
  min-width: 0;
  padding: 0.125rem 0.35rem;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 0.25rem;
  font-size: 0.875em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Code blocks inside <pre>: restore block behavior with constrained width */
pre {
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 1rem;
  overflow: auto;
}

pre code {
  display: block;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 0.825rem;
  white-space: pre;
  overflow-wrap: normal;
  word-wrap: normal;
}

/* API docs: constrain long endpoint URLs in flex rows */
.api-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* API docs: keep accordion body tables from overflowing */
.accordion-body {
  overflow-x: auto;
}

/* Custom styles for ozone garden website */
a.link-none {
  text-decoration: none !important;
}

/* main page styles */
.card-header .accordion-toggle::after {
	font-family: 'Font Awesome 5 Free';
	content: "\f068";
	float: right;
	color: #ccc;
}

.card-header .accordion-toggle.collapsed::after {
	content: "\f067";
}

.navbar-toggler {
	margin-bottom: 0px;
}


/* unity overrides styles */
.table-sm > :not(caption) > * > * {
    padding: 0.25rem !important;
    vertical-align: middle !important;
}

.table-borderless > :not(caption) > * > * {
  border: 0 !important;
}
.table-borderless > :not(:first-child) {
  border: 0 !important;
}

/* training page styles */
.incorrect {
    text-align: center;
    align-content: center;
}

.correct {
    text-align: center;
    align-content:center;
}

.nextButton {
    margin-top: 5px;
}

#displayed_leaf {
    display:block;
    margin-left: auto;
    margin-right:auto;
    width:50%;
}

.navbar-toggler {
    margin-bottom: 0px;
}

/* phone sized screen styles */
@media (max-width:575px) {
    #displayed_leaf {
        width: 100%;
    }
}

.smaller {
  font-size: 0.7rem !important;
}


/* image gallery styles */
.margin_above {
  margin-top:30px;
}

.image_row {
  overflow: hidden;
  height: 150px;
  margin-bottom: 30px;
}

#bulk-form{
    display: none;
}
#bulk-disclaimer{
    display: none; 
}
#info-err{
    display: none;
}
/* work around to prevent dropdown menu from displaying twice */
span.form-control {
    display: none;
}

@media (max-width:767px){
    #table-form, #table-disclaimer, #bulk-form, #bulk-disclaimer {
        display: none;
    }
    #bulkTag{
        display: none;
    }
}

@media (min-width: 768px){
    #mobile-form{
        display: none;
    }
}

.carousel-control-prev-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
}

.carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}


/* data visual styles */
#mainDrop {
    width: 70%;
    text-align: left;
    font-size: 24px;
    line-height: 28px;
    position: relative;
    padding-bottom: 2px;
    color: #bfd600;
    font-weight: 700;
    background: #454648;
}

#mainDropMenuItems {
    width: 70%;
    font-size: 24px;
    line-height: 28px;
    position: relative;
    padding-bottom: 2px;
    color: #bfd600;
    font-weight: 700;
    background: #454648;
}
#bar-div {
    width: 100%;
}
.green {
    color: #bfd600 !important;
}

/* ===== MODERN FORM COMPONENTS ===== */

/* Sticky Top Progress Bar */
.scroll-progress-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
  padding: 1rem 1.5rem;
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;

}

.scroll-progress-items {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.scroll-progress-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 0;
  min-width: 0;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 2rem;
  background: transparent;
  border: 2px solid transparent;
  position: relative;
}

.scroll-progress-item:hover {
  background: rgba(25, 135, 84, 0.05);
}

.scroll-progress-item.active {
  background: rgba(25, 135, 84, 0.1);
  border-color: rgba(25, 135, 84, 0.3);
}

.scroll-progress-item.completed {
  opacity: 0.8;
}

.scroll-progress-dot {
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 50%;
  background: #dee2e6;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-progress-item.active .scroll-progress-dot {
  /*background: linear-gradient(135deg, #198754, #20c997);*/
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.2);
  width: 16px;
  height: 16px;
}

.scroll-progress-item.completed .scroll-progress-dot {
  background: #198754;
}

.scroll-progress-item.completed .scroll-progress-dot::after {
  content: "✓";
  color: white;
  font-size: 9px;
  font-weight: bold;
}

.scroll-progress-label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  overflow: hidden;
}

.scroll-progress-label .title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #212529;
  white-space: nowrap;
}

.scroll-progress-label .subtitle {
  font-size: 0.7rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scroll-progress-item.active .scroll-progress-label .title {
  color: #198754;
}

.scroll-progress-item.completed:not(:last-child)::after {
  background: #198754;
}

/* Icon shown only on mobile (replaces text labels) */
.scroll-progress-icon {
  display: none;
}

/* Modern Card Component */
.modern-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid rgba(255,255,255,0.5);
  transition: box-shadow 0.3s ease;
  scroll-margin-top: 2rem;
}

.modern-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.modern-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0px;
}

.modern-card .text-muted {
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Form Section Container */
.form-section {
  display: block;
  opacity: 1;
  scroll-margin-top: 2rem;
}

.form-section:last-child {
  margin-bottom: 0;
}

/* Damage Index Button */
.damage-btn {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.damage-btn:hover {
  transform: scale(1.05);
  border-color: #20c997;
  box-shadow: 0 4px 16px rgba(32, 201, 151, 0.2);
}

.damage-btn.selected {
  background: linear-gradient(135deg, #198754, #20c997);
  border-color: #198754;
  color: white;
  transform: scale(1.08);
}

.damage-btn.selected::after {
  content: "✓";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: white;
  color: #198754;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.damage-btn img {
  width: 100%;
  max-width: 80px;
  height: auto;
  border-radius: 0.5rem;
}

.damage-btn .damage-label {
  font-weight: 600;
  font-size: 0.875rem;
}

.damage-btn .damage-percent {
  font-size: 0.75rem;
  opacity: 0.7;
}

.damage-btn.selected .damage-percent {
  opacity: 1;
}

/* Plant Selector Card */
.plant-card {
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  background: white;
}

.plant-card:hover {
  border-color: #0dcaf0;
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(13, 202, 240, 0.2);
}

.plant-card.selected {
  border-color: #198754;
  box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.2);
}

.plant-card.selected::after {
  content: "✓";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #198754;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.25rem;
}

.plant-card img {
  width: 100%;
  height: auto;
  display: block;
}

.plant-card .plant-name {
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  background: #f8f9fa;
}

.plant-card.selected .plant-name {
  background: #198754;
  color: white;
}

/* Bottom Action Bar (Mobile) */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 1rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  display: flex;
  gap: 0.75rem;
  z-index: 1000;
}

.bottom-action-bar .btn {
  flex: 1;
  padding: 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  min-height: 56px;
}

.bottom-action-bar .btn-skip {
  flex: 0.5;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  color: #6c757d;
}

/* Progress Bar */
.leaf-progress {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.leaf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #198754, #20c997);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Auto-save Indicator */
.auto-save-indicator {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(25, 135, 84, 0.9);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
  z-index: 1001;
}

.auto-save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* Damage Reference Panel */
.damage-reference {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}

.damage-reference-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-weight: 600;
}

.damage-reference-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.damage-reference-item {
  text-align: center;
}

.damage-reference-item img {
  width: 100%;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.damage-reference-item .label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.damage-reference-item .percent {
  font-size: 0.625rem;
  color: #6c757d;
}

/* Leaf Counter Badge */
.leaf-counter {
  background: linear-gradient(135deg, #198754, #20c997);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  display: inline-block;
  font-weight: 600;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
}

/* Leaf Navigation Buttons */
.leaf-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #198754;
  font-size: 1rem;
}

.leaf-nav-btn:hover:not(:disabled) {
  background: #198754;
  border-color: #198754;
  color: white;
}

.leaf-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Leaf History Strip */
.leaf-history {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.leaf-history-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c757d;
  transition: all 0.2s ease;
  position: relative;
}

.leaf-history-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: white;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.leaf-history-dot:hover {
  border-color: #20c997;
  transform: scale(1.1);
}

.leaf-history-dot.active {
  border-color: #198754;
  background: white;
  color: #198754;
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.2);
}

.leaf-history-dot.recorded {
  background: #198754;
  border-color: #198754;
  color: white;
}

.leaf-history-dot.recorded.active {
  background: #198754;
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.3);
}

/* Damage Grid Layout */
.damage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0px;
}

/* Bulk Entry Stepper */
.bulk-stepper {
  display: flex;
  align-items: stretch;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
  border: none;
}

.bulk-stepper-btn {
  background: #dee2e6;
  border: none;
  border-radius: 0 !important;
  padding: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: #212529;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-stepper-btn:hover {
  background: #198754;
  color: white;
}

.bulk-stepper-btn:active {
  background: #157347;
  color: white;
}

.bulk-stepper-value {
  flex: 1;
  text-align: center;
  font-size: .96rem;
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  min-width: 40px;
  border: none;
  border-top: 2px solid #dee2e6;
  border-bottom: 2px solid #dee2e6;
  border-radius: 0;
  background: #fff;
  color: #212529;
  appearance: textfield;
  -moz-appearance: textfield;
  -webkit-appearance: textfield;
}

.bulk-stepper-value:focus {
  outline: none;
  border-color: #198754;
  box-shadow: none;
}

.bulk-stepper-value::-webkit-outer-spin-button,
.bulk-stepper-value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Bulk Group Rows */
.bulk-group-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.bulk-group-row:last-child {
  border-bottom: none;
}

.bulk-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bulk-group-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.bulk-row-subtotal {
  text-align: right;
}

/* Mode Toggle */
.mode-toggle {
  display: inline-flex;
  padding: 0px;
  margin-bottom: 0px;
}

.mode-toggle-btn {
  padding: 0.5rem 1.5rem;
  border: none;
  background: transparent;
  border-radius: 1.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  color: #6c757d;
}

.mode-toggle-btn.active {
  background: white;
  color: #198754;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Slide animations */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.shake {
  animation: shake 0.4s ease;
}

/* Mobile optimizations */
@media (max-width: 767px) {
  .modern-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
  }

  .damage-btn {
    padding: 0.75rem;
  }

  .damage-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .damage-reference-body {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .bottom-action-bar {
    padding: 0.75rem;
  }

  .plant-card {
    margin-bottom: 0.75rem;
  }

  /* Compact progress bar on mobile */
  .scroll-progress-nav {
    padding: 0.75rem 1rem;
    margin: 0rem -1rem 1.5rem -1rem;
  }

  .scroll-progress-item {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .scroll-progress-label .subtitle {
    display: none;
  }

  .scroll-progress-item:not(:last-child)::after {
    display: none;
  }

  .leaf-history-dot {
    width: 28px;
    height: 28px;
    font-size: 0.625rem;
  }

  .leaf-history-badge {
    width: 14px;
    height: 14px;
    font-size: 0.5rem;
    top: -5px;
    right: -5px;
  }

  .scroll-progress-item {
    padding: 0.5rem 0.25rem;
    justify-content: center;
  }

  .scroll-progress-dot,
  .scroll-progress-label {
    display: none;
  }

  .scroll-progress-icon {
    display: inline-flex;
    font-size: 1.15rem;
    color: #6c757d;
    transition: color 0.3s ease, transform 0.3s ease;
  }

  .scroll-progress-item.active .scroll-progress-icon {
    color: #198754;
    transform: scale(1.15);
  }

  .scroll-progress-item.completed .scroll-progress-icon {
    color: #198754;
  }

  #mapid {
    height: 200px !important;
  }

  .damage-reference {
    padding: 0.875rem;
    margin-bottom: 0.75rem;
  }

  .damage-reference-body {
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
  .damage-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .bottom-action-bar {
    position: relative;
    box-shadow: none;
    border-top: 1px solid #dee2e6;
    margin-top: 2rem;
  }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
  .damage-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .damage-reference-body {
    grid-template-columns: repeat(6, 1fr);
  }

  .bottom-action-bar {
    position: relative;
    box-shadow: none;
    border-top: 1px solid #dee2e6;
    margin-top: 2rem;
  }
}

/* Accessibility improvements */
.damage-btn:focus,
.plant-card:focus,
.bulk-stepper-btn:focus {
  outline: 3px solid #0dcaf0;
  outline-offset: 2px;
}

/* Loading state */
.loading-skeleton {
  background: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
