/* =========================================
   GLOBAL & LAYOUT
========================================= */
.chat-header > div {
  min-width: 100%;
}

.sidebar.open {
  right: 1px;
}

/* =========================================
   JOURNAL (editor.js)
========================================= */
.journal-editor-popup {
  height: 100%;
  background: transparent;
  margin: 0px 5px 5px 5px;
}

/* --- The Main Toolbar Capsule --- */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  background-color: #262626;
  border-radius: 50px;
  border: 0px solid #3a3a3a;
  width: fit-content; 
  padding: 5px;
  gap: 5px;
  margin: 15px 45px 0px 5px; 
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (min-width: 940px) {
  .editor-toolbar {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px;
    gap: 5px;
    margin: 15px 5px 0px 5px; 
  }
}

/* --- Group Groupings --- */
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-group.dark {
  background-color: #1c1c1e;
  border-radius: 20px;
  padding: 2px 5px;
}

.toolbar-group.light {
  padding: 0;
}

/* --- Toolbar Buttons --- */
.editor-toolbar button {
  position: relative;
  background: transparent;
  border: none;
  color: #8e8e93;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}

.editor-toolbar button:hover {
  color: #fff;
  background-color: #4d4d4d;
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.editor-toolbar button:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  background-color: #2c2c2e;
}

.editor-toolbar button.text-btn {
  font-weight: 700;
  font-size: 13px;
}

/* --- Tooltips --- */
.editor-toolbar button::before {
  content: "";
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  width: 8px;
  height: 8px;
  background-color: #1c1c1e;
  border-top: 1px solid #3a3a3a;
  border-left: 1px solid #3a3a3a;
  transform: translateX(-50%) translateY(-4px) rotate(45deg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: var(--z-dropdown);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.editor-toolbar button:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) rotate(45deg);
}

.editor-toolbar button::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background-color: #1c1c1e;
  color: #e0e0e0;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--terminal-font, sans-serif);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  white-space: nowrap;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: var(--z-dropdown);
}

.editor-toolbar button:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- Text Area --- */
#popup-editor {
  background: transparent;
  border: none;
  width: 100%;
  padding: 5px;
  font-size: 16px;
  font-family: var(--terminal-font);
  color: #e0e0e0;
  resize: none;
  outline: none;
  line-height: 1.5;
}

#popup-editor::placeholder {
  color: #444;
  font-style: italic;
}

/* --- Footer Actions --- */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: left;
  padding: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.editor-actions button {
  flex: 1 1 auto;
}

@media (min-width: 940px) {
  .editor-actions {
    justify-content: space-between;
    padding: 5px;
  }
  .editor-actions button {
    flex: initial;
  }
}

/* --- Word Count Circle --- */
.word-count-circle {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 3px solid #444;
  background-color: #1a1a1a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--terminal-font);
  font-weight: bold;
  font-size: 14px;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.word-count-circle.empty {
  border-color: #555;
  color: #777;
}

.word-count-circle.safe {
  border-color: #4caf50;
  color: #ccc;
}

.word-count-circle.warning {
  border-color: #ffeb3b;
  color: #ffeb3b;
}

.word-count-circle.danger {
  border-color: #f44336;
  color: #f44336;
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(244, 67, 54, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

/* --- Publish Button --- */
#popup-save {
  font-family: var(--terminal-font);
  background-color: #c7c7cc;
  color: #000;
  border: none;
  border-radius: 16px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  margin-right: 10px;
  transition: all 0.15s ease;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

#popup-save:hover {
  background-color: var(--color-secondary);
  transform: translateY(0px);
  box-shadow:
    0 6px 8px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

#popup-save:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* --- Editor Status --- */
#popup-status {
  font-size: 12px;
  margin-top: 5px;
  min-height: 15px;
}

.editor-status-message.success {
  color: var(--color-success);
  margin-left: 5px;
}

.editor-status-message.error {
  color: var(--color-error);
  margin-left: 5px;
}

.editor-status-message.info {
  color: var(--color-info);
  margin-left: 5px;
}

/* --- Rich Text Editor --- */
.rich-text-editor {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  border: 0px solid #444;
  color: #ccc;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  font-family: var(--terminal-font);
}

.rich-text-editor div:empty::before {
  content: "\feff";
}

/* =========================================
   SUPPORT AND ABOUT (shell.js)
========================================= */
#popup-window {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  display: none;
  justify-content: center;
  align-items: center;
  background: var(--popup-modal-bg);
  z-index: var(--z-modal);
  overflow: hidden;
  backdrop-filter: blur(1px);
}

#popup-window .window-box {
  position: relative;
  width: 100dvw;
  height: 100dvh;
  max-height: 90dvh;
  background: var(--popup-modal-fg);
  overflow-y: auto;
  border: 1px solid var(--window-border);
  border-radius: 15px;
  margin: 10px;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

@media (min-width: 940px) {
  #popup-window .window-box {
    width: 90vw;
    height: auto;
    border-radius: var(--window-border-radius);
    margin: 0;
  }
}

#popup-window .window-box::-webkit-scrollbar {
  width: 8px;
}

#popup-window .window-box::-webkit-scrollbar-thumb {
  background: #000;
  border-radius: 4px;
}

#popup-window textarea {
  width: 100%;
  height: 15dvh;
  resize: none;
  background: #000;
  color: var(--color-text);
  padding: 1rem;
  border: 0px solid var(--terminal-border);
  font-family: var(--terminal-font, monospace);
  box-sizing: border-box;
}

#popup-window .window-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #000;
  background-color: transparent;
  font-size: 1.8em;
  cursor: pointer;
}

.window-content {
  flex: 1;
  width: 100%;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
}

.window-content iframe,
#popup-window .window-box iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* --- Support Box --- */
.innertel-support-box {
  padding: 15px;
  border-top: 0px solid #333;
}

.innertel-support-box h2 {
  margin-top: 0;
  margin-bottom: 80px;
  font-size: 1.5rem;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.innertel-support-box a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.innertel-support-box a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

.support-list {
  list-style-type: none;
  padding: 0;
  margin: 0 0 0px 0;
}

.support-list li {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.info-label {
  font-weight: bold;
  margin-right: 10px;
  min-width: 110px;
  color: var(--color-text);
}

.info-label i {
  margin-right: 0px;
  color: var(--color-text);
  width: 16px;
  text-align: center;
}

.footer_text {
  display: block;
  color: var(--color-text);
  font-weight: bold;
  border-top: 1px dashed #333;
  padding-top: 10px;
}

/* --- About Box --- */
.innertel-about-box {
  padding: 10px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--color-text);
  font-family: var(--font-primary);
}

.innertel-about-box h3 {
  margin: 0;
  font-family: INNERTEL, monospace;
  font-size: 2.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1;
}

.innertel-about-box .version {
  margin-top: 5px;
  margin-bottom: 25px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #888;
}

.innertel-about-box a.cmd-link {
  color: var(--color-cmd);
  font-weight: bold;
  text-decoration: none;
  margin-left: 6px;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.innertel-about-box a.cmd-link:hover {
  background: var(--accent-color);
  color: #000;
}

.about-grid {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 15px;
  row-gap: 6px;
  margin-bottom: 115px;
  font-size: 0.9rem;
}

.about-grid .label {
  text-align: right;
  font-weight: 600;
  color: var(--color-text);
}

.about-grid .value {
  text-align: left;
  color: #b3b3b3;
  font-family: var(--font-mono);
}

.about-btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.5);
  color: white;
  padding: 6px 16px;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: background 0.2s;
  margin-bottom: 30px;
}

.about-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.about-footer {
  font-size: 0.75rem;
  color: #666;
  font-family: SF Mono, monospace;
}

.about-footer .heart {
  color: #ff5555;
  font-size: 0.8rem;
}

.about-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: bold;
}

.about-footer a:hover {
  text-decoration: underline;
}

/* =========================================
   Username Confirmation Modal (os.js)
========================================= */
.username-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(5px);
}

.username-confirm-modal {
  background: var(--terminal-bg-color, #0a0a0a);
  border: 1px solid var(--accent-color-b, #000);
  border-radius: 28px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  color: var(--custom-text-color, #e0e0e0);
  font-family: var(--terminal-font, monospace);
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  text-align: center;
}

.username-confirm-title {
  margin-top: 0;
  color: var(--accent-color-b, #000);
}

.username-confirm-desc {
  font-size: 14px;
  margin-bottom: 20px;
}

.username-confirm-input-group {
  margin-bottom: 20px;
}

.username-confirm-label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: #888;
}

.username-confirm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #444;
  border-radius: 10px;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  text-align: center;
}

.username-confirm-error {
  color: #ff4444;
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

.username-confirm-btn {
  background: var(--accent-color-b, #00ffcc);
  color: #000;
  border: none;
  padding: 12px 24px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  text-transform: uppercase;
  border-radius: 12px;
}