/* Common styles for campaign notes website */

@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=IM+Fell+English+SC&family=Caveat:wght@400;700&display=swap');

* {
  box-sizing: border-box;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: linear-gradient(to bottom, #3a2c1d 0%, #2a1f15 100%);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #8b7355 0%, #6b5744 100%);
  border-radius: 6px;
  border: 2px solid #2a1f15;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #a88968 0%, #8b7355 100%);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: #8b7355 #2a1f15;
}

body {
  background: #2a1f15;
  font-family: "IM Fell English", Georgia, serif;
  color: #2d1810;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  padding-left: 280px;
}

/* Parchment texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      rgba(139, 115, 85, 0.03) 0px,
      transparent 1px,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 3px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(139, 115, 85, 0.03) 0px,
      transparent 1px,
      transparent 2px,
      rgba(139, 115, 85, 0.03) 3px
    );
  pointer-events: none;
  z-index: 1;
}

/* Sidebar */
aside {
  width: 280px;
  background: linear-gradient(to bottom, #3a2c1d 0%, #2a1f15 100%);
  border-right: 2px solid #8b7355;
  padding: 1.5rem 1rem;
  overflow: hidden;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
}

aside h2 {
  font-family: "IM Fell English SC", "IM Fell English", Georgia, serif;
  color: #d4c4a8;
  font-size: 1.3rem;
  margin: 0 0 1.5rem 0;
  text-align: center;
  letter-spacing: 0.1em;
  border-bottom: 2px solid #8b7355;
  padding-bottom: 0.5rem;
  flex-shrink: 0;
}

/* Sidebar content container with scrolling */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  margin-bottom: 1rem;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-list li {
  margin-bottom: 0.5rem;
  width: calc(100% - 4px);
}

.sidebar-list a {
  display: block;
  padding: 0.8rem;
  color: #d4c4a8;
  text-decoration: none;
  background: rgba(139, 115, 85, 0.1);
  border: 1px solid rgba(139, 115, 85, 0.3);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sidebar-list a:hover {
  background: rgba(139, 115, 85, 0.2);
  border-color: #8b7355;
  transform: translateX(4px);
}

.sidebar-list a.active {
  background: rgba(139, 0, 0, 0.2);
  border-color: #8b0000;
  color: #f9f4e8;
}

.sidebar-loading,
.sidebar-error {
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  color: #d4c4a8;
  font-style: italic;
}

.sidebar-error {
  color: #ff6b6b;
}

/* Sidebar navigation (bottom) - Dropdown */
.sidebar-nav {
  padding: 1rem 0 0 0;
  margin: 0;
  background: linear-gradient(to bottom, transparent 0%, #2a1f15 20%, #2a1f15 100%);
  border-top: 2px solid #8b7355;
  flex-shrink: 0;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: rgba(139, 0, 0, 0.15);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: 4px;
  color: #d4c4a8;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-dropdown-button:hover {
  background: rgba(139, 0, 0, 0.25);
  border-color: #8b0000;
}

.nav-dropdown.open .nav-dropdown-button {
  background: rgba(139, 0, 0, 0.3);
  border-color: #8b0000;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.nav-dropdown-label {
  font-weight: bold;
  letter-spacing: 0.05em;
}

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

.nav-dropdown.open .nav-dropdown-icon {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  list-style: none;
  padding: 0;
  margin: 0 0 -1px 0;
  background: linear-gradient(to bottom, #3a2c1d 0%, #2a1f15 100%);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  overflow: hidden;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li {
  margin: 0;
  border-bottom: 1px solid rgba(139, 115, 85, 0.2);
}

.nav-dropdown-menu li:last-child {
  border-bottom: none;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.8rem 1rem;
  color: #d4c4a8;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 0;
  transition: all 0.2s ease;
  transform: none;
}

.nav-dropdown-menu a:hover {
  background: rgba(139, 115, 85, 0.2);
  transform: none;
  padding-left: 1.3rem;
}

.nav-dropdown-menu a.active {
  background: rgba(139, 0, 0, 0.3);
  color: #f9f4e8;
  font-weight: bold;
}

/* Tooltips */
.tooltip {
  position: fixed;
  background: linear-gradient(to bottom, #f9f4e8 0%, #f0e6d8 100%);
  border: 2px solid #8b7355;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: none;
  max-width: 300px;
}

.tooltip.visible {
  display: block;
}

.tooltip-title {
  font-size: 1rem;
  color: #3a1e0e;
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-align: center;
}

.tooltip-divider {
  border-bottom: 1px solid #b89655;
  margin-bottom: 0.5rem;
}

.tooltip-info {
  font-size: 0.9rem;
  color: #5d4a33;
  text-align: center;
  white-space: pre-line;
}

/* Main content area */
main {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Page container (parchment) */
.page {
  background: 
    linear-gradient(135deg, rgba(255, 249, 235, 0) 0%, rgba(210, 180, 140, 0.1) 100%),
    linear-gradient(to bottom, #f9f4e8 0%, #f5ede0 50%, #f0e6d8 100%);
  padding: 3rem 2.5rem;
  border: 2px solid #8b7355;
  box-shadow: 
    0 0 0 1px #d4c4a8 inset,
    0 10px 40px rgba(0, 0, 0, 0.5),
    0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  border-radius: 4px;
}

/* Decorative corners */
.page::before,
.page::after {
  content: '✦';
  position: absolute;
  font-size: 1.2rem;
  color: #8b7355;
  opacity: 0.6;
}

.page::before {
  top: 1rem;
  left: 1rem;
}

.page::after {
  top: 1rem;
  right: 1rem;
}

/* Page title */
h1 {
  font-family: "IM Fell English SC", "IM Fell English", Georgia, serif;
  font-size: 2.5rem;
  margin: 0 0 0.3rem 0;
  color: #3a1e0e;
  text-align: center;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 2px rgba(139, 115, 85, 0.3);
  border-bottom: 3px double #8b7355;
  padding-bottom: 0.8rem;
}

/* Loading and error states */
.loading {
  text-align: center;
  padding: 3rem;
  font-style: italic;
  color: #8b7355;
}

.error {
  background: rgba(139, 0, 0, 0.1);
  border: 1px solid #8b0000;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 4px;
  color: #4a0000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    padding-left: 0;
  }

  aside {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 2px solid #8b7355;
    max-height: 300px;
    padding-bottom: 1rem;
  }

  .sidebar-nav {
    margin: 0 -1rem -1rem -1rem;
  }

  .nav-dropdown-menu {
    bottom: auto;
    top: 100%;
    margin: -1px 0 0 0;
    border-top: none;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .nav-dropdown.open .nav-dropdown-button {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  main {
    padding: 1rem;
  }

  .page {
    padding: 2rem 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  aside {
    padding: 1rem 0.5rem;
  }

  .page {
    padding: 1.5rem 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }
}