/**
 * KBHost Dark Theme
 *
 * Based on Twenty Sixteen with WP Dark Mode overrides.
 * Colors extracted from the live kbhost.nl site.
 */

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    background-color: #242525;
    color: #dfdedb;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: Consolas, monospace;
    font-weight: 700;
    color: #dfdedb;
    line-height: 1.25;
    margin: 0 0 1em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: #f0a030;
}

p {
    margin: 0 0 1.5em;
}

code, pre, textarea.auto-resize {
    font-family: Consolas, monospace;
}

pre, textarea.auto-resize {
    background: #4E6513;
    color: #dfdedb;
    padding: 16px;
    overflow: hidden;
    border: 1px solid #5a7520;
    border-radius: 3px;
    font-size: 0.875rem;
    line-height: 1.6;
    width: 100%;
    resize: vertical;
    outline: none;
}
textarea.auto-resize:focus {
    border-color: #6a8525;
    outline: none;
}

/* ===== Code Block Wrapper ===== */
.code-block-wrapper {
    position: relative;
    margin: 0;
}
.code-block-wrapper textarea.auto-resize {
    margin: 0;
    display: block;
}
.code-block-wrapper.collapsed textarea.auto-resize {
    overflow: hidden;
}
.code-block-wrapper.collapsed {
    cursor: pointer;
}
/* Collapse gap between text and language badge */
.article-content p:has(+ .code-language-badge) {
    margin-bottom: 4px;
}
/* Language badge sits OUTSIDE (before) the wrapper */
.code-language-badge {
    display: block;
    width: fit-content;
    margin: 4px 0 4px auto;
}
/* Copy button sits OUTSIDE (after) the wrapper */
.copy-btn {
    margin: 4px 0 1.5em;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: #ccc;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}
.copy-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.copy-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}
/* Collapsed fade hint */
.code-block-wrapper.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: linear-gradient(transparent, #4E6513);
    pointer-events: none;
    border-radius: 0 0 3px 3px;
}

blockquote {
    margin: 1em 0 1em 10px;
    padding-left: 20px;
    border-left: 4px solid var(--accent-color);
    font-style: italic;
    color: #aaa;
}

img {
    max-width: 100%;
    height: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}
table th, table td {
    border: 1px solid #444;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: #dfdedb;
}
table th {
    background: #1a1a1a;
    font-weight: bold;
}
table tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

/* ===== Layout ===== */
.site-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
#masthead {
    background: #242525;
    border-bottom: none;
    padding: 1em 7.6923%;
}

.site-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 10px;
}

.site-branding .site-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 900;
}
.site-branding .site-title a {
    color: var(--accent-color);
    text-decoration: none;
}

.header-ip {
    color: #999;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 0.9375rem;
    margin-right: 20px;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
}
.main-navigation ul li a {
    color: #ccc;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 0.9375rem;
    font-weight: 400;
    text-decoration: none;
}
.main-navigation ul li a.nav-active {
    font-weight: 700;
}
.main-navigation ul li a:hover {
    color: var(--accent-color);
}

/* ===== Footer ===== */
#colophon {
    margin-top: 3em;
    padding: 1.5em 7.6923%;
    border-top: none;
    background: #242525;
    text-align: center;
}
.site-title-footer a {
    color: #666;
    font-family: Consolas, monospace;
    font-size: 0.75rem;
}

/* ===== Voting Widget ===== */
.voting-widget {
    float: right;
    font-size: 1rem;
    margin-bottom: 0.5em;
    display: flex;
    align-items: center;
}
.vote-btn {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: Consolas, monospace;
    font-size: 0.9375rem;
}
.vote-up {
    color: #4caf50;
}
.vote-down {
    color: #f44336;
    margin-left: 10px;
}

/* ===== Admin Edit Button (on article page) ===== */
.admin-edit-btn {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.8125rem;
    font-family: Verdana, Geneva, sans-serif;
    font-weight: 600;
    color: #ccc;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    text-decoration: none;
    margin-right: 12px;
    transition: all 0.15s ease;
}
.admin-edit-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.article-view-count {
    font-size: 0.8125rem;
    color: #888;
    margin-right: 12px;
}

/* ===== Status Badge (article page) ===== */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    vertical-align: middle;
}
.status-private {
    background: rgba(255,255,255,0.1);
    color: #999;
    border: 1px solid rgba(255,255,255,0.15);
}

/* ===== Show/Hide Shortcode ===== */
.sh-block {
    margin: 1em 0;
}
.sh-toggle {
    display: inline-block;
    cursor: pointer;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 6px 0;
    user-select: none;
}
.sh-toggle:hover {
    text-decoration: underline;
}
.sh-icon {
    display: inline-block;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
    margin-right: 2px;
}
.sh-toggle.sh-open .sh-icon {
    transform: none;
}
.sh-content {
    margin-top: 4px;
}

/* ===== NO SLEEP Widget ===== */
.nosleep-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #4caf50;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.nosleep-label {
    color: #999;
    font-family: Consolas, monospace;
    font-size: 1.1rem;
    font-weight: 700;
}
.nosleep-dash {
    color: #999;
    font-family: Consolas, monospace;
    font-size: 1.1rem;
}
#nosleep-timer {
    font-family: Consolas, monospace;
    color: #999;
    font-size: 1.1rem;
}

/* ===== Password Generator ===== */
#password-gen-list .password-item {
    font-family: Consolas, monospace;
    font-size: 0.9375rem;
    color: #dfdedb;
    padding: 3px 0;
    letter-spacing: 0.02em;
    cursor: cell;
    transition: color 0.15s ease;
    width: 135px;
}
#password-gen-list .password-item:hover {
    color: #fff;
}
#password-gen-list .password-item.password-copied {
    color: #e58c17;
}
#password-gen-list .password-item.enclosed-loading {
    color: #888;
    cursor: wait;
}
#password-gen-list .password-item.enclosed-copied {
    color: #28a745;
}
#password-gen-list .password-item.enclosed-error {
    color: #f44336;
}
.widget-refresh-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8125rem;
    color: var(--accent-color);
}

/* ===== 404 ===== */
.error-404 {
    text-align: center;
    padding: 3em 0;
}
.error-404 h1 {
    font-size: 2rem;
    color: #dfdedb;
}
.error-404 p {
    color: #999;
}

/* ===== Search field focus & placeholder ===== */
.kbe_search_field input[type="text"]:focus {
    color: rgb(168, 160, 149);
    border-color: var(--accent-color);
    outline: none;
}
.kbe_search_field input[type="text"]::placeholder {
    color: #888;
}

/* ===== KBE Live Search Result ===== */
#kbe-live-search-result {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    z-index: 9999;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid var(--accent-color);
    border-top: none;
}
#kbe-live-search-result li {
    border-bottom: 1px solid #333;
}
#kbe-live-search-result li a {
    display: block;
    padding: 10px 16px;
    color: #dfdedb;
    text-decoration: none;
    font-size: 0.875rem;
}
#kbe-live-search-result li a:hover {
    background: #333;
    color: #fff;
}
.kbe-live-search-no-result {
    display: block;
    padding: 10px 16px;
    color: #888;
    font-size: 0.875rem;
}

/* ===== Password Protected ===== */
.password-prompt {
    max-width: 400px;
    margin: 2em 0;
}
.password-prompt p {
    margin-bottom: 1em;
    color: #999;
}
.password-prompt .password-error {
    color: #f44336;
}
.password-prompt form {
    display: flex;
    gap: 10px;
    align-items: center;
}
.password-prompt input[type="password"] {
    flex: 1;
    padding: 8px 12px;
    background: #2a2a3e;
    border: 1px solid #444;
    color: #dfdedb;
    border-radius: 3px;
    font-size: 0.9375rem;
}
.password-prompt input[type="password"]:focus {
    border-color: var(--accent-color);
    outline: none;
}
.password-prompt .btn-primary {
    padding: 8px 16px;
    font-size: 0.9375rem;
    font-family: Verdana, Geneva, sans-serif;
    background: var(--accent-color);
    color: #fff;
    border: 1px solid var(--accent-color);
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}
.password-prompt .btn-primary:hover {
    background: #f0a030;
    border-color: #f0a030;
}

/* ===== Category Article Meta ===== */
.article-meta {
    font-size: 0.8125rem;
    margin-left: 8px;
    color: #888;
}
.article-meta .meta-views {
    color: #888;
}
.article-meta .meta-vote-up {
    color: #4caf50;
    margin-left: 6px;
}
.article-meta .meta-vote-down {
    color: #f44336;
    margin-left: 4px;
}

/* ===== Responsive ===== */
@media screen and (max-width: 985px) {
    .site-inner {
        padding: 0 4%;
    }
    #masthead {
        padding: 0.75em 4%;
    }
}

@media screen and (max-width: 640px) {
    .site-header-main {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-ip {
        order: 3;
    }
}
