/* ==================== */
/* === BBCODE РЕДАКТОР === */
/* ==================== */

.bbcode-editor {
    border: none;
    overflow: hidden;
    background: transparent;
    border-radius: var(--border-radius);
}

.bbcode-toolbar {
    background: var(--nexus-dark);
    border-bottom: var(--border-width) solid var(--nexus-bbcode-border);
    padding: var(--spacing-sm);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.bbcode-btn {
    background: transparent;
    border: var(--border-width) solid var(--nexus-bbcode-border);
    color: var(--nexus-white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.bbcode-btn:hover {
    background: var(--nexus-gold);
    color: var(--nexus-dark);
    border-color: var(--nexus-gold);
}

.bbcode-btn:active {
    transform: scale(0.98);
}

.bbcode-tabs {
    display: flex;
    background: var(--nexus-dark);
    border-bottom: 1px solid #495057;
}

.bbcode-tab {
    background: transparent;
    border: none;
    color: var(--nexus-white);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.bbcode-tab.active {
    color: var(--nexus-gold);
    border-bottom-color: var(--nexus-gold);
}

.bbcode-tab:hover {
    background: rgba(244, 200, 66, 0.1);
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
    padding-right: 0.5rem;
    margin-right: 0.5rem;
    border-right: 1px solid #495057;
}

.toolbar-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.color-picker {
    display: none;
    position: absolute;
    z-index: 1000;
    background: var(--nexus-dark);
    border: 1px solid #495057;
    border-radius: 0.25rem;
    padding: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}

.color-btn {
    width: 20px;
    height: 20px;
    border: 1px solid #495057;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

/* BBCode Preview Styles */

.bbcode-preview {
    background: #2d2d36;
    color: #e0e0e0;
    padding: 1rem;
    border-top: 1px solid #495057;
    min-height: 150px;
    overflow-y: auto;
}

.bbcode-preview b, .bbcode-preview strong { font-weight: bold; }
.bbcode-preview i, .bbcode-preview em { font-style: italic; }
.bbcode-preview u { text-decoration: underline; }
.bbcode-preview s { text-decoration: line-through; }
.bbcode-preview code { 
    background: #2d2d36;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem; 
}
.bbcode-preview pre { 
    background: rgba(255, 255, 255, 0.1); 
    padding: 1rem; 
    border-radius: 0.25rem; 
    overflow-x: auto;
}
.bbcode-preview blockquote { 
    border-left: 3px solid var(--nexus-gold); 
    padding-left: 1rem; 
    margin: 1rem 0; 
    font-style: italic;
}
.bbcode-preview ul, .bbcode-preview ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.bbcode-preview img { max-width: 100%; height: auto; }
.bbcode-preview .spoiler { 
    background: #333; 
    color: #333; 
    padding: 0.2rem 0.4rem; 
    border-radius: 0.25rem; 
    cursor: pointer;
}
.bbcode-preview .spoiler:hover { color: var(--nexus-white); }
.bbcode-preview .center { text-align: center; }

.bbcode-dropdown {
  position: absolute;
  z-index: 1000;
  min-width: 150px;
  padding: 5px 0;
  border: 1px solid #35353c;
  border-radius: 0.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  color: var(--nexus-white);
  background: #23232a;
}

.bbcode-dropdown-item {
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  background-color: transparent;
  transition: background 0.2s, color 0.2s;
  font-size: 0.95rem;
  color: #d2d1d6;
}

.bbcode-dropdown-item:hover {
  background-color: #35353c;
  color: var(--nexus-gold);
}

.bbcode-dropdown-color-box {
  width: 20px;
  height: 20px;
  border: 1px solid #35353c;
  border-radius: 3px;
}

.bbcode-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.5);
  z-index: 1500;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bbcode-modal {
  background: #23232a;
  border-radius: 8px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bbcode-modal-header {
  color: var(--nexus-gold);
  margin: 0 0 10px 0;
}

.bbcode-modal-input {
  padding: 8px;
  font-size: 16px;
  border: 1px solid var(--nexus-gold);
  border-radius: 4px;
  background: #18181e;
  color: var(--nexus-white)
}

.bbcode-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.bbcode-modal-btn {
  padding: 6px 12px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
}

.bbcode-modal-btn-cancel {
  background-color: #666;
  color: var(--nexus-white);
}

.bbcode-modal-btn-ok {
  background-color: var(--nexus-gold);
  color: var(--nexus-dark);
}

/* BBCode Preview Styles */
.bbcode-preview-code {
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bbcode-preview-quote {
  border-left: 4px solid var(--nexus-gold);
  margin: 10px 0;
  padding-left: 15px;
  font-style: italic;
  color: var(--nexus-white);
}

.bbcode-preview-image {
  max-width: 100%;
  height: auto;
}

.bbcode-preview-link {
  color: #f0c040;
  text-decoration: none;
}

.bbcode-preview-link:hover {
  text-decoration: underline;
}

.bbcode-align-left {
  text-align: left;
}

.bbcode-align-center {
  text-align: center;
}

.bbcode-align-right {
  text-align: right;
}

.bbcode-spoiler {
  border: 1px solid #444;
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
  background-color: #2a2a33;
  color: #ddd;
}

.bbcode-spoiler-header {
  background-color: #23232a;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
  border-bottom: 1px solid #444;
  color: var(--nexus-gold);
  transition: background-color 0.2s ease;
}

.bbcode-spoiler-header:hover {
  background-color: #2e2e38;
}

.bbcode-spoiler-content {
  display: block;
  padding: 10px 12px;
  background-color: #1d1d24;
  color: #ccc;
}

.bbcode-spoiler-content-hidden {
  display: none !important;
}

.bbcode-output ul {
  list-style-type: disc;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.bbcode-output ol {
  list-style-type: decimal;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.bbcode-output ul ul,
.bbcode-output ol ul {
  list-style-type: circle;
}
.bbcode-output ul ol,
.bbcode-output ol ol {
  list-style-type: lower-latin;
}
.bbcode-output li {
  margin-bottom: 0.2em;
}

/* Адаптивность редактора */
@media (max-width: 576px) {
    .bbcode-toolbar {
        gap: 2px;
    }
    
    .bbcode-btn {
        padding: var(--spacing-xs);
        font-size: var(--font-size-xs);
    }
}