/* Grid Cards Styling */
.md-typeset .grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.md-typeset .grid.cards > ul {
  display: contents;
}

.md-typeset .grid.cards > ul > li {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  padding: 1.5rem;
  background: var(--md-default-bg-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--md-primary-fg-color);
}

.md-typeset .grid.cards > ul > li > hr {
  margin: 1rem 0;
  border-color: var(--md-default-fg-color--lightest);
}

.md-typeset .grid.cards > ul > li > p:first-of-type {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0;
}

.md-typeset .grid.cards > ul > li > p:first-of-type .twemoji,
.md-typeset .grid.cards > ul > li > p:first-of-type svg {
  width: 2rem;
  height: 2rem;
}

.md-typeset .grid.cards > ul > li a {
  font-weight: 600;
  color: var(--md-primary-fg-color);
  text-decoration: none;
}

.md-typeset .grid.cards > ul > li a:hover {
  text-decoration: underline;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li {
  background: var(--md-code-bg-color);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li:hover {
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .md-typeset .grid.cards {
    grid-template-columns: 1fr;
  }
}

/* Hero section styling */
.md-typeset h1:first-child {
  font-weight: 700;
  font-size: 2.5rem;
}

/* Quick Start section icon */
.md-typeset h2 .twemoji,
.md-typeset h2 svg {
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* Form Styling */
.form-container {
  max-width: 700px;
  margin: 2rem auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--md-default-fg-color);
  font-size: 0.95rem;
}

.form-group .required {
  color: #e74c3c;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group small {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.85rem;
  color: var(--md-default-fg-color--light);
}

.submit-btn {
  background: var(--md-primary-fg-color);
  color: white;
  border: none;
  padding: 0.875rem 2rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
  display: inline-block;
}

.submit-btn:hover {
  background: var(--md-accent-fg-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(103, 58, 183, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Dark mode form adjustments */
[data-md-color-scheme="slate"] .form-group input[type="text"],
[data-md-color-scheme="slate"] .form-group input[type="email"],
[data-md-color-scheme="slate"] .form-group textarea,
[data-md-color-scheme="slate"] .form-group select {
  background: var(--md-code-bg-color);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .form-group input[type="text"]:focus,
[data-md-color-scheme="slate"] .form-group input[type="email"]:focus,
[data-md-color-scheme="slate"] .form-group textarea:focus,
[data-md-color-scheme="slate"] .form-group select:focus {
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.15);
}

/* Form responsive */
@media screen and (max-width: 768px) {
  .form-container {
    margin: 1rem 0;
  }

  .submit-btn {
    width: 100%;
  }
}

/* Form success/error messages */
.form-message {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.form-message--success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-message--error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

[data-md-color-scheme="slate"] .form-message--success {
  background: rgba(40, 167, 69, 0.2);
  color: #5ed47a;
  border-color: rgba(40, 167, 69, 0.3);
}

[data-md-color-scheme="slate"] .form-message--error {
  background: rgba(220, 53, 69, 0.2);
  color: #f5a1a9;
  border-color: rgba(220, 53, 69, 0.3);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Documentation Editor Styles (Admin Only) */

/* Edit button in header */
.edit-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  margin-left: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.edit-page-btn:hover {
  background: rgba(103, 58, 183, 0.1);
}

.edit-page-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .edit-page-btn:hover {
  background: rgba(103, 58, 183, 0.2);
}

/* Editor modal */
.docs-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.docs-editor-modal.active {
  opacity: 1;
  pointer-events: all;
}

.docs-editor-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.docs-editor-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  background: var(--md-default-bg-color);
  border-radius: 0.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docs-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.docs-editor-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
}

.docs-editor-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.docs-editor-close:hover {
  background: rgba(220, 53, 69, 0.1);
}

.docs-editor-close svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: var(--md-default-fg-color);
}

.docs-editor-body {
  flex: 1;
  padding: 1.5rem;
  overflow: auto;
}

.docs-editor-textarea {
  width: 100%;
  height: 100%;
  min-height: 400px;
  padding: 1rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.375rem;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--md-code-bg-color);
  color: var(--md-default-fg-color);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.docs-editor-textarea:focus {
  outline: none;
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

.docs-editor-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--md-default-fg-color--lightest);
}

.docs-editor-footer button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.docs-editor-cancel {
  background: var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color);
}

.docs-editor-cancel:hover {
  background: var(--md-default-fg-color--lighter);
}

.docs-editor-save {
  background: var(--md-primary-fg-color);
  color: white;
}

.docs-editor-save:hover {
  background: var(--md-accent-fg-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(103, 58, 183, 0.3);
}

.docs-editor-save:disabled,
.docs-editor-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.docs-editor-status {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
}

.docs-editor-status.active {
  padding: 1rem 1.5rem;
  max-height: 100px;
}

.docs-editor-status.success {
  background: #d4edda;
  color: #155724;
}

.docs-editor-status.error {
  background: #f8d7da;
  color: #721c24;
}

.docs-editor-status.info {
  background: #d1ecf1;
  color: #0c5460;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .docs-editor-container {
  background: var(--md-code-bg-color);
}

[data-md-color-scheme="slate"] .docs-editor-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .docs-editor-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .docs-editor-textarea {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .docs-editor-textarea:focus {
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.15);
}

[data-md-color-scheme="slate"] .docs-editor-status.success {
  background: rgba(40, 167, 69, 0.2);
  color: #5ed47a;
}

[data-md-color-scheme="slate"] .docs-editor-status.error {
  background: rgba(220, 53, 69, 0.2);
  color: #f5a1a9;
}

[data-md-color-scheme="slate"] .docs-editor-status.info {
  background: rgba(23, 162, 184, 0.2);
  color: #66d9ef;
}

/* Responsive */
@media screen and (max-width: 768px) {
  .docs-editor-container {
    width: 95%;
    max-height: 95vh;
  }

  .docs-editor-header,
  .docs-editor-body,
  .docs-editor-footer {
    padding: 1rem;
  }

  .docs-editor-textarea {
    min-height: 300px;
    font-size: 0.85rem;
  }

  .docs-editor-footer {
    flex-direction: column;
  }

  .docs-editor-footer button {
    width: 100%;
  }
}

/* ===== EchoVQ Integration Styles ===== */

/* Override Material purple with EchoVQ's purple */
:root {
  --md-primary-fg-color: #9333ea;  /* EchoVQ purple */
  --md-primary-fg-color--light: #a855f7;
  --md-primary-fg-color--dark: #7c3aed;
  --md-accent-fg-color: #9333ea;
}

/* When embedded, hide header for seamless integration */
body.embedded-docs .md-header {
  display: none !important;
}

body.embedded-docs .md-container {
  padding-top: 0 !important;
}

body.embedded-docs .md-sidebar--primary {
  display: none !important;
}

body.embedded-docs .md-main {
  margin-left: 0 !important;
}

/* Smoother transitions */
.md-typeset a {
  transition: color 0.2s ease;
}

/* Match EchoVQ's button styling */
.md-button {
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.md-button--primary {
  background-color: #9333ea !important;
}

.md-button--primary:hover {
  background-color: #7c3aed !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Card hover effects that match EchoVQ */
.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.15);
  border-color: #9333ea;
}

/* Links with EchoVQ purple */
.md-typeset a {
  color: #9333ea;
}

.md-typeset a:hover {
  color: #7c3aed;
}

/* Active nav items */
.md-nav__link--active {
  color: #9333ea !important;
}

.md-tabs__link--active {
  color: #9333ea !important;
}

/* Search styling - Match EchoVQ design */
.md-search {
  margin-left: auto !important;
  margin-right: 0.5rem !important;
}

.md-search__form {
  background-color: #f3f4f6;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.md-search__form:hover {
  border-color: #9333ea;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.1);
}

.md-search__input {
  background-color: transparent;
  color: #374151;
  font-size: 0.95rem;
  border-radius: 0.5rem;
}

.md-search__input::placeholder {
  color: #9ca3af;
}

.md-search__input:focus {
  border-color: #9333ea;
}

.md-search__icon {
  color: #9333ea !important;
}

.md-search__icon[for="__search"] svg,
.md-search__icon svg {
  fill: #9333ea !important;
}

/* Dark mode search */
[data-md-color-scheme="slate"] .md-search__form {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .md-search__input {
  color: #f3f4f6;
}

[data-md-color-scheme="slate"] .md-search__form:hover {
  border-color: #9333ea;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.2);
}

[data-md-color-scheme="slate"] .md-search__icon {
  color: #a855f7 !important;
}

[data-md-color-scheme="slate"] .md-search__icon svg {
  fill: #a855f7 !important;
}

/* Code blocks subtle purple accent */
.md-typeset code {
  background-color: rgba(147, 51, 234, 0.05);
}

/* Admonitions */
.md-typeset .admonition {
  border-left-color: #9333ea;
}

/* Remove rounded corners for seamless embedding */
body.embedded-docs {
  border-radius: 0;
}

body.embedded-docs .md-main__inner {
  margin-top: 0;
}

/* Ensure content fills the space */
body.embedded-docs .md-content {
  max-width: 100%;
  padding: 2rem;
}

/* ===== Keep Navigation Accessible on All Screen Sizes ===== */

/* Always show the navigation drawer toggle button */
.md-header__button.md-logo,
.md-header__button[for="__drawer"] {
  display: inline-block !important;
  opacity: 1 !important;
}

/* Ensure the navigation drawer works on all screen sizes */
@media screen and (max-width: 76.1875em) {
  /* Keep drawer toggle visible */
  .md-header__button[for="__drawer"] {
    display: inline-block !important;
  }

  /* Ensure drawer can be opened */
  .md-sidebar--primary {
    position: fixed;
    left: -100%;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Show drawer when checkbox is checked */
  [data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar--primary {
    left: 0;
  }
}

/* Breadcrumb styling to match EchoVQ */
.md-path {
  color: #6b7280;
  font-size: 0.85rem;
}

.md-path__link {
  color: #9333ea !important;
  transition: color 0.2s ease;
}

.md-path__link:hover {
  color: #7c3aed !important;
}

.md-path__separator {
  color: #9ca3af;
}

/* ===== Sidebar Layout: Hide right sidebar, keep left nav except on mobile ===== */

/* Completely hide right sidebar (On this page) on all screens */
.md-sidebar--secondary {
  display: none !important;
}

/* CRITICAL: Override Material's sidebar hiding at 1220px */
/* Force sidebar to stay visible down to 800px */
@media screen and (max-width: 76.1875em) {
  /* This is the range where Material normally hides it (below 1220px) */
  /* We override to keep it visible */
  .md-sidebar.md-sidebar--primary {
    display: block !important;
  }

  [dir="ltr"] .md-sidebar.md-sidebar--primary {
    left: 0 !important;
  }

  .md-sidebar__inner {
    display: block !important;
  }

  /* Push main content to the right to avoid overlap with sidebar */
  .md-main__inner {
    margin-left: 0 !important;
  }

  .md-content {
    margin-left: 12.1rem !important; /* Width of sidebar */
  }

  /* Push header content to the right to avoid overlap with sidebar */
  .md-header__inner {
    margin-left: 12.1rem !important;
  }

  /* Also push tabs if they exist */
  .md-tabs {
    margin-left: 12.1rem !important;
  }
}

/* Only hide sidebar below 800px for mobile drawer mode */
@media screen and (max-width: 50em) {
  .md-sidebar.md-sidebar--primary {
    position: fixed !important;
    top: 0 !important;
    left: -12.1rem !important;
    width: 12.1rem !important;
    height: 100% !important;
    transform: translateX(0) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s !important;
    background-color: var(--md-default-bg-color) !important;
    z-index: 200 !important;
  }

  /* Show sidebar when drawer checkbox is checked */
  [data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar.md-sidebar--primary {
    transform: translateX(12.1rem) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2) !important;
  }

  /* Show the hamburger menu button */
  .md-header__button.md-icon[for="__drawer"] {
    display: inline-block !important;
  }

  /* Remove left margin on content when sidebar is in drawer mode */
  .md-content {
    margin-left: 0 !important;
  }

  /* Remove header margin on mobile */
  .md-header__inner {
    margin-left: 0 !important;
  }

  .md-tabs {
    margin-left: 0 !important;
  }
}

/* Above 800px, hide the hamburger button */
@media screen and (min-width: 50.0625em) {
  .md-header__button.md-icon[for="__drawer"] {
    display: none !important;
  }
}

/* ===== Logo Styling ===== */

/* Make logo white on purple header background */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  filter: brightness(0) invert(1);
}

/* Adjust logo size */
.md-header__button.md-logo {
  padding: 0.4rem;
}

.md-header__button.md-logo img {
  height: 2rem;
  width: auto;
}
