/* CSS Variables */
:root {
  --inklory-blue: #2a5298;
  --inklory-blue-hover: rgba(42, 82, 152, 0.1);
  --inklory-blue-shadow: rgba(42, 82, 152, 0.1);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #86868B;
  --background-primary: #ffffff;
  --background-secondary: #F2F2F7;
  --background-tertiary: #F5F5F7;
  --border-color: #D1D1D6;
  --hover-background: #F0F0F0;
  --clear-button: #C7C7CC;
  --clear-button-hover: #A8A8A8;
}

/* Mobile Header - nur auf Desktop versteckt */
.mobile-sidebar-header {
  display: none;
}

/* Sidebar */
.definitions-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-background);
    border-right: 1px solid var(--border-color);
    height: calc(100vh - 96px);
    max-height: calc(100vh - 96px);
    position: sticky;
    top: 96px;
    display: block;
    z-index: 999;
    overflow: hidden;
    transition: width 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(0);
    opacity: 1;
}
  
.definitions-sidebar.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.sidebar-content {
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/*Sidebar Filter (Bottom) */
.sidebar-filter {
    height: 71px;
    padding: 0 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--sidebar-background);
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    position: sticky;
    bottom: 0;
    width: 452px;
    z-index: 1001;
    margin-top: auto;
    transition: height 0.3s ease;
  }
  
  .sidebar-filter.expanded {
    height: 160px;
    align-items: flex-start;
    padding-top: 16px;
  }
  
  .filter-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }
  
  .filter-tabs {
    display: none;
    background: var(--background-secondary);
    border-radius: 12px;
    padding: 4px;
    width: 100%;
  }
  
  .sidebar-filter.expanded .filter-tabs {
    display: flex;
  }
  
  .filter-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-medium);
    background: transparent;
    border: none;
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: var(--font-family-text);
    text-align: center;
  }
  
  .filter-tab.active {
    background: white;
    color: var(--inklory-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  .filter-tab:hover:not(.active) {
    color: var(--text-primary);
  }
  
  .filter-input-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
  }
  
  .filter-input-container {
    display: flex;
    align-items: center;
    background: var(--search-background);
    border: 1px solid var(--border-color);
    border-radius: 19px;
    padding: 0 12px;
    gap: 8px;
    width: 350px;
    height: 38px;
    flex-shrink: 0;
    transition: all 0.3s ease;
  }
  
  .sidebar-filter.expanded .filter-input-container {
    width: 100%;
    border-radius: 12px;
    height: 44px;
    border-color: var(--inklory-blue);
    box-shadow: 0 0 0 3px var(--inklory-blue-shadow);
  }
  
  .filter-hamburger {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
  }
  
  .filter-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--font-size-caption);
    flex: 1;
    color: var(--text-primary);
    font-family: var(--font-family-text);
    height: 100%;
  }
  
  .sidebar-filter.expanded .filter-input {
    font-size: 15px;
  }
  
  .filter-input::placeholder {
    color: var(--text-secondary);
  }
  
  .filter-clear {
    display: none;
    background: var(--clear-button);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
  }
  
  .filter-clear:hover {
    background: var(--clear-button-hover);
  }
  
  .filter-input-container.has-content .filter-clear {
    display: flex;
  }
  
  .filter-shortcut-button {
    background: var(--background-primary);
    color: var(--text-secondary);
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-weight: 500;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
  }
  
  .filter-shortcut-button svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
  }
  
  .sidebar-filter.expanded .filter-shortcut-button {
    display: none;
  }
  
  .filter-shortcut-button:hover {
    background: var(--background-tertiary);
  }
  
  .filter-shortcut-button:hover svg {
    color: var(--text-primary);
  }
  
  /*Terms List */
  .terms-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 20px;
  }
  
  .term-item {
    display: flex;
    align-items: center;
    padding: 0 20px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 412px;
    height: 42px;
    border-radius: 21px;
    margin-left: 20px;
    margin-bottom: 6px;
  }
  
  .term-item:hover {
    background-color: var(--hover-background);
  }
  
  .term-item.active {
    background-color: var(--inklory-blue);
    color: white;
  }
  
  .term-item.active .term-icon {
    color: white;
  }
  
  .term-icon {
    width: 16px;
    height: 16px;
    margin-right: 10px;
    color: var(--text-secondary);
    flex-shrink: 0;
  }
  
  .term-title {
    font-size: 17px;
    font-weight: 400;
    color: var(--text-primary);
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    line-height: 1.2;
  }
  
  .term-item.active .term-title {
    color: white;
  }
  
  /* Category Navigation */
  .category-item {
    display: flex;
    align-items: center;
    padding: 0 20px;
    cursor: pointer;
    height: 50px;
    border-radius: 25px;
    margin: 0 20px 8px 20px;
    width: 412px;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
    gap: 12px;
  }
  
  .category-item:hover {
    background-color: var(--hover-blue);
    color: var(--primary-blue);
  }
  
  .category-item:hover .category-icon,
  .category-item:hover .category-name,
  .category-item:hover .category-description {
    color: var(--inklory-blue);
  }
  
  .category-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
  }
  
  .category-info {
    flex: 1;
    min-width: 0;
  }
  
  .category-name {
    display: block;
    font-size: 17px;
    font-weight: 400;
    color: var(--text-primary);
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    line-height: 1.2;
  }
  
  .category-description {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    margin-top: 2px;
    line-height: 1.2;
  }
  
  /* Back Navigation */
  .back-navigation {
    padding: 12px 20px 8px 20px;
  }
  
  .back-button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--inklory-blue);
    font-size: 17px;
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    padding: 0;
  }
  
  .back-button:hover {
    opacity: 0.7;
  }
  
  .back-icon {
    width: 16px;
    height: 16px;
    color: var(--inklory-blue);
  }
  
  /* Category Detail Header */
  .category-detail-header {
    padding: 4px 20px 4px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    max-height: 30px;
    overflow: hidden;
  }
  
  .category-detail-header h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: -apple-system, "SF Pro Display", "Helvetica Neue", sans-serif;
    line-height: 1.1;
  }
  
  .category-detail-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
    line-height: 1.2;
  }

/* Mobile Layout - Sidebar als Overlay */
@media (max-width: 768px) {
  :root {
    --nav-height-main: 48px;
  }
  
  .definitions-sidebar {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0;
    z-index: 9999;
    border-right: none;
  }
  
  .definitions-sidebar.hidden {
    transform: translateX(-100%);
  }
  
  .definitions-sidebar:not(.hidden) {
    transform: translateX(0);
  }
  
  .sidebar-content {
    height: 100vh;
    padding-top: 0;
    display: flex;
    flex-direction: column;
  }
  
  /* Mobile Sidebar Header */
  .mobile-sidebar-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-primary);
  }
  
  .mobile-sidebar-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: -apple-system, "SF Pro Display", "Helvetica Neue", sans-serif;
  }
  
  .mobile-sidebar-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background-secondary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
  }
  
  .mobile-sidebar-close:hover {
    background: var(--background-tertiary);
    color: var(--text-primary);
    transform: scale(1.05);
  }
  
  .mobile-sidebar-close {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .mobile-sidebar-close svg {
    width: 16px;
    height: 16px;
  }
  
  /* Mobile Sidebar Filter */
  .sidebar-filter {
    position: static;
    height: auto;
    padding: 16px 20px;
    width: 100%;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0;
  }
  
  .sidebar-filter.expanded {
    height: auto;
    padding: 16px 20px 20px 20px;
  }
  
  .filter-input-container {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--background-secondary);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .filter-input-container:focus-within {
    background: white;
    box-shadow: 0 0 0 3px var(--inklory-blue-shadow),
                inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: scale(1.02);
  }
  
  .sidebar-filter.expanded .filter-input-container {
    width: 100%;
    height: 48px;
  }
  
  .filter-input {
    font-size: 17px;
    color: var(--text-primary);
    background: transparent;
  }
  
  .filter-input::placeholder {
    color: var(--text-secondary);
    font-size: 17px;
  }
  
  .filter-hamburger {
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
  }
  
  .filter-shortcut-button {
    display: none;
  }
  
  /* Filter Tabs auf Mobile ausblenden */
  .filter-tabs {
    display: none !important;
  }
  
  /* Mobile Terms List */
  .terms-list {
    flex: 1;
    padding: 8px 0 60px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  .term-item,
  .category-item {
    width: calc(100vw - 40px);
    margin: 0 20px 2px 20px;
    height: 52px;
    border-radius: 12px;
    background: transparent;
  }
  
  .term-item {
    height: 48px;
  }
  
  .term-item:hover,
  .category-item:hover {
    background: var(--background-secondary);
    transform: scale(0.98);
  }
  
  .term-item,
  .category-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Mobile Category Items */
  .category-item {
    padding: 0 20px;
    gap: 14px;
  }
  
  .category-icon {
    width: 18px;
    height: 18px;
    color: var(--inklory-blue);
  }
  
  .category-name {
    font-size: 17px;
    font-weight: 400;
  }
  
  .category-description {
    font-size: 13px;
    color: var(--text-secondary);
  }
  
  /* Mobile Term Items */
  .term-icon {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    color: var(--inklory-blue);
  }
  
  .term-title {
    font-size: 17px;
    font-weight: 400;
  }
  
  /* Mobile Back Navigation */
  .back-navigation {
    padding: 16px 20px 12px 20px;
  }
  
  .back-button {
    font-size: 18px;
    gap: 8px;
  }
  
  .back-icon {
    width: 18px;
    height: 18px;
  }
  
  /* Mobile Category Detail Header */
  .category-detail-header {
    padding: 8px 20px 12px 20px;
    margin-bottom: 12px;
  }
  
  .category-detail-header h3 {
    font-size: 22px;
    margin-bottom: 8px;
  }
  
  .category-detail-header p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .definitions-sidebar {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
  }
  
  .mobile-sidebar-header {
    padding: 12px 16px;
  }
  
  .mobile-sidebar-title {
    font-size: 18px;
  }
  
  .mobile-sidebar-close {
    width: 30px;
    height: 30px;
    border-radius: 15px;
  }
  
  .sidebar-filter {
    padding: 12px 16px;
  }
  
  .sidebar-filter.expanded {
    padding: 12px 16px 16px 16px;
  }
  
  .filter-input-container {
    height: 40px;
    border-radius: 10px;
  }
  
  .sidebar-filter.expanded .filter-input-container {
    height: 44px;
  }
  
  .terms-list {
    padding: 6px 0 16px 0;
  }
  
  .term-item,
  .category-item {
    width: calc(100vw - 32px);
    margin: 0 16px 1px 16px;
    height: 48px;
    border-radius: 10px;
  }
  
  .term-item {
    height: 44px;
  }
  
  .category-item {
    padding: 0 16px;
  }
  
  .category-name {
    font-size: 16px;
  }
  
  .category-description {
    font-size: 12px;
  }
  
  .term-title {
    font-size: 16px;
  }
  
  .back-navigation {
    padding: 12px 16px 8px 16px;
  }
  
  .category-detail-header {
    padding: 6px 16px 8px 16px;
  }
  
  .category-detail-header h3 {
    font-size: 20px;
  }
}
