/* ==========================================================================
   UAXOR — Ultra-Secure BBCode & Editor Styling
   ========================================================================== */

/* --- BBCode Rendered Content Styles --- */
.bb-link {
    color: #38bdf8;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}
.bb-link:hover {
    color: #7dd3fc;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.bb-img-wrapper {
    margin: 12px 0;
    display: inline-block;
    max-width: 100%;
}
.bb-img {
    max-width: 100%;
    max-height: 520px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    display: block;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.bb-img:hover {
    border-color: #38bdf8;
    transform: scale(1.01);
}
.bb-img-error {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px dashed rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    color: #fca5a5;
    font-size: 11px;
    margin: 8px 0;
}

/* Quote Box */
.bb-quote {
    margin: 16px 0;
    padding: 0;
    background: rgba(15, 23, 42, 0.75);
    border-left: 3px solid #38bdf8;
    border-radius: 0 8px 8px 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.bb-quote-header {
    background: rgba(56, 189, 248, 0.08);
    padding: 9px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}
.bb-quote-header b {
    color: #e2e8f0;
}
.bb-quote-body {
    padding: 14px 18px;
    color: #cbd5e1;
    font-style: italic;
    line-height: 1.65;
}
.bb-quote-body > :first-child { margin-top: 0; }
.bb-quote-body > :last-child { margin-bottom: 0; }

/* Code Block */
.bb-code-wrapper {
    margin: 16px 0;
    background: #050911;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
.bb-code-lang {
    background: #0c1422;
    padding: 6px 14px;
    font-size: 10px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 1px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bb-code {
    margin: 0;
    padding: 14px 18px;
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12.5px;
    color: #7dd3fc;
    overflow-x: auto;
    line-height: 1.6;
}
.bb-code code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

/* Spoiler / Collapsible */
.bb-spoiler {
    margin: 16px 0;
    background: rgba(13, 20, 31, 0.9);
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
}
.bb-spoiler-summary {
    cursor: pointer;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.08);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
}
.bb-spoiler-summary:hover {
    background: rgba(245, 158, 11, 0.14);
}
.bb-spoiler-summary::-webkit-details-marker { display: none; }
.bb-spoiler-hint {
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: auto;
}
.bb-spoiler-content {
    padding: 14px 18px;
    border-top: 1px solid #1e293b;
    background: rgba(0, 0, 0, 0.3);
    color: #edf2f4;
    line-height: 1.6;
}

/* Lists */
.bb-list {
    margin: 10px 0 10px 24px;
    padding: 0;
    color: #edf2f4;
}
.bb-list li {
    margin: 5px 0;
    line-height: 1.55;
}

/* Alignment */
.bb-align-center { text-align: center; }
.bb-align-left { text-align: left; }
.bb-align-right { text-align: right; }
.bb-align-justify { text-align: justify; }


/* ==========================================================================
   UAXOR BBCode Interactive Editor Component
   ========================================================================== */

.uaxor-bb-editor-wrapper {
    background: #070c14;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.uaxor-bb-editor-wrapper:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Toolbar */
.bb-editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #0d1522;
    border-bottom: 1px solid #1e293b;
}

.bb-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.bb-btn {
    background: #141f2e;
    border: 1px solid #243447;
    color: #94a3b8;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1;
}
.bb-btn:hover {
    background: #1e2d42;
    color: #38bdf8;
    border-color: #38bdf8;
}
.bb-btn:active {
    transform: translateY(1px);
}
.bb-btn.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #38bdf8;
}

.bb-btn-preview {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    font-weight: 700;
}
.bb-btn-preview:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #fff;
}
.bb-btn-preview.active {
    background: #38bdf8;
    color: #090e17;
    border-color: #38bdf8;
}

.bb-btn-help {
    color: #8794a6;
}
.bb-btn-help:hover {
    color: #fbbf24;
    border-color: #f59e0b;
}

.bb-toolbar-sep {
    width: 1px;
    height: 18px;
    background: #243447;
    margin: 0 4px;
}

/* Dropdown Menus */
.bb-dropdown-wrap {
    position: relative;
    display: inline-block;
}
.bb-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    background: #0d1522;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
}
.bb-color-palette {
    width: 140px;
}
.bb-color-swatch {
    width: 32px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.bb-color-swatch:hover {
    transform: scale(1.15);
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}
.bb-menu-item {
    display: block;
    width: 100%;
    padding: 6px 10px;
    border: none;
    background: none;
    color: #edf2f4;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.bb-menu-item:hover {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

/* Quick Help Panel */
.bb-editor-help {
    background: #090e17;
    border-bottom: 1px solid #1e293b;
    padding: 12px 16px;
}
.bb-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
    font-size: 11px;
    color: #cbd5e1;
}
.bb-help-grid code {
    background: #141f2e;
    color: #38bdf8;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10.5px;
}

/* Editor Body */
.bb-editor-body {
    position: relative;
}
.bb-editor-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    background: #070c14;
    border: none;
    color: #edf2f4;
    font-size: 13.5px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    outline: none;
    display: block;
}
.bb-editor-textarea::placeholder {
    color: #475569;
}

/* Preview Box */
.bb-editor-preview {
    box-sizing: border-box;
    padding: 18px 20px;
    background: #05080e;
    min-height: 140px;
    max-height: 520px;
    overflow-y: auto;
    color: #edf2f4;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}
.bb-preview-placeholder {
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 30px;
}

/* Status Bar / Footer */
.bb-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #0a101b;
    border-top: 1px solid #1e293b;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
    gap: 8px;
}
.bb-editor-status {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bb-editor-counter {
    color: #94a3b8;
    font-weight: 600;
}
.bb-editor-divider {
    color: #334155;
}

@media (max-width: 640px) {
    .bb-editor-toolbar {
        gap: 3px;
        padding: 6px;
    }
    .bb-btn {
        padding: 4px 6px;
        font-size: 10px;
        min-width: 24px;
        height: 26px;
    }
    .bb-editor-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
