/* ============================================================
   BoxShinga / MINECRAFT::Admin  —  style.css
   All fonts served locally — no external dependencies.
   ============================================================ */

/* Minecraftia — alternate pixel font */
@font-face {
    font-family: 'minecraftiaregular';
    src: url('/fonts/minecraftia-webfont.woff') format('woff'),
         url('/fonts/Minecraftia.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* Minecraftia baseline correction — h1/h2 only */
h1, h2 {
    line-height: 1.5;
    padding-top: 0.15em;
}

/* VT323 — retro terminal font */
@font-face {
    font-family: 'VT323';
    src: url('/fonts/VT323-Regular.woff2') format('woff2'),
         url('/fonts/VT323-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}


/* --- CSS Variables ---------------------------------------- */
:root {
    --font-pixel  : 'minecraftiaregular', monospace;
    --font-mono   : monospace;
    --font-body   : 'VT323', monospace;
    --green       : #4a7a4a;
    --green-dk    : #355e35;
    --red         : #c44444;
    --blue        : #2255bb;
    --panel-bg    : rgba(198, 198, 198, 0.94);
    --panel-rad   : 12px;
    --nav-bg      : rgba(0, 0, 0, 0.62);
}

/* --- Base reset ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    background-color: #111;
    height: 100%;
}

/* --- Global typography ------------------------------------ */
body, p, li, label, input, button, select, td, th {
    font-family: var(--font-body);
    font-size: 20px;
    line-height: 1.5;
    color: #222;
}

a       { color: var(--blue); font-family: var(--font-body); }
a:hover { text-decoration: underline; }

h1 {
    font-family: var(--font-pixel);
    font-size: 0.88em;
    line-height: 1.8;
    color: #1a1a1a;
    margin: 0 0 8px;
}

h2 {
    font-family: var(--font-pixel);
    font-size: 1.1em;
    line-height: 1.6;
    color: #333;
    margin: 0 0 14px;
}

h3 {
    font-family: var(--font-body);
    font-size: 1.15em;
    color: #444;
    margin: 12px 0 4px;
}

/* ---- Shared nav mixin ------------------------------------ */
nav ul {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    max-width: 1400px;
}
nav ul li { list-style: none; margin: 0; padding: 0; }

/* ---- Tier 1: Primary nav (dark) -------------------------- */
#nav-primary {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

#nav-primary ul li {
    display: flex;
    align-items: center;
}

#nav-primary ul li a {
    display: flex;
    align-items: center;
    padding: 0 18px;
    padding-top: 0.25em;
    height: 41px;
    color: #eee;
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.88em;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}
#nav-primary ul li a:hover,
#nav-primary ul li a.active {
    background: rgba(255,255,255,0.1);
    border-bottom-color: #5a8c27;
    color: #fff;
}
#nav-primary .nav-user a       { color: #aef; }
#nav-primary .nav-user a:hover { color: #fff; border-bottom-color: #aef; }

/* ---- Tier 2: Admin nav (orange lava) --------------------- */
#nav-admin {
    background: #8b2800;
    position: sticky;
    top: 41px;
    z-index: 199;
    border-bottom: 2px solid rgba(0,0,0,0.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#nav-admin ul li {
    display: flex;
    align-items: center;
}

#nav-admin ul li a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    padding-top: 0.25em;
    height: 34px;
    color: #ffd0a0;
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.85em;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}
#nav-admin ul li a:hover,
#nav-admin ul li a.active {
    background: rgba(255,255,255,0.15);
    border-bottom-color: #ffb060;
    color: #fff;
}
#nav-admin .nav-admin-right { margin-left: auto; }
#nav-admin .nav-admin-right a { color: #ffa0a0; }
#nav-admin .nav-admin-right a:hover { color: #fff; border-bottom-color: #ffa0a0; }

/* ---- Tier 3: Contextual sub-nav (dark orange) ------------ */
#nav-sub {
    background: #5c1a00;
    border-bottom: 1px solid rgba(0,0,0,0.4);
    position: sticky;
    top: 82px;
    z-index: 198;
}

#nav-sub ul li {
    display: flex;
    align-items: center;
}

#nav-sub ul li a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    padding-top: 0.25em;
    height: 28px;
    color: #e8b880;
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.82em;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}
#nav-sub ul li a:hover {
    background: rgba(255,255,255,0.1);
    border-bottom-color: #e8b880;
    color: #fff;
}

/* --- Minecraft layered background ------------------------- */
.container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
}

#page_grass_layer {
    background-image: url('/images/minecraft_64px/dirtgrass_64px.jpg');
    background-repeat: repeat;
    width: 100%;
    height: 64px;
}

#page_minecraft_layer {
    background-image: url('/images/minecraft.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    position: relative;
    top: 45px;
    width: 100%;
    height: 100px;
}

#page_dirt_layer {
    background-image: url('/images/minecraft_64px/dirt_64px.jpg');
    background-repeat: repeat;
    width: 100%;
    height: 192px;
}

#page_stone_layer {
    background-image: url('/images/minecraft_64px/stone_64px.jpg');
    background-repeat: repeat;
    width: 100%;
    min-height: 384px;
}

#page_lava_layer {
    background-image: url('/images/minecraft_64px/lava_64px.gif');
    background-repeat: repeat;
    width: 100%;
    height: 192px;
}

/* --- Content positioning (just a positioner, no card styles) */
#content {
    position: absolute;
    top: 190px;
    left: 2%;
    right: 2%;
    z-index: 10;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
}

/* --- Panel cards (the actual visible card) ---------------- */
/* Standard panel — centred, max 680px wide */
.panel {
    background: var(--panel-bg);
    border-radius: var(--panel-rad);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    padding: 28px 32px 32px;
    max-width: 680px;
    margin: 0 auto 24px;
}

/* Wide panel — full width (admin dashboard) */
.panel-wide {
    background: var(--panel-bg);
    border-radius: var(--panel-rad);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    padding: 28px 32px 32px;
    margin: 0 0 24px;
}

/* Narrow panel — centred, max 440px wide (admin login) */
.panel-narrow {
    background: var(--panel-bg);
    border-radius: var(--panel-rad);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    padding: 28px 32px 32px;
    max-width: 440px;
    margin: 0 auto 24px;
}

/* --- Form layout (CSS grid) ------------------------------- */
.field-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    align-items: start;
    gap: 6px 12px;
    margin-bottom: 14px;
}

.field-row label {
    font-weight: 700;
    font-size: 0.92em;
    padding-top: 8px;
    color: #333;
    font-family: var(--font-body);
}

.field-row input[type="text"],
.field-row input[type="email"],
.field-row input[type="password"] {
    width: 100%;
    padding: 7px 10px;
    border: 2px solid #aaa;
    border-radius: 5px;
    font-size: 0.95em;
    font-family: var(--font-body);
    background: #fff;
    transition: border-color 0.2s;
}

.field-row input:focus {
    outline: none;
    border-color: var(--green);
}

.field-hint {
    font-size: 0.8em;
    color: #666;
    margin-top: -6px;
    margin-bottom: 4px;
    grid-column: 2;
    font-family: var(--font-body);
}

.review-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 4px 10px;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.review-row .review-label {
    font-weight: 700;
    color: #444;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
}

form.form-inline { display: inline; }

/* --- Buttons ---------------------------------------------- */
.btn {
    display: inline-block;
    padding: 9px 22px;
    border-radius: 5px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}

.btn:active          { transform: translateY(1px); }
.btn-primary         { background: var(--green); color: #fff; }
.btn-primary:hover   { background: var(--green-dk); color: #fff; }
.btn-danger          { background: var(--red); color: #fff; }
.btn-danger:hover    { background: #a33; color: #fff; }
.btn-neutral         { background: #888; color: #fff; }
.btn-neutral:hover   { background: #666; color: #fff; }
.btn-sm              { padding: 4px 12px; font-size: 0.82em; }

/* --- Alerts ----------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.92em;
    font-family: var(--font-body);
}

.alert-success { background: #e8f5e9; border: 1px solid #66bb6a; color: #2e7d32; }
.alert-error   { background: #fdecea; border: 1px solid var(--red); color: #7a1515; }
.alert-info    { background: #e3f2fd; border: 1px solid #64b5f6; color: #1a4a7a; }
.alert-error ul { margin: 6px 0 0 18px; padding: 0; }

.flash {
    background: #cee5f5;
    padding: 0.5em;
    border: 1px solid #aacbe2;
    margin-bottom: 12px;
}

.error {
    background: #f0d6d6;
    padding: 0.5em;
    margin-bottom: 12px;
}

/* --- Inline validation ------------------------------------ */
.field-error  { display: block; color: var(--red); font-size: 0.8em; margin-top: 3px; }
input.input-error { border-color: var(--red) !important; }
.mc-status    { display: inline-block; font-size: 0.85em; margin-top: 5px; font-weight: 600; transition: color 0.2s; }
.mc-checking  { color: #888; }
.mc-valid     { color: #3a7a3a; }
.mc-invalid   { color: #b03030; }
.mc-found     { color: #3a7a3a; font-weight: 700; }
.mc-notfound  { color: var(--red); }
.mc-unknown   { color: #a07000; }
.req          { color: var(--red); }

/* --- Info block ------------------------------------------- */
.info-block {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 0.92em;
}
.info-block p            { margin: 0 0 8px; }
.info-block p:last-child { margin-bottom: 0; }

.back-link { margin-top: 16px; font-size: 0.88em; color: #555; }

/* --- Lists ------------------------------------------------ */
#content ul, #content ol {
    font-family: var(--font-body);
    padding-left: 22px;
    margin: 8px 0;
}

#content li {
    font-family: var(--font-body);
    font-size: 1em;
    color: #222;
}

.step-list          { list-style: disc; padding-left: 20px; margin-top: 10px; }
.step-list > li     { margin-bottom: 20px; padding-left: 4px; }

.step-title {
    font-family: var(--font-body);
    font-size: 1.05em;
    font-weight: 800;
    color: #1a1a1a;
    display: block;
    margin-bottom: 4px;
}

/* --- Rules page ------------------------------------------- */
.rules { text-align: left; }

/* --- Admin dashboard -------------------------------------- */
.admin-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #aaa;
}

.admin-bar h1  { font-size: 0.8em; margin: 0; }
.admin-section { margin-bottom: 36px; }

.admin-section h2 {
    font-size: 1.05em;
    font-weight: 800;
    border-bottom: 2px solid #999;
    padding-bottom: 4px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge        { background: var(--red);   color: #fff; border-radius: 12px; padding: 2px 9px; font-size: 0.72em; font-weight: 700; }
.badge-green  { background: var(--green); }

.admin-table  { width: 100%; border-collapse: collapse; font-size: 0.84em; }

.admin-table th {
    background: #555;
    color: #fff;
    padding: 7px 9px;
    text-align: left;
    white-space: nowrap;
    font-weight: 700;
}

.admin-table td {
    padding: 6px 9px;
    border-bottom: 1px solid #ccc;
    vertical-align: top;
}

.admin-table tr:hover td       { background: rgba(255, 255, 255, 0.2); }
.admin-table .row-pending td   { background: rgba(255, 230, 120, 0.22); }

.ip-cell    { font-family: 'VT323', monospace; font-size: 0.88em; white-space: pre-wrap; }
.date-cell  { white-space: nowrap; font-size: 0.82em; }
.action-cell { white-space: nowrap; }
.empty-cell  { color: #888; font-style: italic; }
.none-msg    { color: #666; font-style: italic; font-size: 0.9em; }
.table-scroll { overflow-x: auto; }

/* --- Footer ----------------------------------------------- */
#footer {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: #aaa;
    padding: 14px;
    font-size: 0.82em;
}
#footer p { margin: 0; color: #aaa; }
#footer a { color: #dda; }



/* --- Friends & Notifications ------------------------------ */
.friend-invisible label {
    opacity: 0.45;
    text-decoration: line-through;
    color: #888;
}

.invisible-badge {
    font-size: 0.72em;
    background: rgba(0,0,0,0.12);
    color: #777;
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
    font-style: italic;
}

.phone-country-select {
    width: 110px;
    flex-shrink: 0;
}

/* --- Loading overlay ---------------------------------------- */
#loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

#loading-overlay.active {
    display: flex;
}

#loading-overlay .loading-label {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 0.05em;
    animation: blink 1.2s step-start infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.steve-spinner {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    animation: steve-spin 1s steps(8, end) infinite;
    filter: drop-shadow(0 0 8px rgba(90, 140, 39, 0.8));
}

@keyframes steve-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {

    /* Stack nav items and shrink text */
    nav ul { flex-wrap: wrap; }
    #nav-primary ul li a {
        height: auto;
        padding: 8px 12px;
        padding-top: 10px;
        font-size: 0.82em;
        display: block;
    }
    #nav-admin ul li a {
        height: auto;
        padding: 6px 10px;
        padding-top: 8px;
        font-size: 0.78em;
        display: block;
    }
    #nav-sub ul li a {
        height: auto;
        padding: 5px 10px;
        padding-top: 7px;
        display: block;
    }
    #nav-admin .nav-admin-right { margin-left: 0; }
    #nav-primary ul li { display: block; }
    #nav-admin ul li   { display: block; }
    #nav-sub ul li     { display: block; }

    /* Content panel: switch from absolute to normal flow */
    .container { display: block; }

    #page_grass_layer {
        height: 45px;
    }

    #page_minecraft_layer {
        background-size: contain;
        height: 60px;
        top: 5px;
    }

    #page_dirt_layer  { height: 96px; }
    #page_stone_layer { min-height: 200px; }
    #page_lava_layer  { height: 96px; }

    /* Push content below the background layers */
    #content {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin: 0 2% 24px;
        z-index: 10;
    }

    /* Single-column forms */
    .field-row {
        grid-template-columns: 1fr;
    }
    .field-row label { padding-top: 0; }
    .field-hint  { grid-column: 1; }
    .review-row  { grid-template-columns: 1fr; }

    /* Panels go full width */
    .panel, .panel-narrow {
        max-width: 100%;
        padding: 18px 16px 20px;
    }
    .panel-wide { padding: 18px 12px 20px; }

    /* Tables scroll horizontally */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table  { font-size: 0.78em; }
    .admin-table th, .admin-table td { padding: 5px 6px; }

    /* Action buttons stack vertically in table cells */
    .action-cell { display: flex; flex-direction: column; gap: 4px; }
    .action-cell form { display: block; }

    /* Server status cards */
    .server-header  { flex-wrap: wrap; gap: 6px; padding: 12px; }
    .server-meta    { margin-left: 0; }
    .player-row     { padding: 8px 12px; }

    /* Form actions wrap */
    .form-actions { flex-wrap: wrap; }
}

/* --- Progress bar ----------------------------------------- */
.progress-bar-wrap {
    background: #ddd;
    border-radius: 4px;
    height: 14px;
    overflow: hidden;
    width: 100%;
    max-width: 300px;
}

.progress-bar {
    background: var(--green);
    height: 100%;
    transition: width 0.4s ease;
    min-width: 2px;
}

.pb-label {
    font-size: 0.8em;
    color: #666;
    display: block;
    margin-top: 2px;
}

/* --- Recipient list (mailer compose) ---------------------- */
.rcpt-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
}

.rcpt-item {
    padding: 2px 0;
    font-size: 0.88em;
}

.rcpt-item.hidden { display: none; }

.rcpt-item label { cursor: pointer; }
.rcpt-item label:hover { color: var(--green); }

/* --- Quill editor overrides ------------------------------- */
.ql-container { font-family: var(--font-body); }
.ql-toolbar   { border-radius: 4px 4px 0 0; }
.ql-container { border-radius: 0 0 4px 4px; min-height: 200px; }

/* --- Server admin table note ------------------------------ */
.srv-admin-note {
    font-size: 0.78em;
    color: #666;
    margin-left: 8px;
}

/* --- Main nav: account link ------------------------------- */
#site-nav .nav-user a { color: #aef; }
#site-nav .nav-user a:hover { color: #fff; border-bottom-color: #aef; }

/* --- Nav: disabled link (not logged in) ------------------- */
.nav-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* --- Server status page ----------------------------------- */
.server-card {
    background: var(--panel-bg);
    border-radius: var(--panel-rad);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    margin-bottom: 10px;
    overflow: hidden;
}

.server-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.server-header:hover { filter: brightness(0.96); }

.status-pip {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pip-online  { background: #3dba5f; }
.pip-offline { background: #888; }

.server-name  { font-size: 14px; font-weight: 800; font-family: var(--font-body); }
.player-count { font-size: 12px; color: #555; }

.server-meta {
    font-size: 11px;
    color: #777;
    margin-left: auto;
    margin-right: 12px;
}

.server-meta-right {
    margin-left: auto;
    margin-right: 12px;
}

.chevron {
    font-size: 10px;
    color: #888;
    display: inline-block;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.chevron.open { transform: rotate(90deg); }

.player-list {
    display: none;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.player-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.player-row:last-child { border-bottom: none; }

.player-head {
    width: 36px;
    height: 36px;
    image-rendering: pixelated;
    flex-shrink: 0;
    border-radius: 2px;
}

.player-info    { display: flex; flex-direction: column; }
.player-name    { font-size: 13px; font-weight: 700; font-family: var(--font-body); }

.op-badge {
    font-size: 10px;
    padding: 1px 5px;
    margin-left: 6px;
    border-radius: 3px;
    background: rgba(255, 200, 0, 0.25);
    color: #7a5f00;
    font-weight: 700;
    vertical-align: middle;
}

.player-join   { font-size: 11px; color: #777; margin-top: 2px; }

.kick-form     { margin-left: auto; flex-shrink: 0; }

.kick-btn {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 4px;
    border: none;
    background: var(--red);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.kick-btn:hover  { background: #a33; }
.kick-btn:active { transform: translateY(1px); }

.server-status-msg {
    padding: 12px 16px;
    font-size: 12px;
    color: #777;
    font-style: italic;
}

/* ---- v3: Server selection checkboxes ---- */
.server-checkbox {
    display: block;
    padding: 10px 12px;
    margin: 6px 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.server-checkbox:hover {
    border-color: var(--green);
    background: rgba(255,255,255,0.08);
}
.server-checkbox input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}
.server-checkbox strong {
    vertical-align: middle;
}
.server-desc {
    display: block;
    margin: 4px 0 0 26px;
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
}

/* Small inline server checkboxes (admin dashboard / user edit) */
.server-checkbox-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px 10px 2px 0;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.server-checkbox-sm input[type="checkbox"] {
    margin: 0;
}

/* Server description on public page */
.server-description {
    padding: 8px 16px 12px 16px;
    font-size: 12px;
    color: #bbb;
    line-height: 1.5;
    white-space: pre-wrap;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Inline form used in dashboard for approve-with-servers */
.server-grant-form {
    display: inline;
}
