:root {
  --main-bg-color: #111;
  --nav-sidebar-width: 60px;
  --nav-panel-width: 400px;
  --main-action-color:#f63b80;
  --action-delete-color:#dc2626;
  --font-color:#6b7280;
  --main-default-color:#fffded;
  --bg-alpha:rgba(255,255,255,0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    color: var(--font-color);
}


/* Form Elements */
button {
    background:none;
    border: 1px solid #b8bec7;
    color:var(--font-color);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

button:hover,
.active{
    background: var(--main-action-color);
    color:white;
}

button:disabled {
    cursor: not-allowed;
  background:none;
  color: var(--font-color);
}


.delete-button{
  background: var(--action-delete-color);
  color:#fff;
  border-color:var(--action-delete-color);
}

input, textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--main-bg-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}





/* Navigation Container - semantic wrapper only */
.nav-container {
    /* Container is just for semantic HTML structure */
    /* Children use position: fixed and are positioned independently */
}

/* Navigation Sidebar (Icon Menu) */
.nav-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--nav-sidebar-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
    z-index: 1001;
}

.sidebar-icons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.icon-item {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alpha);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}

.icon-item:hover {
    background: rgba(255, 255, 255, 0.8);
}

.icon-item.active {
    background: var(--main-action-color);
    color: white;
}

.icon-item.active::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid var(--main-action-color);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Navigation Panel (Detail Panel) */
.nav-panel {
    position: fixed;
    left: var(--nav-sidebar-width);
    top: 1vh;
    top: 1dvh;
    width: var(--nav-panel-width);
    height: 98vh;
    height: 98dvh;
    background: rgba(255,255,255,0.75);
    border-radius:12px;
    transform: translateX(-120%);
    transition: transform 0.3s ease;
    overflow: hidden;
    z-index:10;
    backdrop-filter: blur(10px);
}

.nav-panel.open {
    transform: translateX(0);
  
}

.panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-button:hover {
    background:none;
    color:var(--main-action-color);
}

.panel-body {
    flex: 1;
    overflow: hidden;
    padding: 1rem 1rem 80px 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    min-height: 0;
}

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Main Content */
.main-content {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.item-container {
    background: rgba(255,255,255,0.3);
    /* border: 1px solid #e2e8f0; */
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height:1.4;
    position: relative;
}
.item-container.default-item:hover {
    border-color: var(--main-bg-color);
}

.item-container.default-item {
    border-color: var(--main-bg-color);
    background: var(--main-default-color);
}

.item-container.active:hover {
    background: #e0f2fe;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
}
.ui-control-with-button{
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}
.ui-center{
  justify-content: center;
  flex-wrap: wrap;
}

.loading-spinner{
  display: inline-block; 
  margin-left: 4px; 
  width: 12px; 
  height: 12px; 
  border: 2px solid #bfdbfe; 
  border-top: 2px solid #3b82f6; 
  border-radius: 50%; 
  animation: spin 1s linear infinite; 
  vertical-align: middle;
}

#map {
    width: 100%;
    height: 100%;
}

/* Location Search */
.location-search-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    max-width: 400px;
}

#locationSearch {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-size: 0.875rem;
    outline: none;
    transition: box-shadow 0.2s;
}

#locationSearch:focus {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#locationSearch::placeholder {
    color: #9ca3af;
}

#searchResults {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 0.25rem;
    z-index: 1001;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: #f8fafc;
}

.search-result-item.no-results {
    color: #6b7280;
    cursor: default;
    text-align: center;
}

.search-result-item.no-results:hover {
    background-color: transparent;
}

.result-name {
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25;
    margin-bottom: 0.25rem;
}

.result-type {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: capitalize;
}


/* Button Groups */
.toggle-controls {
    display: flex;
    gap: 0.5rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.button-group button {
    width: 100%;
}

/* Search Box */
.search-box {
    margin-bottom: 1rem;
}







.note-title-input {
    width: 100%;
    padding: 0.25rem;
    border: 2px solid var(--main-bg-color);
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: inherit;
    font-family: inherit;
    background: white;
    margin: 0;
}

.note-title-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.note-description {
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.note-description a{
  text-decoration:underline;
}
.note-question{
    border: 1px solid #b8bec7;
    background: none;
    margin: 0 0 0.5rem 0;
    padding: 0.5rem;
    border-radius:9px;
}

.note-coords {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

/* Expansions Section */
.note-expansions-section {
    margin: 0.5rem 0;
}

.note-expansion-item {
    margin-bottom: 0.5rem;
    border-top: 1px solid #b8bec7;
    padding-top: 0.5rem;
}

.note-expansion-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0;
    border-radius: 0.25rem;
}


.expansion-label {
    font-weight: 500;
}

.expansion-arrow {
    font-size: 0.75rem;
    color: #9ca3af;
    transition: transform 0.2s;
}

.note-expansion-content {
    margin-top: 0.5rem;
}

.expansion-text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Instructions Section */
.note-instructions-section {
    margin: 0.5rem 0;
    border-top: 1px solid #b8bec7;
    padding-top: 0.5rem;
}

.note-instructions-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0;
    border-radius: 0.25rem;
}

.note-instructions-toggle:hover {
    /* background-color: #f9fafb; */
}

.instructions-label {
    font-weight: 500;
    color: #6b7280;
}

.instructions-arrow {
    color: #9ca3af;
    transition: transform 0.2s;
}

.note-instructions-content {
    margin-top: 0.5rem;
}


.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.note-actions button {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}


/* Pagination */
.pagination-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
    background: var(--bg-alpha));
    backdrop-filter: blur(10px);
}
.pagination-controls button{
  padding:0.5rem;
  font-size:0.75rem;
}
.pagination-controls button.active{
  background:none;
  color:var(--font-color);
  text-decoration:underline;
}

#paginationInfo {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-align: center;
}


#instructionsPaginationInfo {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}



/* AI Instructions */
.custom-instruction-area {
    margin-bottom: 1rem;
}

.custom-instruction-area textarea {
    min-height: 120px;
    font-size: 0.875rem;
    resize: none;
    overflow: hidden;
}

.instruction-status {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}



.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #b8bec7;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span:first-child {
    color: #6b7280;
    font-size: 0.875rem;
}

.stat-item span:last-child {
    font-weight: 500;
    font-size: 0.875rem;
}

/* Utility Classes */
.ai-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ai-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.pass {
    color: #059669;
}

.fail {
    color: #dc2626;
}

#testResults {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Anchor Link Menu */
.anchor-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 0.25rem;
    z-index: 10000;
    display: none;
    min-width: 180px;
}

.anchor-menu.visible {
    display: block;
}

.anchor-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: background-color 0.15s;
    text-align: left;
}


.anchor-menu-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --nav-panel-width: calc(100vw - var(--nav-sidebar-width));
    }

    .nav-panel.open {
        transform: translateX(0);
    }
}