/* PKPortal Docs - Custom Theme Overrides */

:root {
  --theme-color: #42b983;
  --theme-color-secondary: #35495e;
  --bg-dark: #0f1016;
  --bg-card: #1e1e25;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
}

/* ============================================
   AUTH OVERLAY (Docs Password Protection)
   ============================================ */

body.auth-locked {
  overflow: hidden;
  background: #0f1016;
}

body.auth-locked #app {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1e1f2a, #0c0d12 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.auth-card {
  width: min(360px, 90%);
  background: rgba(22, 23, 33, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  border-radius: 16px;
  padding: 32px;
  color: #fff;
}

.auth-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.auth-card p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.auth-field label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}

.auth-field input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
}

.auth-field input:focus {
  border-color: #42b983;
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.2);
}

.auth-submit {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #42b983, #35495e);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.auth-submit:hover {
  opacity: 0.85;
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-error {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  color: #ff6b81;
  font-size: 0.85rem;
}

.auth-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   BASE STYLES
   ============================================ */

/* Sidebar styling */
.sidebar-nav > ul > li > a {
  font-weight: 600;
}

/* Content styling */
.markdown-section h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.markdown-section h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.markdown-section h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

/* Code blocks */
.markdown-section code {
  background-color: rgba(66, 185, 131, 0.1);
  color: #42b983;
}

.markdown-section pre {
  background-color: #1e1e25;
}

.markdown-section pre > code {
  color: #e0e0e0;
}

/* Links */
.markdown-section a {
  color: #42b983;
  text-decoration: none;
}

.markdown-section a:hover {
  text-decoration: underline;
}

/* Tables */
.markdown-section table {
  border-collapse: collapse;
}

.markdown-section th {
  background-color: rgba(66, 185, 131, 0.1);
  border-bottom: 2px solid #42b983;
}

.markdown-section td {
  border-bottom: 1px solid #333;
}

/* ============================================
   MERMAID DIAGRAMS - PKPortal Theme
   ============================================ */

/* Container */
.markdown-section .mermaid {
  background: #0f1016 !important;
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 24px;
  box-sizing: border-box;
  cursor: zoom-in;
  transition: transform 0.2s ease;
  border-radius: 12px;
  border: 1px solid rgba(66, 185, 131, 0.2);
  overflow-x: auto;
}

.markdown-section .mermaid:hover {
  transform: scale(1.01);
  border-color: rgba(66, 185, 131, 0.4);
}

/* Zoomed state */
.markdown-section .mermaid.zoomed {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  z-index: 9999;
  cursor: zoom-out;
  background: rgba(15, 16, 22, 0.98) !important;
  padding: 48px;
  border-radius: 0;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.9);
  overflow: auto;
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border: none;
}

.markdown-section .mermaid.zoomed:hover {
  transform: none;
}

.markdown-section .mermaid.zoomed svg {
  width: auto !important;
  max-width: none !important;
  min-width: 1400px;
  height: auto !important;
}

/* SVG base */
.markdown-section .mermaid svg {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 300px;
  background: #0f1016;
  border-radius: 8px;
  box-sizing: border-box;
}

/* Node styling - HIGH CONTRAST */
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle,
.mermaid .node ellipse {
  fill: #1e1e25 !important;
  stroke: #42b983 !important;
  stroke-width: 2px !important;
}

.mermaid .node .label {
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px !important;
  font-weight: 500;
}

.mermaid .node .label text {
  fill: #ffffff !important;
}

/* Special node types */
.mermaid .node.primary rect,
.mermaid .node.primary polygon {
  fill: rgba(66, 185, 131, 0.25) !important;
  stroke: #42b983 !important;
  stroke-width: 3px !important;
}

.mermaid .node.secondary rect,
.mermaid .node.secondary polygon {
  fill: rgba(53, 73, 94, 0.4) !important;
  stroke: #5d7a9e !important;
}

.mermaid .node.accent rect,
.mermaid .node.accent polygon {
  fill: rgba(182, 149, 243, 0.25) !important;
  stroke: #b695f3 !important;
}

.mermaid .node.warning rect,
.mermaid .node.warning polygon {
  fill: rgba(255, 193, 7, 0.2) !important;
  stroke: #ffc107 !important;
}

/* Edge styling */
.mermaid .edgePath .path,
.mermaid .edgePaths path {
  stroke: #42b983 !important;
  stroke-width: 2px !important;
}

.mermaid .marker {
  fill: #42b983 !important;
  stroke: #42b983 !important;
}

.mermaid .marker path {
  fill: #42b983 !important;
  stroke: #42b983 !important;
}

.mermaid .edgeLabel {
  background-color: #0f1016 !important;
  color: #ffffff !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(66, 185, 131, 0.3);
}

.mermaid .edgeLabel text {
  fill: #ffffff !important;
}

/* Cluster styling */
.mermaid .cluster rect {
  fill: rgba(66, 185, 131, 0.08) !important;
  stroke: rgba(66, 185, 131, 0.4) !important;
  stroke-width: 1px !important;
  rx: 12px !important;
}

.mermaid .cluster text {
  font-size: 0.95rem;
  font-weight: 600;
  fill: #42b983 !important;
}

/* Flowchart specific */
.mermaid .flowchart-link {
  stroke: #42b983 !important;
}

/* Sequence diagram specific */
.mermaid .actor {
  fill: #1e1e25 !important;
  stroke: #42b983 !important;
}

.mermaid .actor-line {
  stroke: rgba(66, 185, 131, 0.3) !important;
}

.mermaid .messageLine0,
.mermaid .messageLine1 {
  stroke: #42b983 !important;
}

.mermaid .messageText {
  fill: #ffffff !important;
  font-size: 13px;
}

/* Class diagram specific */
.mermaid .classBox {
  fill: #1e1e25 !important;
  stroke: #42b983 !important;
}

.mermaid .classTitle {
  fill: #42b983 !important;
  font-weight: 600 !important;
}

/* State diagram specific */
.mermaid .state rect {
  fill: #1e1e25 !important;
  stroke: #42b983 !important;
}

/* Git graph specific */
.mermaid .gitBranchLabel {
  fill: #ffffff !important;
}

/* Pie chart specific */
.mermaid .pieTitleText {
  fill: #ffffff !important;
}

.mermaid .pieLegend text {
  fill: #e0e0e0 !important;
}

/* Gantt chart specific */
.mermaid .sectionTitle {
  fill: #42b983 !important;
}

.mermaid .taskText {
  fill: #ffffff !important;
}

/* ============================================
   SIDEBAR & NAVIGATION
   ============================================ */

.sidebar-toggle {
  background-color: rgba(15, 16, 22, 0.8);
}

/* Version badge in sidebar */
.sidebar-version {
  padding: 10px;
  font-size: 12px;
  color: #666;
  text-align: center;
  border-top: 1px solid #333;
  margin-top: 10px;
}

.sidebar-version strong {
  color: #42b983;
}

/* ============================================
   SEARCH
   ============================================ */

.search {
  border-bottom: 1px solid #191919;
}

.search input {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

.search input:focus {
  border-color: #42b983;
}

.search .search-keyword,
.search a:hover {
  color: var(--theme-color);
}

.search .search-keyword {
  font-weight: 500;
}

.search .results-panel {
  color: #c0c0c0;
}

.search .matching-post {
  border-bottom: 1px solid #444444 !important;
}

/* ============================================
   PAGINATION & FOOTER
   ============================================ */

.pagination-item-label {
  color: #42b983;
}

/* Copy code button */
.docsify-copy-code-button {
  background-color: #42b983 !important;
  color: #fff !important;
}

/* Alert/Notice boxes */
.markdown-section blockquote {
  border-left: 4px solid #42b983;
  background: rgba(66, 185, 131, 0.05);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
}

/* Task lists */
.markdown-section .task-list-item {
  list-style-type: none;
}

.markdown-section .task-list-item input {
  margin-right: 8px;
}
