/* ===================================
   AA Hrvatska Help System CSS
   ================================== */

/* CSS Variables for consistent theming */
:root {
  --aa-primary: #26aef2;
  --aa-primary-dark: #1976d2;
  --aa-background: #ffffff;
  --aa-background-light: #f8f9fa;
  --aa-text: #333333;
  --aa-text-light: #666666;
  --aa-border: #e0e0e0;
  --aa-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --aa-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
  --aa-transition: all 0.3s ease;
  --aa-error: #dc3545;
}

/* Ensure body and html don't interfere with sticky positioning */
html,
body {
  overflow-x: visible;
  height: auto;
}

/* Override any Mobirise container styles that might break sticky */
.help-container,
.help-container * {
  overflow: visible !important;
}

/* Exception: only the sidebar should have overflow for scrolling */
.help-sidebar {
  overflow-y: auto !important;
  overflow-x: visible !important;
}

/* Main Layout */
.help-container {
  display: flex;
  min-height: 100vh;
  background-color: var(--aa-background-light);
  font-family: "RobotoCondensed-VariableFont_wght";
  position: relative;
  align-items: flex-start; /* Important for sticky positioning */
  /* Ensure no overflow issues that break sticky */
  overflow: visible;
  height: auto;
}

/* Sidebar Navigation */
.help-sidebar {
  width: 320px;
  min-width: 320px;
  background-color: #26aef2;
  border-right: 1px solid var(--aa-border);
  padding: 20px;
  position: sticky;
  top: 80px; /* Below navigation */
  /* height: calc(100vh - 80px); */
  overflow-y: auto;
  z-index: 999;
  box-shadow: var(--aa-shadow);
  flex-shrink: 0; /* Prevent shrinking */
  align-self: flex-start; /* Ensure sticky works in flexbox */
  /* Custom scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--aa-primary) var(--aa-background-light);
}

/* Webkit scrollbar styling for sidebar */
.help-sidebar::-webkit-scrollbar {
  width: 8px;
}

.help-sidebar::-webkit-scrollbar-track {
  background: var(--aa-background-light);
  border-radius: 4px;
}

.help-sidebar::-webkit-scrollbar-thumb {
  background: var(--aa-primary);
  border-radius: 4px;
}

.help-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--aa-primary-dark);
}

/* Search Box */
.help-search-container {
  position: relative;
  margin-bottom: 20px;
}

.help-search {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border: 2px solid var(--aa-border);
  border-radius: 25px;
  font-size: 14px;
  background-color: var(--aa-background-light);
  transition: var(--aa-transition);
  box-sizing: border-box;
}

.help-search:focus {
  outline: none;
  border-color: var(--aa-primary);
  background-color: var(--aa-background);
}

.help-search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--aa-text-light);
  font-size: 16px;
}

/* Navigation Sections */
.help-nav-section {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden; /* Keep hidden to prevent text overflow */
  background-color: var(--aa-background);
  border: 1px solid var(--aa-border);
  position: relative; /* Ensure proper stacking context */
  z-index: auto; /* Let natural stacking work */
}

.help-nav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--aa-text);
  cursor: pointer;
  transition: var(--aa-transition);
  background-color: var(--aa-background);
  /* Prevent text selection */
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.help-nav-title:hover {
  background-color: var(--aa-background-light);
}

.help-nav-icon {
  margin-right: 12px;
  font-size: 18px;
}

.help-nav-arrow {
  transition: transform 0.3s ease;
  color: var(--aa-primary);
  font-weight: bold;
}

.help-nav-section.expanded .help-nav-arrow {
  transform: rotate(180deg);
}

.help-nav-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none; /* Completely hide when collapsed */
  background-color: var(--aa-background-light);
  border-radius: 0 0 8px 8px;
}

.help-nav-section.expanded .help-nav-items {
  display: block; /* Show when expanded */
  padding: 8px 0; /* Add padding when expanded */
  animation: slideDown 0.3s ease; /* Smooth animation */
}

/* Animation for smooth expand */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.help-nav-item {
  display: block;
  padding: 12px 20px;
  color: var(--aa-text);
  text-decoration: none;
  font-size: 14px;
  transition: var(--aa-transition);
  border-left: 3px solid transparent;
}

.help-nav-item:hover {
  background-color: var(--aa-background);
  border-left-color: var(--aa-primary);
  color: var(--aa-primary);
}

.help-nav-item.active {
  background-color: var(--aa-primary);
  color: white;
  border-left-color: var(--aa-primary-dark);
}

/* Main Content */
.help-content {
  flex: 1;
  padding: 40px;
  min-height: 100vh;
    background-color: #f5ebd1 !important;
  /* Don't set overflow - it breaks sticky positioning */
}

/* Header */
.help-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--aa-border);
}

.help-header h1 {
  color: var(--aa-primary);
  font-size: 2.5rem;
  margin: 0 0 10px 0;
  font-weight: 700;
}

.help-header p {
  color: var(--aa-text-light);
  font-size: 1.2rem;
  margin: 0;
}

/* help main section */
.help-main-section {
  padding-top: 30px;
  padding-bottom: 30px;
  background-color: #f5ebd1 !important;
}

/* Help Sections */
.help-section {
    background-color: var(--aa-background);
    border-radius: 12px;
    padding: 0 20px;  /* Only horizontal padding */
    margin-bottom: 10px;
    box-shadow: var(--aa-shadow);
    transition: var(--aa-transition);
}

/* Title spacing */
.help-section-title {
    color: var(--aa-primary);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    scroll-margin-top: 100px;
    margin: 0;
    padding: 20px 0;  /* Consistent vertical padding */
    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Help Steps */
.help-step {
    margin: 0;
    padding: 25px;
    background-color: var(--aa-background-light);
    border-radius: 8px;
    border-left: 4px solid var(--aa-primary);
}

/* Help step container */
.help-step-container {
    display: none;
    padding: 0 0 20px 0;  /* Bottom padding for expanded state */
}

/* Space between title and step when expanded */
.help-section-title[aria-expanded="true"] + .help-step-container {
    display: block;
    /* Fixed margin that won't be affected by media queries */
    margin-top: 20px !important;
}

/* Override any existing media queries that might affect spacing */
@media (max-width: 768px) {
    .help-section-title,
    .help-step-container {
        padding: 0px 0 !important;
    }
    
    .help-section-title[aria-expanded="true"] + .help-step-container {
        margin-top: 20px !important;
    }
}

/* Instructions */
.help-instructions {
  width: 100%; /* Ensure full width */
}

.help-instructions ol {
  padding-left: 20px;
  margin: 0 0 15px 0;
  width: 100%; /* Ensure full width */
}

.help-instructions li {
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--aa-text);
  position: relative;
  padding-right: 40px; /* Space for image icon */
  width: 100%;
  box-sizing: border-box;
}

.help-instructions li .step-content {
  display: inline;
  word-wrap: break-word;
}

.help-instructions li strong {
  color: var(--aa-primary);
}

/* Step Image Icons */
.help-step-image-icon {
  position: absolute;
  right: 8px;
  top: 0;
  cursor: pointer;
  color: var(--aa-primary);
  transition: var(--aa-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--aa-background-light);
  border: 1px solid var(--aa-border);
}

.help-step-image-icon:hover {
  background-color: var(--aa-primary);
  color: white;
  transform: scale(1.1);
}

.help-step-image-icon .material {
  font-size: 16px;
}

/* Tips */
.help-tip {
  background-color: #e3f2fd;
  border: 1px solid #bbdefb;
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(9, 57, 89, .8);
}

.help-tip strong {
  color: #0d47a1;
}

/* Screenshots */
.help-screenshot-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.help-screenshot {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--aa-shadow);
  cursor: pointer;
  transition: var(--aa-transition);
  border: 2px solid transparent;
}

.help-screenshot:hover {
  box-shadow: var(--aa-shadow-hover);
  transform: scale(1.05);
  border-color: var(--aa-primary);
}

/* Full-screen image modal */
.help-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.help-image-modal.show {
  opacity: 1;
}

.help-image-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-image-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.help-image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--aa-transition);
  z-index: 10001;
}

.help-image-modal-close:hover {
  background: white;
  transform: scale(1.1);
}

.help-image-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--aa-transition);
  z-index: 10001;
}

.help-image-modal-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.help-image-modal-nav.prev {
  left: 20px;
}

.help-image-modal-nav.next {
  right: 20px;
}

.help-image-modal-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.help-image-modal-nav:disabled:hover {
  transform: translateY(-50%) scale(1);
}

/* Image counter */
.help-image-modal-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10001;
}

/* Mobile Toggle Button */
.help-mobile-toggle {
  display: none;
  position: fixed;
  top: 90px;
  left: 10px;
  z-index: 1003;
  background-color: var(--aa-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--aa-shadow-hover);
  transition: var(--aa-transition);
}

.help-mobile-toggle:hover {
  background-color: var(--aa-primary-dark);
  transform: scale(1.1);
}

.help-mobile-toggle.sidebar-open {
   width: 24px;
  height: 24px;
  top: 94px !important; /* 80px (nav) - 16px (half button height) = center on corner */
  left: 291px !important; /* 320px sidebar - 16px (half button width) = center on corner */
  background-color: var(--aa-error);
  font-size: 12px;
}

.help-mobile-toggle.sidebar-open:hover {
  background-color: #ed562c;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .help-step-content {
    display: block;
    width: 100%;
  }

  .help-content {
    padding: 20px;
  }
}

/* Image navigation buttons */
.help-image-nav-button {
  /* Base styles - can be overridden */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  z-index: 10002;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.help-image-nav-icon {
  color: #333;
  line-height: 1;
  font-size: 32px; /* Default desktop size */
}

/* Image step badge */
.help-image-step-badge {
  font-family: 'RobotoCondensed-VariableFont_wght';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--aa-primary, #26aef2);
  color: white;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: normal;
  white-space: nowrap;
  max-width: 90vw;
  z-index: 10002;
  border: 3px solid rgb(245, 248, 248);
}

/* Desktop navigation buttons */
@media (min-width: 769px) {
  .help-image-nav-button {
    width: 50px;
    height: 50px;
  }

  .help-image-nav-prev {
    left: -25px;
    padding-bottom: 8px !important;
  }

  .help-image-nav-next {
    right: -25px;
    padding-bottom: 8px !important;
  }

  .help-image-nav-button:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
  }
}

@media (max-width: 768px) {
  /* Mobile navigation buttons */
  .help-image-nav-button {
    width: 40px;
    height: 40px;
  }

  .help-image-nav-prev {
    left: -20px;
  }

  .help-image-nav-next {
    right: -20px;
  }

  .help-image-nav-icon {
    font-size: 32px !important;
    font-weight: 800;
  }

  .help-container {
    flex-direction: column;
    align-items: stretch; /* Reset align-items on mobile */
  }

  .help-sidebar {
    position: fixed;
    top: 90px;
    left: -320px;
    height: calc(
      100vh - 80px - 60px
    ); /* Reserve 60px for Android navigation bar */
    transition: left 0.3s ease;
    z-index: 1002;
    align-self: auto; /* Reset sticky behavior on mobile */
    padding-bottom: 20px; /* Extra padding at bottom */
  }

  .help-sidebar.open {
    left: 0;
    /* Prevent body scroll when sidebar is open */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .help-content {
    padding: 15px;
  }

  .help-mobile-toggle {
    display: block;
  }

  /* Ensure close button is positioned correctly on mobile */
  .help-mobile-toggle.sidebar-open {
    top: 64px; /* 80px (nav) - 16px (half button height) = center on corner */
    left: 304px; /* 320px sidebar - 16px (half button width) = center on corner */
  }

  .help-header h1 {
    font-size: 2rem;
  }

  .help-header p {
    font-size: 1rem;
  }

  .help-section {
    padding: 20px;
  }

  .help-step {
    padding: 15px;
  }

  .help-screenshot {
    max-width: 100%;
  }
}
