/* Sidebar Styles */

.sidebar {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 2000;
  /* Ensure above topBar and other elements */
  top: 0;
  left: 0;
  background-color: var(--bg-secondary);
  overflow-x: hidden;
  transition: width 0.4s ease;
  /* Smoother transition */
  padding-top: 60px;
  box-shadow: var(--card-shadow);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

.sidebar p {
  padding: 8px 20px 4px 20px;
  text-decoration: none;
  font-size: 0.9em;
  color: var(--text-primary);
  display: block;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.sidebar label {
  font-weight: normal;
  color: var(--text-secondary);
}

.sidebar .closebtn {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 32px;
  margin-left: 50px;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1;
  transition: color 0.2s;
}

.sidebar .closebtn:hover {
  color: #111;
}

.slidecontainer {
  padding: 5px 20px 15px 20px;
}

.physicsSlider {
  width: 100%;
  cursor: pointer;
}

hr {
  border: 0;
  border-top: 1px solid #eee;
  margin: 15px 20px;
}

/* Cleanup: Remove .openbtn styles if they conflict with topbar, 
   but specific sidebar buttons might need styling if used inside */

#main {
  transition: margin-left .5s;
  padding: 0;
}

@media screen and (max-height: 450px) {
  .sidebar {
    padding-top: 15px;
  }

  .sidebar a {
    font-size: 18px;
  }
}

/* Sidebar Sections (Data Management, Experimental) */
.sidebar-section {
  margin-top: 20px;
  padding: 15px 20px;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.sidebar-section h3 {
  margin: 0 0 10px 0;
  font-size: 0.85em;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.collapsible-header:hover {
  background-color: var(--bg-secondary);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.chevron {
  font-size: 0.8em;
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.sidebar-section.experimental {
  margin-top: 0;
}

.sidebar-btn {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.reset-btn {
  margin-top: 10px;
  background-color: #fff0f0;
  border-color: #fcc;
  color: #c00 !important;
}

.reset-btn:hover {
  background-color: #fee;
  border-color: #faa;
}

.sidebar-btn:hover {
  background-color: var(--bg-primary);
  border-color: var(--text-secondary);
}

/* Sidebar Controls (Language & Theme) */
.sidebar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.language-switcher {
  display: flex;
  gap: 2px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.lang-btn {
  padding: 4px 12px;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85em;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  min-width: 36px;
}

.lang-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

.lang-btn.active {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  font-weight: 600;
}

.theme-btn {
  padding: 4px 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  line-height: 1;
}

.theme-btn:hover {
  background-color: var(--bg-primary);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.theme-btn:active {
  transform: scale(0.95);
}

/* Photo Info UI (Header Integrated) */
.info-icon-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  color: var(--accent-primary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.info-icon-btn:hover {
  background-color: #bbdefb;
  color: #1565c0;
  border-color: #90caf9;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s;
  justify-content: center;
  align-items: center;
}

/* Ensure privacy modal is above welcome screen */
#privacyModal {
  z-index: 3001;
}

.modal-content {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 30px;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  animation: slideUp 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.5em;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}

.modal-body section {
  margin-bottom: 25px;
}

.modal-body ul {
  padding-left: 20px;
  color: #ccc;
}

.modal-body li {
  margin-bottom: 10px;
}

.patterns-section {
  background-color: #252525;
  padding: 15px;
  border-radius: 8px;
}

.pattern-box {
  margin-bottom: 15px;
}

.pattern-box:last-child {
  margin-bottom: 0;
}

.consolas {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  background-color: #000;
  color: #a5d6a7;
  padding: 4px 8px;
  border-radius: 4px;
  display: block;
  margin-bottom: 5px;
  font-size: 1.1em;
}

.pattern-box small {
  color: #888;
}

.privacy-shield-modal {
  background-color: #1a237e;
  border: 1px solid #283593;
  border-radius: 8px;
  padding: 15px;
  color: #e8eaf6;
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 20px;
}

.privacy-shield-modal .shield-icon {
  font-size: 2em;
}

.privacy-shield-modal strong {
  display: block;
  color: #fff;
  margin-bottom: 5px;
}

.modal-footer {
  margin-top: 30px;
  display: flex;
  justify-content: flex-end;
}

.modal-footer .sidebar-btn {
  width: auto;
  min-width: 100px;
}

.sidebar-info-box {
  display: none;
  margin-top: 10px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  font-size: 0.82em;
  color: #666;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  line-height: 1.4;
}

.sidebar-info-box h4 {
  margin: 0 0 8px 0;
  font-size: 0.95em;
  color: #333;
  font-weight: 600;
}

.sidebar-info-box ul {
  margin: 0 0 12px 0;
  padding-left: 18px;
}

.sidebar-info-box li {
  margin-bottom: 5px;
}

.privacy-shield {
  background-color: #f0f7ff;
  border: 1px solid #cfe5ff;
  border-radius: 5px;
  padding: 10px;
  color: #2c5a85;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.privacy-shield .shield-icon {
  font-size: 1.4em;
  margin-top: -2px;
}

.privacy-shield strong {
  display: block;
  margin-bottom: 3px;
  color: #1a3c5a;
}