﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding-left: 1rem;
  padding-right: 1rem;
}

.admin-sidebar-shell {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.admin-sidebar {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.admin-sidebar-nav .list-group-item {
  border-left: 0;
  border-right: 0;
}

.admin-sidebar-nav .list-group-item:first-child {
  border-top: 0;
}

.admin-sidebar-nav .list-group-item:last-child {
  border-bottom: 0;
}

/* Sidebar accordion groups */
.sidebar-group {
  margin-bottom: 2px;
}

.sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0.5rem;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-group-toggle:hover {
  background: #f3f4f6;
}

.sidebar-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: #9ca3af;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(90deg);
}

.sidebar-subitem {
  display: block;
  padding: 0.4rem 0.5rem 0.4rem 1.75rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 0.375rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-subitem:hover {
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
}

.sidebar-standalone {
  display: block;
  padding: 0.6rem 0.5rem;
  color: #1f2937;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.375rem;
  transition: background 0.15s;
}

.sidebar-standalone:hover {
  background: #f3f4f6;
  text-decoration: none;
}

.admin-page-content {
  min-width: 0;
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-section {
  scroll-margin-top: 1rem;
}

/* Admin tab styles */
.admin-tabs {
  border-bottom: 2px solid #dee2e6;
}

.admin-tabs .nav-link {
  border: none;
  border-bottom: 3px solid transparent;
  color: #6c757d;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tabs .nav-link:hover {
  color: #1f2937;
  border-bottom-color: #adb5bd;
}

.admin-tabs .nav-link.active {
  color: #0d6efd;
  border-bottom-color: #0d6efd;
  background: transparent;
}

.admin-tabs .tab-icon {
  margin-right: 0.35rem;
}

.admin-tab-content {
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  background: #fff;
}

.page-editor-card {
  border-left: 4px solid #0d6efd;
}

.page-content-editor {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 200px;
}

/* Custom page hero */
.custom-hero {
  min-height: 280px;
  background-size: cover;
  background-position: center;
  background-color: #1f2937;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.custom-hero-overlay {
  width: 100%;
  padding: 2rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}

.custom-page-content {
  max-width: 900px;
  margin: 0 auto;
  line-height: 1.8;
}

.custom-page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Hero animations */
.fadeIn {
  animation: fadeIn 1s ease-in;
}

.slideInDown {
  animation: slideInDown 0.8s ease-out;
}

.zoomIn {
  animation: zoomIn 0.8s ease-out;
}

@@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}

@@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 991.98px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar-shell {
    position: static;
  }

  .admin-sidebar {
    max-height: none;
  }
}

.ollama-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1080;
}

.ollama-launcher {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: #1f2937;
  color: #ffffff;
  font-size: 28px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.ollama-launcher:hover {
  background: #111827;
}

.ollama-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 110px));
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ollama-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #1f2937;
  color: #ffffff;
}

.ollama-title {
  font-weight: 600;
}

.ollama-subtitle {
  font-size: 12px;
  opacity: 0.85;
}

.ollama-close {
  border: none;
  background: transparent;
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
}

.ollama-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f3f4f6;
}

.ollama-message {
  max-width: 86%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  word-break: break-word;
  white-space: pre-wrap;
}

.ollama-message-user {
  margin-left: auto;
  background: #1f2937;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ollama-message-assistant {
  margin-right: auto;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.ollama-message-system {
  margin-right: auto;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.ollama-panel-footer {
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

#ollamaWidgetInput {
  resize: none;
}

@media (max-width: 576px) {
  .ollama-widget {
    right: 12px;
    bottom: 12px;
  }

  .ollama-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
  }
}

.chat-card {
  border-radius: 0.75rem;
}

.chat-messages {
  min-height: 420px;
  max-height: 60vh;
  overflow-y: auto;
  background: #f8f9fa;
}

.chat-message {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-message-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  letter-spacing: 0.04em;
}

.chat-message-body {
  white-space: normal;
  word-break: break-word;
}

.chat-message-user {
  background: #dbeafe;
  margin-left: 2rem;
}

.chat-message-assistant {
  background: #ffffff;
  border: 1px solid #dee2e6;
  margin-right: 2rem;
}

.chat-message-system {
  background: #fff3cd;
  border: 1px solid #ffecb5;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
