@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  /* Conservice Brand Colors */
  --c-green: #77bc1f;
  --c-dark-green: #4f9400;
  --c-blue: #2b7bb9;
  --c-slate: #243746;
  --c-slate-light: #435b6f;

  /* Material 3 Mapped to Conservice */
  --md-sys-color-primary: var(--c-dark-green);
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: var(--c-green);
  --md-sys-color-on-primary-container: #ffffff;

  --md-sys-color-secondary: var(--c-blue);
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #c4e4ff;
  --md-sys-color-on-secondary-container: #001d35;

  --md-sys-color-surface: #f9fafc;
  --md-sys-color-on-surface: var(--c-slate);
  --md-sys-color-surface-variant: #e0e6eb;
  --md-sys-color-on-surface-variant: var(--c-slate-light);

  --md-sys-color-outline: #757575;
  --md-sys-color-outline-variant: #c4c7c5;

  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f4f6f8;
  --md-sys-color-surface-container: #eaedf1;
  --md-sys-color-surface-container-high: #e2e6eb;
  --md-sys-color-surface-container-highest: #dde2e8;

  /* Shapes */
  --md-sys-shape-corner-medium: 8px;
  /* Conservice is slightly less rounded than M3 */
  --md-sys-shape-corner-large: 12px;
  --md-sys-shape-corner-extra-large: 16px;
  --md-sys-shape-corner-full: 9999px;

  /* Shadows (Elevation) */
  --md-sys-elevation-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1), 0 1px 3px 1px rgba(0, 0, 0, 0.05);
  --md-sys-elevation-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 8px 2px rgba(0, 0, 0, 0.05);
  --md-sys-elevation-lg: 0 4px 8px 3px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);

  --md-sys-motion-easing: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-duration: 250ms;
}

:root[data-theme="dark"] {
  --md-sys-color-primary: var(--c-green);
  --md-sys-color-on-primary: #121c24;
  --md-sys-color-primary-container: var(--c-dark-green);
  --md-sys-color-on-primary-container: #ffffff;

  --md-sys-color-secondary: var(--c-blue);
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #1b4b73;
  --md-sys-color-on-secondary-container: #c4e4ff;

  --md-sys-color-surface: #12181d;
  --md-sys-color-on-surface: #e5eceb;
  --md-sys-color-surface-variant: #2d3e4b;
  --md-sys-color-on-surface-variant: #b0c0ce;

  --md-sys-color-outline: #555759;

  --md-sys-color-surface-container-lowest: #0c1014;
  --md-sys-color-surface-container-low: #171e25;
  --md-sys-color-surface-container: #1b242c;
  --md-sys-color-surface-container-high: #212c36;
  --md-sys-color-surface-container-highest: #28343f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--md-sys-motion-duration) var(--md-sys-motion-easing),
    color var(--md-sys-motion-duration) var(--md-sys-motion-easing);
}

/* App Bar */
.app-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid var(--c-green);
  /* Distinct Conservice green top line feeling */
  transition: background-color var(--md-sys-motion-duration) var(--md-sys-motion-easing);
  box-shadow: var(--md-sys-elevation-sm);
}

.title {
  font-size: 24px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.5px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Icon Button (Toggle) */
.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--md-sys-color-on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--md-sys-shape-corner-full);
  transition: background-color 0.2s ease, transform 0.2s;
}

.theme-toggle:hover {
  background-color: var(--md-sys-color-surface-variant);
  transform: scale(1.05);
}

.theme-toggle:active {
  background-color: color-mix(in srgb, var(--md-sys-color-surface-variant) 80%, black);
}

.theme-toggle.active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.theme-toggle.active:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 85%, black);
}

:root[data-theme="dark"] .theme-toggle.active:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 85%, white);
}

/* Main Container */
.container {
  display: flex;
  flex-direction: row;
  padding: 32px 24px;
  gap: 24px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 800px) {
  .container {
    flex-direction: column;
    padding: 16px;
  }
}

/* Cards */
.card {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 400px;
  box-shadow: var(--md-sys-elevation-md);
  border: 1px solid var(--md-sys-color-surface-variant);
  transition: background-color var(--md-sys-motion-duration) var(--md-sys-motion-easing), box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--md-sys-elevation-lg);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.card-header .icon {
  color: var(--md-sys-color-primary);
}

.subtitle {
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

/* Textareas */
.textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
}

textarea {
  width: 100%;
  flex: 1;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 16px;
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
  resize: none;
  transition: border-color var(--md-sys-motion-duration) var(--md-sys-motion-easing),
    box-shadow var(--md-sys-motion-duration) var(--md-sys-motion-easing);
  min-height: 300px;
}

textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-sys-color-primary) 30%, transparent);
}

textarea::placeholder {
  color: var(--md-sys-color-outline);
}

.output-section textarea {
  background-color: var(--md-sys-color-surface-container);
  border-color: transparent;
}

.output-section textarea:focus {
  border-color: var(--md-sys-color-primary);
}

/* FAB */
.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: var(--md-sys-shape-corner-full);
  /* Circular like most traditional FABs */
  border: none;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-md);
  transition: box-shadow var(--md-sys-motion-duration) var(--md-sys-motion-easing),
    background-color 0.2s,
    transform 0.1s;
}

.fab .material-symbols-outlined {
  font-size: 28px;
}

.fab:hover {
  box-shadow: var(--md-sys-elevation-lg);
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 85%, black);
  transform: translateY(-2px);
}

:root[data-theme="dark"] .fab:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 85%, white);
}

.fab:active {
  box-shadow: var(--md-sys-elevation-sm);
  transform: translateY(0);
}

/* Snackbar */
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--md-sys-color-on-surface);
  color: var(--md-sys-color-surface);
  padding: 14px 20px;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--md-sys-elevation-md);
  transition: transform var(--md-sys-motion-duration) var(--md-sys-motion-easing), opacity var(--md-sys-motion-duration) var(--md-sys-motion-easing);
  opacity: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}

.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Animations */
@keyframes spin {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.5;
  }

  50% {
    transform: rotate(180deg) scale(1.3);
    opacity: 1;
  }

  100% {
    transform: rotate(360deg) scale(1);
    opacity: 1;
  }
}

.animate-spin {
  animation: spin 0.4s var(--md-sys-motion-easing);
}

@keyframes pop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.15);
  }

  80% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1);
  }
}

.animate-pop {
  animation: pop 0.4s var(--md-sys-motion-easing);
}

/* Flyover Menu */
.app-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--md-sys-color-on-surface);
  z-index: 200;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.nav-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.flyover-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 80vw;
  height: 100vh;
  background-color: var(--md-sys-color-surface);
  z-index: 210;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s var(--md-sys-motion-easing);
  box-shadow: var(--md-sys-elevation-lg);
}

.flyover-menu.hidden {
  transform: translateX(-100%);
}

.flyover-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 24px;
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
}

.flyover-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.flyover-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.nav-item.active {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
  color: var(--md-sys-color-primary);
}

.nav-item.active .material-symbols-outlined {
  color: var(--md-sys-color-primary);
}

.flyover-footer {
  padding: 24px;
  font-size: 13px;
  color: var(--md-sys-color-outline);
  text-align: left;
  border-top: 1px solid var(--md-sys-color-surface-variant);
}

.flyover-footer p {
  margin-bottom: 4px;
}

/* DNA Converter Specifics */
.manual-generate {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  transition: all 0.2s ease;
}
.manual-generate:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary-container) 85%, black);
}

.output-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.output-links a {
  display: flex;
  align-items: center;
  color: var(--md-sys-color-secondary);
  text-decoration: none;
  word-break: break-all;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  padding: 14px 16px;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  transition: all 0.2s;
  box-shadow: var(--md-sys-elevation-sm);
}

.output-links a:hover {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-md);
  transform: translateY(-1px);
}

.output-links .error {
  color: #ba1a1a;
  background-color: #ffdad6; 
  padding: 14px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: 14px;
  border: 1px solid #ffb4ab;
}

:root[data-theme="dark"] .output-links .error {
  background-color: #93000a;
  color: #ffdad6;
  border-color: #690005;
}