/* ==========================================================================
   ZO Editor content display styles
   Applied to station page read-only content (.content-block).
   The editor-side styles live in suneditor-contents.css (.sun-editor-editable).
   ========================================================================== */

/* --- Inline code --- */
.content-block code:not(.se-code-sample code) {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    padding: 2px 4px;
    margin: 0 2px;
    background-color: var(--BACKGROUND);
    border: 1px solid var(--GRAY);
    border-radius: 3px;
    color: var(--WHITE);
    vertical-align: middle;
    word-break: normal;
    white-space: pre;
}

/* --- Code sample block --- */
.content-block div.se-code-sample {
    display: block;
    padding: 0;
    margin: 0 0 10px;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--WHITE);
    line-height: 1.5;
    background: var(--BACKGROUND);
    border: 1px solid var(--WHITE);
    border-radius: 4px;
    white-space: pre;
    word-wrap: normal;
    overflow: hidden;
}
.content-block div.se-code-sample .se-code-sample-lines {
    display: flex;
    overflow: hidden;
    position: relative;
}
.content-block div.se-code-sample .se-code-sample-line-numbers {
    display: flex;
    flex-direction: column;
    padding: 12px 8px 12px 12px;
    background: rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--WHITE);
    user-select: none;
    text-align: right;
    min-width: 40px;
    flex-shrink: 0;
    overflow-y: hidden;
    overflow-x: visible;
}
.content-block div.se-code-sample .se-code-sample-line-number {
    display: block;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--GRAY);
    line-height: 1.5;
    padding: 0;
    margin: 0;
}
.content-block div.se-code-sample .se-code-sample-code {
    flex: 1;
    padding: 12px 12px 12px 8px;
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}
.content-block div.se-code-sample .se-code-sample-code code {
    display: block;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--WHITE);
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    white-space: pre;
    word-wrap: normal;
    overflow: visible;
}

/* --- Math block (display math) --- */
.content-block .se-math-block {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    background: var(--BACKGROUND);
    border: 1px solid var(--GRAY);
    border-radius: 4px;
    padding: 8px;
    margin: 8px 0;
    text-align: center;
    color: var(--WHITE);
}
.content-block .se-math-block .se-math-content {
    display: block;
    text-align: center;
}

/* --- Inline math --- */
.content-block .se-inline-math {
    display: inline-block;
    vertical-align: middle;
    background: var(--BACKGROUND);
    border: 1px solid var(--GRAY);
    border-radius: 4px;
    padding: 2px 4px;
    color: var(--WHITE);
}

/* --- Image container (ZO Editor se-image-container) --- */
.content-block .se-image-container {
    display: block;
    margin: 0 0 10px;
    max-width: 100%;
}
.content-block .se-image-container.__se__float-left {
    float: left;
    margin-right: 8px;
    margin-bottom: 4px;
}
.content-block .se-image-container.__se__float-right {
    float: right;
    margin-left: 8px;
    margin-bottom: 4px;
}
.content-block .se-image-container.__se__float-center figure {
    margin: 0 auto;
}
.content-block .se-image-container figure {
    display: block;
    margin: 0;
    padding: 0;
    max-width: 100%;
}
.content-block .se-image-container img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* ==========================================================================
   Table styles (plain ZO tables and ranked tables)
   ========================================================================== */

/* --- Base table --- */
.content-block table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    margin: 8px 0;
    table-layout: auto;
}

.content-block table th,
.content-block table td {
    border: 1px solid var(--GRAY);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

.content-block table th {
    font-weight: 700;
}

/* --- Ranked table --- */
.content-block table.se-ranked-table {
    table-layout: fixed;
}

/* Score column — last th/td in every row */
.content-block table.se-ranked-table th:last-child,
.content-block table.se-ranked-table td:last-child {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    text-align: center;
}

/* Score cell container */
.content-block .se-ranked-table-score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Score value */
.content-block .se-ranked-table-score-value {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--WHITE);
    min-width: 24px;
    text-align: center;
}

/* Thumb buttons — disabled in editor, enabled on station page via rankedTable.js */
.content-block .se-ranked-table-thumb-up,
.content-block .se-ranked-table-thumb-down {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--WHITE);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1;
    transition: background 0.15s;
}

.content-block .se-ranked-table-thumb-up:hover,
.content-block .se-ranked-table-thumb-down:hover {
    background: rgba(255, 255, 255, 0.12);
}

.content-block .se-ranked-table-thumb-up::before {
    content: "\f164";
    font-family: FontAwesome;
    font-style: normal;
}

.content-block .se-ranked-table-thumb-down::before {
    content: "\f165";
    font-family: FontAwesome;
    font-style: normal;
}

/* Score cell is non-editable on station page — no outline on focus */
.content-block .se-ranked-table-score-cell {
    user-select: none;
}

/* Responsive — compact score column on small screens */
@media (max-width: 600px) {
    .content-block table.se-ranked-table th:last-child,
    .content-block table.se-ranked-table td:last-child {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
    }
}

/* ==========================================================================
   ZO Editor dialog close button — match .close-popup / fa-times style
   ========================================================================== */

.sun-editor .se-dialog-close {
    position: absolute;
    top: 0;
    right: 0.8rem;
    width: 4.5rem;
    height: 4.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: var(--WHITE);
    font-weight: 800;
    float: none;
    text-shadow: none;
    border-bottom-left-radius: 20px;
    padding: 0;
    z-index: 10000;
}

.sun-editor .se-dialog-close > svg {
    display: none;
}

.sun-editor .se-dialog-close::before {
    content: "\f00d";
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    color: var(--WHITE);
    font-size: 2.4rem;
}

.sun-editor .se-dialog-close:hover,
.sun-editor .se-dialog-close:focus,
.sun-editor .se-dialog-close:enabled:hover,
.sun-editor .se-dialog-close:enabled:focus {
    background-color: transparent;
    border-color: transparent;
    outline: none;
}
