/*
Theme Name: AI Accounting Docs
Description: Professional WordPress theme for AI Accounting developer documentation. Features modern design, syntax highlighting, and developer-focused layout.
Author: MiniMax Agent
Version: 1.0.0
Text Domain: ai-accounting-docs
Requires PHP: 7.4
*/

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: #1f2937;
  background-color: #ffffff;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode {
  background-color: #0f172a;
  color: #e2e8f0;
}

/* Container and Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  gap: 0;
}

@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
}

/* Header Styles */
.docs-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.docs-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.docs-logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
}

.theme-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.3);
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-controls .search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-controls .search-field {
  padding: 0.5rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0.25rem;
  background: rgba(255,255,255,0.1);
  color: white;
  min-width: 200px;
}

.header-controls .search-field::placeholder {
  color: rgba(255,255,255,0.7);
}

.header-controls .search-submit {
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 0.25rem;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.header-controls .search-submit:hover {
  background: rgba(255,255,255,0.3);
}

/* Language Switcher */
.language-switcher {
  position: relative;
  display: inline-block;
}

.language-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  min-width: 120px;
  justify-content: space-between;
}

.language-toggle:hover {
  background: rgba(255,255,255,0.3);
}

.language-toggle:focus {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}

.current-language-flag {
  font-size: 1rem;
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.language-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.language-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  min-width: 160px;
  z-index: 1000;
  overflow: hidden;
  animation: fadeInDown 0.2s ease;
}

body.dark-mode .language-dropdown {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.language-options {
  padding: 0.5rem 0;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #374151;
  text-decoration: none;
  transition: background-color 0.2s ease;
  font-size: 0.9rem;
}

body.dark-mode .language-option {
  color: #e2e8f0;
}

.language-option:hover {
  background: #f3f4f6;
}

body.dark-mode .language-option:hover {
  background: #334155;
}

.language-option.active {
  background: #e0f2fe;
  color: #0369a1;
  position: relative;
}

body.dark-mode .language-option.active {
  background: #1e40af;
  color: #bfdbfe;
}

.language-option.active::after {
  content: '✓';
  position: absolute;
  right: 1rem;
  color: #0369a1;
  font-weight: bold;
}

body.dark-mode .language-option.active::after {
  color: #bfdbfe;
}

.language-option .flag {
  font-size: 1rem;
  min-width: 1.2rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .header-controls .search-form {
    width: 100%;
  }
  
  .header-controls .search-field {
    min-width: auto;
    flex: 1;
  }
  
  .language-toggle {
    width: 100%;
    justify-content: center;
  }
  
  .language-dropdown {
    right: auto;
    left: 0;
    width: 100%;
  }
}

/* Sidebar Styles */
.docs-sidebar {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  padding: 2rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: background-color 0.3s ease;
}

body.dark-mode .docs-sidebar {
  background: #1e293b;
  border-right-color: #334155;
}

.sidebar-search {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  transition: border-color 0.3s ease;
}

.sidebar-search:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

body.dark-mode .sidebar-search {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

.docs-nav ul {
  list-style: none;
}

.docs-nav > ul > li {
  margin-bottom: 1rem;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
}

body.dark-mode .nav-section-title {
  color: #9ca3af;
}

.nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #374151;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: #e5e7eb;
  color: #1f2937;
  border-left-color: #3b82f6;
}

.nav-link.active {
  background: #dbeafe;
  color: #1e40af;
  border-left-color: #3b82f6;
  font-weight: 500;
}

body.dark-mode .nav-link {
  color: #d1d5db;
}

body.dark-mode .nav-link:hover {
  background: #374151;
  color: #f3f4f6;
}

body.dark-mode .nav-link.active {
  background: #1e3a8a;
  color: #60a5fa;
}

/* Main Content Styles */
.docs-main {
  padding: 2rem;
  max-width: none;
  overflow-x: auto;
}

.docs-content {
  max-width: 800px;
}

.docs-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1f2937;
  line-height: 1.2;
}

body.dark-mode .docs-title {
  color: #f9fafb;
}

.docs-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: #6b7280;
}

body.dark-mode .docs-meta {
  color: #9ca3af;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h1:first-child,
h2:first-child,
h3:first-child {
  margin-top: 0;
}

h2 {
  font-size: 1.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

body.dark-mode h2 {
  border-bottom-color: #374151;
}

h3 {
  font-size: 1.5rem;
  color: #374151;
}

body.dark-mode h3 {
  color: #d1d5db;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
}

/* Code Styles */
code {
  background: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

body.dark-mode code {
  background: #374151;
  color: #f9fafb;
}

pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
  border: 1px solid #374151;
}

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

.code-block {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #374151;
  color: #d1d5db;
  border: none;
  padding: 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.code-block:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  background: #4b5563;
  color: #f9fafb;
}

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
}

body.dark-mode table {
  border-color: #374151;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode th,
body.dark-mode td {
  border-bottom-color: #374151;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

body.dark-mode th {
  background: #1f2937;
  color: #f9fafb;
}

tr:hover {
  background: #f9fafb;
}

body.dark-mode tr:hover {
  background: #1f2937;
}

/* Alerts and Callouts */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.alert-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.alert-warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-success {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.alert-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

body.dark-mode .alert-info {
  background: #1e3a8a;
  color: #93c5fd;
}

body.dark-mode .alert-warning {
  background: #92400e;
  color: #fbbf24;
}

body.dark-mode .alert-success {
  background: #065f46;
  color: #6ee7b7;
}

body.dark-mode .alert-error {
  background: #991b1b;
  color: #fca5a5;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

/* Table of Contents */
.toc {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 2rem 0;
}

body.dark-mode .toc {
  background: #1f2937;
  border-color: #374151;
}

.toc h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.toc ul {
  margin: 0;
}

.toc a {
  color: #3b82f6;
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

body.dark-mode .toc a {
  color: #60a5fa;
}

/* Responsive Design */
@media (max-width: 768px) {
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  
  .docs-sidebar.open {
    left: 0;
  }
  
  .docs-main {
    padding: 1rem;
  }
  
  .docs-title {
    font-size: 2rem;
  }
}

/* Print Styles */
@media print {
  .docs-sidebar,
  .theme-toggle,
  .copy-button {
    display: none;
  }
  
  .docs-layout {
    grid-template-columns: 1fr;
  }
  
  .docs-main {
    padding: 0;
  }
  
  pre {
    background: #f8f9fa !important;
    color: #212529 !important;
    border: 1px solid #dee2e6 !important;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Focus Styles */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-4 { padding: 1rem; }

/* API Documentation Specific Styles */
.api-method {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

body.dark-mode .api-method {
  background: #1e293b;
  border-color: #334155;
}

.api-method-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.api-method-type {
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.api-method-type.get { background: #dcfce7; color: #166534; }
.api-method-type.post { background: #dbeafe; color: #1e40af; }
.api-method-type.put { background: #fef3c7; color: #92400e; }
.api-method-type.delete { background: #fee2e2; color: #991b1b; }

body.dark-mode .api-method-type.get { background: #166534; color: #dcfce7; }
body.dark-mode .api-method-type.post { background: #1e40af; color: #dbeafe; }
body.dark-mode .api-method-type.put { background: #92400e; color: #fef3c7; }
body.dark-mode .api-method-type.delete { background: #991b1b; color: #fee2e2; }

.api-endpoint {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 500;
}

/* Database Schema Styles */
.db-table {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  overflow: hidden;
}

body.dark-mode .db-table {
  background: #1f2937;
  border-color: #374151;
}

.db-table-header {
  background: #f9fafb;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .db-table-header {
  background: #111827;
  border-bottom-color: #374151;
}

.db-table-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

body.dark-mode .db-table-name {
  color: #f9fafb;
}

.db-columns {
  padding: 0;
}

.db-column {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
}

body.dark-mode .db-column {
  border-bottom-color: #374151;
}

.db-column:last-child {
  border-bottom: none;
}

.column-name {
  font-weight: 500;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.column-type {
  color: #6b7280;
  font-size: 0.875rem;
}

body.dark-mode .column-type {
  color: #9ca3af;
}