/* 
 * custom.css - Benutzerdefinierte Stilanpassungen für devcs_Agent (PHP Version)
 * Ergänzt die Tailwind CSS Grundstile mit projektspezifischen Anpassungen
 */

:root {
  /* Light Theme (Default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --accent-color: #8b5cf6;
  --border-color: #e2e8f0;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;

  /* System Preferences Check */
  color-scheme: light dark;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --primary-color: #60a5fa;
  --primary-dark: #3b82f6;
  --accent-color: #a78bfa;
  --border-color: #334155;
}

/* Base styles for theme support */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* Theme switch styles */
.theme-switch {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-switch:hover {
  transform: scale(1.05);
}

.theme-switch svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

/* Icon-specific styles */
.theme-switch .sun-icon {
  transform-origin: center;
}

.theme-switch .moon-icon {
  transform-origin: center;
}

/* Icon animations */
.theme-switch:hover svg {
  transform: scale(1.1);
}

/* Additional theme-specific styles */
[data-theme="dark"] .theme-switch {
  background: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .theme-switch {
  background: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* High contrast support */
@media (forced-colors: active) {
  .theme-switch {
    border: 2px solid ButtonText;
  }
  
  .theme-switch svg {
    stroke: ButtonText;
  }
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
  .header-nav-wrapper {
    padding: 0.75rem 0;
  }

  .nav-list {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-link {
    padding: 0.75rem;
    width: 100%;
    text-align: center;
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
  }

  .content {
    padding: 1rem;
  }

  .theme-switch {
    top: 0.75rem;
    right: 0.75rem;
  }
}

/* Utility classes */
.bg-primary {
  background-color: var(--bg-primary);
}

.bg-secondary {
  background-color: var(--bg-secondary);
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.border {
  border: 1px solid var(--border-color);
}

.rounded {
  border-radius: 0.375rem;
}

.shadow {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Print styles */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }

  .theme-switch,
  .nav-list {
    display: none !important;
  }

  .content {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  a {
    text-decoration: underline;
    color: black !important;
  }

  /* Ensure good contrast for printed content */
  h1, h2, h3, h4, h5, h6, p, li {
    color: black !important;
  }
}

/* Header and Navigation theming */
.header-nav-wrapper {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

header {
  color: var(--text-primary);
}

.site-title {
  color: var(--text-primary);
}

.nav-list {
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus {
  background-color: var(--primary-color);
  color: var(--bg-primary);
}

.dropdown-menu {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dropdown-item {
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--primary-color);
  color: var(--bg-primary);
}

/* Form elements theming */
input,
textarea,
select {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
  outline: none;
}

/* Labels and form text */
label {
  color: var(--text-primary);
  font-weight: 500;
}

.form-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Form validation states */
input:invalid,
textarea:invalid {
  border-color: var(--error-color);
}

input:invalid:focus,
textarea:invalid:focus {
  border-color: var(--error-color);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Content areas and cards */
.content {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

p {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  color: var(--text-primary);
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

/* Code blocks */
pre, code {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.2rem 0.4rem;
  font-family: monospace;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

pre code {
  border: none;
  padding: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
}

th, td {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

th {
  background-color: var(--bg-secondary);
  font-weight: 600;
}

/* Skills cloud specific styling */
.skills-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.skill {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.skill:hover {
  background-color: var(--primary-color);
  color: var(--bg-primary);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Modern Button Variations */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background-color: var(--primary-color);
  color: var(--bg-primary);
}

/* Status Indicators */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}

.badge-success {
  background-color: var(--success-color);
  color: var(--bg-primary);
}

.badge-warning {
  background-color: var(--warning-color);
  color: var(--bg-primary);
}

.badge-error {
  background-color: var(--error-color);
  color: var(--bg-primary);
}

/* Loading States */
.btn-loading {
  position: relative;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: currentColor;
  animation: spin 0.6s linear infinite;
}

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

/* Focus States */
.btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Disabled States */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Allgemeine Verbesserungen für Barrierefreiheit (WCAG 2.2) */
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced focus styles for keyboard navigation (WCAG 2.2 Level AA) */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Remove focus outline for mouse users while maintaining keyboard accessibility */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip-Link for keyboard users (WCAG 2.2 Level A) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: var(--bg-primary);
  padding: 0.75rem 1.25rem;
  z-index: 100;
  transition: top 0.2s ease;
  border-radius: 0 0 0.5rem 0.5rem;
}

.skip-link:focus {
  top: 0;
}

/* Interactive elements */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

button {
  background-color: var(--primary-color);
  color: var(--bg-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Chat interface with theme support */
.chat-message {
  max-width: 85%;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  word-wrap: break-word;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.chat-message.user {
  background-color: var(--primary-color);
  color: var(--bg-primary);
  margin-left: auto;
  border: none;
}

.chat-message.bot {
  background-color: var(--bg-secondary);
  margin-right: auto;
}

.chat-message.error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--error-color);
  color: var(--error-color);
}

/* Loading animation with theme support */
.loading {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 20px;
}

.loading:after {
  content: "";
  display: block;
  border-radius: 50%;
  width: 0;
  height: 0;
  margin: 8px;
  box-sizing: border-box;
  border: 12px solid var(--primary-color);
  border-color: var(--primary-color) transparent var(--primary-color) transparent;
  animation: loading 1.2s infinite;
}

/* Media query for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .loading:after {
    animation-duration: 1.5s;
  }
  
  .theme-switch,
  button,
  a {
    transition: none;
  }
}

/* System dark mode preference support */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary-color: #60a5fa;
    --primary-dark: #3b82f6;
    --accent-color: #a78bfa;
    --border-color: #334155;
  }
}

@keyframes loading {
  0% {
    transform: rotate(0);
    animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }
  50% {
    transform: rotate(180deg);
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Verbesserte Markdown-Darstellung im Chat */
.markdown-content pre {
  background-color: #272822;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.markdown-content code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-content ul {
  list-style-type: disc;
}

.markdown-content ol {
  list-style-type: decimal;
}

/* Fix für unnötigen vertikalen Scrollbalken */
html, body {
  overflow-x: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

main#main-content {
  min-height: calc(100vh - 64px - 96px); /* Subtrakt Header und Footer Höhe */
}

/* Entfernt unnötige Abstände am Ende der Seite */
section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Media Queries für bessere Mobile-Unterstützung */
@media (max-width: 640px) {
  .chat-message {
    max-width: 95%;
  }
  
  .markdown-content pre {
    max-width: 100%;
    font-size: 0.8rem;
  }
}

/* Print-Stylesheet für bessere Druckdarstellung */
@media print {
  header, footer, .no-print {
    display: none;
  }
  
  body {
    background-color: white;
    color: black;
  }
  
  .chat-message {
    border: 1px solid #ddd;
    max-width: 100%;
    break-inside: avoid;
  }
}