/*
 * css/main.css
 * Main stylesheet for the Red Rose guild site (index.php).
 */

/* ── Base ───────────────────────────────────────────────────────────────────── */
body   { background: black; color: #fbb; font-family: monospace; margin: 0; padding: 20px; image-rendering: pixelated; }
h1     { font-size: 3em; text-align: center; color: #f55; text-shadow: 2px 2px #800; }
p      { line-height: 1.6; }
footer { text-align: center; margin-top: 40px; color: #a44; font-size: 0.8em; }

/* ── Page frame ─────────────────────────────────────────────────────────────── */
.page-frame {
    width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px;
    border: 4px solid #800; border-radius: 15px; background: #111;
    display: flex; flex-direction: column; align-items: center; box-sizing: border-box;
    overflow: hidden;
}

/* ── Nav ────────────────────────────────────────────────────────────────────── */
.nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 1200px; margin: 20px auto; }
.nav a { background: #500; border: 2px solid #f55; color: #fbb; padding: 10px 20px; border-radius: 15px; text-decoration: none; font-size: 1em; white-space: nowrap; flex: 0 0 auto; }
.nav a:hover             { background: #700; }
.nav a.active            { background: #a00; }
.nav a.admin-btn         { background: #063; border-color: #0f5; color: #9f9; }
.nav a.admin-btn:hover   { background: #095; }
.nav a.admin-btn.active  { background: #0b7; }
@media (max-width: 800px) { .nav a { flex: 1 1 auto; text-align: center; } }
@media (max-width: 600px) { .nav { gap: 6px; } .nav a { padding: 6px 10px; font-size: 0.85em; border-radius: 10px; } }
@media (max-width: 400px) { .nav a { padding: 4px 8px; font-size: 0.75em; } }

/* ── Carousel ───────────────────────────────────────────────────────────────── */
.carousel-container { width: 100%; max-width: 1000px; display: flex; flex-direction: column; align-items: center; position: relative; }
.carousel-image-wrapper { position: relative; width: 100%; }
.carousel-image-wrapper img,
.carousel-image-wrapper iframe { width: 100%; height: auto; border-radius: 10px; display: block; }
.carousel-image-wrapper iframe.carousel-video-embed { height: unset; }
#carousel-desc, #carousel-count, #video-count { text-align: center; color: #fbb; margin-top: 10px; font-size: 1em; }
#carousel-count, #video-count { color: #f55; font-size: 0.95em; margin: 10px 0; text-shadow: 1px 1px #800; }
.arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 60px; height: 60px; background: #500; border: 2px solid #f55; color: #fbb; font-size: 2em; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; z-index: 10; }
.arrow-left  { left: -30px; }
.arrow-right { right: -30px; }
@media (max-width: 600px) { .arrow { width: 40px; height: 40px; font-size: 1.5em; } .arrow-left { left: -20px; } .arrow-right { right: -20px; } }

/* ── Category buttons ───────────────────────────────────────────────────────── */
.carousel-categories { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 15px; }
.carousel-categories a.category-btn { color: #fbb; text-decoration: underline; cursor: pointer; transition: color 0.2s; }
.carousel-categories a.category-btn.active { color: #f55; font-weight: bold; }
.carousel-categories a.category-btn:hover  { color: #f88; }

/* ── Articles table ─────────────────────────────────────────────────────────── */
.articles-table { width: 100%; display: flex; flex-direction: column; }
.articles-header, .articles-row { display: flex; padding: 8px 0; border-bottom: 1px solid #444; }
.articles-header { font-weight: bold; color: #f88; border-bottom: 2px solid #f55; }
.articles-row:hover { background: #222; }
.articles-header .col, .articles-row .col { padding: 0 10px; }
.articles-header .col.title, .articles-row .col.title { flex: 2; }
.articles-header .col.date,     .articles-row .col.date,
.articles-header .col.author,   .articles-row .col.author,
.articles-header .col.category, .articles-row .col.category { flex: 1; }
a.article-link       { color: #fbb; text-decoration: none; }
a.article-link:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .articles-header { display: none; }
    .articles-row { flex-direction: column; border-bottom: 2px solid #333; padding: 8px 0; }
    .articles-row .col { display: flex; justify-content: flex-start; gap: 5px; padding: 2px 0 !important; }
    .articles-row .col.title { font-weight: bold; }
    .articles-row .col.date::before     { content: "Date: ";     font-weight: bold; color: #f88; }
    .articles-row .col.author::before   { content: "Author: ";   font-weight: bold; color: #f88; }
    .articles-row .col.category::before { content: "Category: "; font-weight: bold; color: #f88; }
}

/* ── Application / general page links ──────────────────────────────────────── */
.page-frame a, .page-frame a:visited { color: #fbb; text-decoration: underline; }
.page-frame a:hover                  { color: #fff; }

/* ── Article body ───────────────────────────────────────────────────────────── */
.article-body img     { display: block; margin: 1em auto; max-width: 100%; }
.article-body p       { margin: 0.5em 0; }
.article-body a       { color: #f88; text-decoration: underline; }
.article-body a:hover { color: #fff; }

/* ── Login form ─────────────────────────────────────────────────────────────── */
#login-form input {
    padding: 8px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    background: #222;
    color: #fbb;
    border: 1px solid #f55;
}

#login-form button {
    padding: 10px;
    background: #500;
    color: #fbb;
    border: 2px solid #f55;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
}

#login-msg {
    color: #f88;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Site tagline ───────────────────────────────────────────────────────────── */
.site-tagline { text-align: center; }

/* ── Home page ──────────────────────────────────────────────────────────────── */
.home-quote {
    margin: 1em 0;
    color: #fbb;
    font-style: italic;
    text-align: center;
    font-size: 1.1em;
    line-height: 1.5;
}

.home-divider {
    width: 100%;
    border: none;
    border-top: 1px solid #500;
    margin: 40px 0;
}

.featured-screenshot { width: 100%; max-width: 1000px; margin: 20px auto; text-align: center; }
.featured-img        { width: 100%; border-radius: 10px; }
.featured-caption    { margin-top: 10px; color: #fbb; }

/* ── Featured video on home page (responsive 16:9, constrained width) ───────── */
.video-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}


.carousel-video-embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    border: none;
    display: block;
}

.video-embed {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 10px;
    border: none;
}

/* ── Iframes ─────────────────────────────────────────────────────────────────── */
.page-iframe  { display: block; width: 100%; height: 700px;  border: none; }

.admin-iframe-wrapper { width: 100%; max-width: 1200px; margin: 0 auto; }
.admin-iframe         { display: block; width: 100%; height: 1000px; border: none; }

/* ── Page variants ───────────────────────────────────────────────────────────── */
.page-frame--left { align-items: flex-start; text-align: left; }

/* ── Error messages ──────────────────────────────────────────────────────────── */
.error-msg { color: #f88; }

/* ── Home banner image ──────────────────────────────────────────────────────── */
.home-banner { width: 100%; max-width: 1000px; margin: 20px auto; text-align: center; }
.home-banner img { width: 100%; height: auto; display: block; border-radius: 10px; }

/* ── Members ─────────────────────────────────────────────────────────────────── */
.rank-heading { margin-top: 20px; color: #f88; }
.member-sheet-link       { color: #f88; text-decoration: underline; cursor: pointer; }
.member-sheet-link:hover { color: #fff; }
/* ── Codex ───────────────────────────────────────────────────────────────────── */
.tab-panel        { display: none; }
.tab-panel.active { display: block; text-align: left; }

.codex-content { max-width: 820px; }
.codex-content img.postimage { max-width: 100%; vertical-align: middle; margin-right: 6px; }
.codex-content ol,
.codex-content ul  { padding-left: 2em; line-height: 1.8; margin: 0.3em 0; }
.codex-content li  { margin: 0.15em 0; }
.codex-content span[style*="text-decoration:underline"],
.codex-content span[style*="text-decoration: underline"] {
    color: #fdd;
    display: block;
    margin: 1.2em 0 0.3em;
}

/* ── Statistics ──────────────────────────────────────────────────────────────── */
#progress-wrap { max-width: 800px; margin: 20px auto; width: 100%; }
#progress-bar-outer { width: 100%; height: 22px; background: #222; border: 2px solid #500; border-radius: 4px; overflow: hidden; }
#progress-bar-inner { height: 100%; width: 0%; background: #a00; transition: width 0.3s ease; }
#progress-label { text-align: center; margin-top: 6px; color: #f88; font-size: 0.9em; }

#stats-container { width: 100%; margin: 30px auto; display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }

.stat-table-wrap { min-width: 280px; flex: 1 1 280px; }
.stat-table-wrap h2 { color: #f88; margin: 0 0 6px 0; font-size: 1em; border-bottom: 1px solid #500; padding-bottom: 4px; }

.stat-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.stat-table th { color: #f55; text-align: left; padding: 4px 8px; border-bottom: 1px solid #500; }
.stat-table td { padding: 4px 8px; border-bottom: 1px solid #222; }
.stat-table tr:hover td { background: #1a0000; }
.stat-table td.rank  { color: #888; width: 30px; }
.stat-table td.name  { color: #fdd; }
.stat-table td.score { color: #f88; text-align: right; }
.stat-table .no-data { color: #666; font-style: italic; padding: 8px; }
.error-note { color: #f55; font-size: 0.85em; padding: 6px 8px; }


/* ── Level Compare ───────────────────────────────────────────────────────────── */

/* Date selectors */
.date-form {
    display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
    align-items: flex-end; margin-bottom: 30px;
}
.date-form label { display: flex; flex-direction: column; gap: 6px; color: #f88; font-size: 0.9em; }
.date-form select {
    background: #111; color: #fbb; border: 2px solid #500; border-radius: 8px;
    padding: 6px 12px; font-family: monospace; font-size: 1em; cursor: pointer;
}
.date-form select:focus { outline: none; border-color: #f55; }
.date-form button {
    background: #500; border: 2px solid #f55; color: #fbb; padding: 8px 20px;
    border-radius: 10px; font-family: monospace; font-size: 1em; cursor: pointer;
}
.date-form button:hover { background: #700; }

/* Results */
#results { max-width: 600px; margin: 0 auto; }
#results h2 { color: #f88; text-align: center; margin-bottom: 12px; font-size: 1em; }

.gains-list { max-width: 600px; margin: 0 auto; }
.gain-group { margin-bottom: 16px; }
.gain-amount { color: #f55; font-size: 1.2em; font-weight: bold; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.medal { font-size: 1.3em; line-height: 1; }
.gain-names  { color: #fdd; margin-bottom: 2px; }
.gain-note   { color: #888; font-size: 0.85em; }
.gain-count  { color: #666; font-size: 0.85em; }

.no-data  { text-align: center; color: #666; font-style: italic; padding: 20px; }
.msg      { text-align: center; color: #f88; margin: 20px 0; }