/* ======== HEX VIEW STYLES ======== */
.hex-row {
  display: flex;
  margin-bottom: 4px;
  width: 626px;
  padding: 0 10px;
  box-sizing: border-box;
}

.hex-offset, .hex-values, .hex-chars {
  font-family: monospace;
  font-size: 13px;
}

.hex-offset {
  margin-right: 10px;
  color: var(--text-primary);
}

.hex-values {
  margin-right: 10px;
}

.hex-chars {
  color: var(--text-secondary);
  border-left: 1px solid var(--border-color);
  padding-left: 10px;
}

/* ======== STATUS MESSAGE STYLES ======== */
#status-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--tooltip-bg);
  color: var(--tooltip-text);
  padding: 10px 20px;
  border-radius: 5px;
  display: none;
  z-index: 1000000;
}

/* ======== TOGGLE BUTTONS ======== */
.toggle-btn,
.close-popup,
#file-close {
  background: var(--button-bg);
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  box-shadow: 0 2px 4px var(--shadow-color);
  transition: all 0.2s ease;
  z-index: 100;
}

/* Specific styles for file-close and sidebar-toggle */
#file-close,
#sidebar-toggle {
  background-color: var(--bg-secondary);
  border: 1px solid var(--button-border);
  width: 28px;
  height: 28px;
  box-shadow: 0 2px 4px var(--shadow-color);
}

#file-close:hover,
#sidebar-toggle:hover {
  background-color: var(--button-hover);
}

.toggle-btn:hover,
.close-popup:hover,
#file-close:hover {
  background: var(--button-hover);
}

#file-close:hover,
#sidebar-toggle:hover {
  background: var(--button-hover);
  border-color: var(--accent-color);
}

.toggle-btn i,
.close-popup i,
#file-close i {
  font-size: 16px;
  color: var(--text-secondary);
}

#file-close i,
#sidebar-toggle i {
  font-size: 16px;
  color: var(--text-secondary);
}

.toggle-btn:hover i,
.close-popup:hover i,
#file-close:hover i {
  color: var(--text-primary);
}

#file-close:hover i,
#sidebar-toggle:hover i {
  color: var(--accent-color);
}

/* ======== HISTORY ENTRY STYLES ======== */
.history-entry {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.history-entry:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.history-entry-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-primary);
}

.history-entry .conversation-description {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9em;
  font-family: monospace;
}

.history-entry .timestamp {
  color: var(--text-secondary);
  font-size: 0.85em;
  margin-left: auto;
}

.history-entry .load-history-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s ease;
}

.history-entry .load-history-btn:hover {
  background: var(--accent-hover);
}

/* ======== POPUP STYLES ======== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--shadow-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}

.popup-content {
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
  width: 90%;
  max-width: 600px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.popup-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 2;
}

.popup-header h2 {
  margin: 0;
  font-size: 1.5em;
}

/* ======== TAB STYLES ======== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  position: sticky;
  top: 64px;
  z-index: 1;
}

.tab-btn {
  padding: 15px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1em;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.tab-content {
  display: none;
  padding: 20px;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.tab-content.active {
  display: block;
  background: var(--bg-secondary);
}

#general-tab,
#history-tab,
#instructions-tab,
#storage-tab {
  overflow-y: auto;
  height: calc(80vh - 200px);
  padding: 20px;
  margin: 0;
  box-sizing: border-box;
  max-width: 100%;
}

#general-tab::-webkit-scrollbar,
#history-tab::-webkit-scrollbar {
  width: 8px;
}

#general-tab::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 4px;
}

#general-tab::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

#general-tab::-webkit-scrollbar-thumb:hover {
  background: var(--hover-bg);
}

/* Auto-save feedback */
.settings-saved-feedback {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--status-success);
  color: var(--bg-secondary);
  padding: 10px 20px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1100;
}

.settings-saved-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

/* Global font settings */
:root {
  --current-font: 'Lexend';
  --current-font-size: 14px;
}

/* Apply font globally but exclude Font Awesome */
body,
#main-content,
.popup-content,
.font-preview,
input,
button:not([class*="fa"]),
select,
textarea {
  font-family: var(--current-font, 'Lexend');
  font-size: var(--current-font-size, 14px);
}

/* Ensure monospace fonts are preserved where needed */
.hex-offset,
.hex-values,
.hex-chars,
pre,
code {
  font-family: monospace;
}

/* Preserve Font Awesome */
[class*="fa"] {
  font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands' !important;
}

.popup-menu {
  position: absolute;
  right: 20px;
  bottom: calc(100% + 10px);
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-color);
  padding: 15px;
  min-width: 200px;
  z-index: 1000;
}

.menu-btn:hover {
  background: var(--button-hover);
}