/* ========================================
   VBN-GAME - GLOBAL STYLES
   Shared styles for header, footer, and base layout
   
   BOOTSTRAP INTEGRATION NOTES:
   - Bootstrap 5.3.2 is loaded before this file
   - css/bootstrap-overrides.css neutralizes Bootstrap's reset
   - Existing styles take precedence - no visual changes
   - Bootstrap utilities available for future use:
     * Grid: .container, .row, .col-*
     * Spacing: .m-*, .p-*, .mt-*, .mb-*, etc.
     * Display: .d-flex, .d-grid, .d-none
     * Text: .text-center, .text-light, etc. (do not use opacity utilities on text)
   ======================================== */

/* ===== CSS VARIABLES ===== */
:root {
    --font-body: 'Source Serif Pro', serif;
    --font-brand: 'IM Fell English', serif;
    --font-brand-sc: 'IM Fell English SC', serif; /* Small Caps variant */
    --font-title: 'Libre Baskerville', serif;
    --bg-dark: #0d0606;
    --bg-darker: #1a0f0f;
    --deep-maroon: #2a1515;
    --dusk-brown-black: #1a0f0f;
    --blood-red: #8B0000;
    --muted-gold: #d4b06d;
    --teal-moonlight: #0B3C49;
    --text-light: #f5e6d3;
    --text-mid: #d4b06d; /* Changed to muted gold per Art Bible */
    /* Secondary copy / parchment (replaces scattered #b8a090 / #d4c4b0; see plan/css-refactor-inventory.md) */
    --vbn-text-soft: #b8a090;
    --vbn-text-parchment: #d4c4b0;

    /* Bootstrap 5 variable overrides — dark, not blood-red (Reboot sets body background-color from this) */
    --bs-body-bg: var(--bg-dark);

    /* scrollIntoView(block: start) — keep targets below .vbng-site-header (position: sticky) */
    --sticky-site-header-scroll-margin: 8.75rem;

    /* Gothic scrollbars */
    --vbn-scrollbar-size: 7px;
    --vbn-scrollbar-track: var(--bg-dark);
    --vbn-scrollbar-thumb: var(--blood-red);
    --vbn-scrollbar-thumb-mid: var(--deep-maroon);
}

.badge.bg-purple { background-color: #4a1a6b !important; color: var(--text-light); }

table tbody tr {
    background: #1a1a1a;
}

/* ===== TABLE STYLES ===== */
table thead th {
    background: linear-gradient(135deg, var(--blood-red) 0%, #600000 100%);
    color: var(--text-light);
}

/* ===== INFO PANELS - TEAL MOONLIGHT ===== */
/* Teal moonlight as alternate border and gradient background for info panels */
.info-panel-teal {
    background: linear-gradient(135deg, rgba(11, 60, 73, 0.2) 0%, rgba(26, 15, 15, 0.4) 100%);
    border: 2px solid var(--teal-moonlight);
    border-radius: 8px;
    padding: 1.5rem;
}

.info-panel-teal-border {
    border: 2px solid var(--teal-moonlight);
    border-radius: 8px;
}

.info-panel-teal-gradient {
    background: linear-gradient(135deg, rgba(11, 60, 73, 0.2) 0%, rgba(26, 15, 15, 0.4) 100%);
    border-radius: 8px;
    padding: 1.5rem;
}

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== BODY - GOTHIC BACKGROUND ===== */
body {
    font-family: var(--font-body), 'Times New Roman', serif;
    background-color: var(--bg-dark);
    background-image: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 50%, var(--bg-dark) 100%);
    background-attachment: fixed;
    color: var(--text-mid);
    min-height: 100vh;
    line-height: 1.6;
    display: block;
    margin: 0;
    padding: 0;
    /* Mobile-first responsive base */
    font-size: 16px; /* Prevents iOS zoom on form inputs */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/*
 * Scrollbars: Chromium paints ::-webkit-* only if this document does NOT set scrollbar-color / scrollbar-width
 * on the same element (see Chrome 121+). So: WebKit rules below for Chrome/Edge/Safari; Firefox-only standard props in @supports.
 * html overflow-y: scroll — keeps a vertical bar visible so styling is obvious (not overlay-only / no-scroll).
 */
html {
    overflow-y: scroll;
}

@supports (-moz-appearance: none) {
    html,
    body,
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--vbn-scrollbar-thumb) var(--vbn-scrollbar-track);
    }
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: var(--vbn-scrollbar-size);
    height: var(--vbn-scrollbar-size);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: var(--vbn-scrollbar-track);
    border-radius: 0.3rem;
    box-shadow:
        inset 0 2px 8px rgba(0, 0, 0, 0.9),
        inset 0 -1px 0 rgba(245, 230, 211, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.6);
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--bg-darker) 0%,
        var(--vbn-scrollbar-thumb-mid) 38%,
        var(--vbn-scrollbar-thumb) 52%,
        var(--deep-maroon) 100%
    );
    border-radius: 0.3rem;
    border: 1px solid rgba(0, 0, 0, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(245, 230, 211, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(139, 0, 0, 0.35);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        var(--deep-maroon) 0%,
        var(--vbn-scrollbar-thumb) 45%,
        #600000 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(245, 230, 211, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 0 8px rgba(139, 0, 0, 0.55);
}

html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
*::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, var(--deep-maroon) 0%, var(--blood-red) 100%);
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: var(--vbn-scrollbar-track);
}

/* ===== PAGE WRAPPER & MAIN CONTENT ===== */
/* Layout via Bootstrap on markup: .page-wrapper.d-flex.flex-column.min-vh-100 + .main-wrapper.flex-grow-1 */

/* ========================================
   HEADER STYLES
   ======================================== */

.vbng-site-header {
    background: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    border-bottom: 2px solid var(--blood-red);
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* Bootstrap .container handles max-width and margin: 0 auto */
/* Bootstrap utilities handle: .d-flex .justify-content-between .align-items-center .gap-4 */
.header-container {
    /* Bootstrap utilities now handle layout */
}

/* ===== LEFT SECTION: Logo + Title ===== */
/* Bootstrap utilities handle: .d-flex .align-items-center .gap-4 */
.header-left {
    flex: 1;
}

.logo-placeholder {
    flex-shrink: 0;
}

.logo-frame {
    width: 80px;
    height: 80px;
    border: 3px solid var(--blood-red);
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--deep-maroon) 0%, var(--dusk-brown-black) 100%);
    /* Prefer .d-flex .align-items-center .justify-content-center on markup when this class is used */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 0 10px rgba(139, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.logo-frame:hover {
    border-color: #b30000;
    box-shadow: 
        0 0 20px rgba(139, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.logo-initial {
    font-family: var(--font-brand), 'IM Fell English', serif;
    font-size: 28px;
    color: var(--blood-red);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
    font-weight: bold;
    letter-spacing: 2px;
}

/* Bootstrap utilities handle: .d-flex .flex-column .gap-1 */
.title-section {
    /* Bootstrap utilities now handle layout */
}

.site-title {
    font-family: var(--font-brand), 'IM Fell English', serif;
    font-size: 2.2em;
    margin: 0;
    line-height: 1.1;
}

.site-title a {
    color: var(--text-light);
    text-decoration: none;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(139, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.site-title a:hover {
    color: #ffffff;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(139, 0, 0, 0.6);
}

.site-subtitle {
    font-family: var(--font-title), 'Libre Baskerville', serif;
    font-size: 0.9em;
    color: var(--vbn-text-soft);
    font-style: italic;
    margin: 0;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}

/* ===== RIGHT SECTION: User Info + Version ===== */
/* Bootstrap utilities handle: .d-flex .flex-column .align-items-end .gap-1 */
.header-right {
    /* Bootstrap utilities now handle layout */
}

/* Bootstrap utilities handle: .d-flex .align-items-center .gap-2 */
.user-info {
    background: rgba(139, 0, 0, 0.15);
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid rgba(139, 0, 0, 0.3);
}

.user-label {
    font-family: var(--font-title), 'Libre Baskerville', serif;
    font-size: 0.85em;
    color: var(--vbn-text-soft);
    font-style: italic;
}

.username {
    font-family: var(--font-body), 'Source Serif Pro', serif;
    font-size: 1em;
    color: var(--text-light);
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Use Bootstrap .btn .btn-sm .btn-outline-primary with custom theming */
.logout-btn {
    font-family: var(--font-body), 'Source Serif Pro', serif;
    font-size: 0.85em;
    color: var(--text-light);
    background: rgba(139, 0, 0, 0.3);
    border: 1px solid rgba(139, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(139, 0, 0, 0.5);
    border-color: var(--blood-red);
    color: #ffffff;
}

.version-info {
    font-family: var(--font-body), 'Source Serif Pro', serif;
    font-size: 0.75em;
    color: #888;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.version {
    color: #999;
}

/* ===== HEADER RESPONSIVE ===== */
/* Use Bootstrap responsive utilities where possible */
@media (max-width: 768px) {
    :root {
        --sticky-site-header-scroll-margin: 13rem;
    }

    .vbng-site-header {
        padding: 10px 15px;
    }
    
    /* Bootstrap utilities: .flex-column .align-items-start .gap-3 */
    .vbng-site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .vbng-site-header .container > div:first-child {
        width: 100%;
        gap: 15px;
    }
    
    .logo-frame {
        width: 60px;
        height: 60px;
    }
    
    .logo-initial {
        font-size: 22px;
    }
    
    .site-title {
        font-size: 1.6em;
    }
    
    .site-subtitle {
        font-size: 0.8em;
    }
    
    /* Bootstrap utilities: .flex-row .justify-content-between .align-items-center */
    .vbng-site-header .container > div:last-child {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .user-info {
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.3em;
    }
    
    .site-subtitle {
        font-size: 0.7em;
        letter-spacing: 1px;
    }
    
    .user-label {
        display: none;
    }
    
    .logo-frame {
        width: 50px;
        height: 50px;
    }
    
    .logo-initial {
        font-size: 18px;
    }
}

/* ========================================
   FOOTER STYLES
   ======================================== */

.vbng-site-footer {
    background: linear-gradient(0deg, var(--dusk-brown-black) 0%, var(--bg-dark) 100%);
    border-top: 2px solid var(--blood-red);
    box-shadow: 0 -4px 15px rgba(139, 0, 0, 0.3);
    padding: 25px 30px 20px;
    margin-top: 50px;
    width: 100%;
}

/* Bootstrap .container handles max-width and margin: 0 auto */
/* Bootstrap utilities handle: .d-flex .flex-column .align-items-center .gap-3 */
.footer-container {
    /* Bootstrap utilities now handle layout */
}

.footer-content {
    text-align: center;
}

.footer-title {
    font-family: var(--font-brand), 'IM Fell English', serif;
    font-size: 1.8em;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.footer-title a {
    color: var(--text-light);
    text-decoration: none;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(139, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.footer-title a:hover {
    color: #ffffff;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 15px rgba(139, 0, 0, 0.6);
}

.footer-tagline {
    font-family: var(--font-title), 'Libre Baskerville', serif;
    font-size: 0.9em;
    color: var(--vbn-text-soft);
    font-style: italic;
    margin: 0;
    letter-spacing: 2px;
}

.footer-bottom {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid rgba(139, 0, 0, 0.3);
    width: 100%;
}

.copyright,
.disclaimer {
    font-family: var(--font-body), 'Source Serif Pro', serif;
    font-size: 0.85em;
    color: #888;
    margin: 5px 0;
    line-height: 1.4;
}

.disclaimer {
    font-size: 0.75em;
    color: #666;
    font-style: italic;
}

/* ===== FOOTER RESPONSIVE ===== */
@media (max-width: 768px) {
    .vbng-site-footer {
        padding: 20px 15px 15px;
        margin-top: 30px;
    }
    
    .footer-title {
        font-size: 1.4em;
    }
    
    .footer-tagline {
        font-size: 0.8em;
    }
    
    .copyright,
    .disclaimer {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    .footer-title {
        font-size: 1.2em;
    }
    
    .footer-tagline {
        font-size: 0.7em;
        letter-spacing: 1px;
    }
    
    .copyright {
        font-size: 0.7em;
    }
    
    .disclaimer {
        font-size: 0.65em;
    }
}

/* ===== PLAYER ACTIONS ===== */
/* index.php already uses Bootstrap utilities on the action nav.
   Legacy .player-actions / .create-character-btn / .quiz-character-btn kept only for any stray callers. */
.player-actions {
    gap: 20px;
    margin-bottom: 40px;
}

.create-character-btn,
.quiz-character-btn {
    gap: 12px;
    padding: 15px 25px;
    background: linear-gradient(135deg, var(--blood-red) 0%, #660000 100%);
    color: var(--text-light);
    text-decoration: none;
    border: 2px solid var(--blood-red);
    border-radius: 8px;
    font-family: var(--font-title);
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
    min-width: 200px;
}

.create-character-btn:hover,
.quiz-character-btn:hover {
    background: linear-gradient(135deg, #A00000 0%, var(--blood-red) 100%);
    border-color: #A00000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.4);
}

.quiz-character-btn {
    background: linear-gradient(135deg, #4B0082 0%, #2E0854 100%);
    border-color: #4B0082;
    box-shadow: 0 4px 15px rgba(75, 0, 130, 0.3);
}

.quiz-character-btn:hover {
    background: linear-gradient(135deg, #5A0099 0%, #4B0082 100%);
    border-color: #5A0099;
    box-shadow: 0 6px 20px rgba(75, 0, 130, 0.4);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-family: var(--font-title);
}

/* Mobile responsiveness for player actions */
/* Bootstrap utilities: .flex-column .align-items-center */
@media (max-width: 768px) {
    .player-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .create-character-btn,
    .quiz-character-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Touch-friendly interactive elements */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-friendly tables — theme shell only; do not redefine Bootstrap .table-responsive overflow */
.vbn-table-responsive {
    border-radius: 8px;
}

.vbn-table-responsive table {
    min-width: 100%;
    white-space: nowrap;
}

/* Visible focus on modal container for admin dialogs */
.modal:focus {
    outline: 2px solid var(--blood-red);
    outline-offset: 0;
}

/* Accessible focus styles within modals */
.modal .modal-content :focus-visible,
.modal .modal-content button:focus,
.modal .modal-content a:focus,
.modal .modal-content input:focus,
.modal .modal-content select:focus,
.modal .modal-content textarea:focus {
    outline: 2px solid var(--blood-red);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(139, 0, 0, 0.25);
}

/* ===== QUESTIONNAIRE STATISTICS ===== */
.questionnaire-stats {
    background: rgba(26, 15, 15, 0.8);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    display: inline-flex;
    align-items: center;
    gap: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

.questionnaire-stats .stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.questionnaire-stats .stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #c9a96e;
    font-family: var(--font-title);
}

.questionnaire-stats .stat-label {
    font-size: 0.9em;
    color: #ddd;
    margin-top: 4px;
}

.questionnaire-stats .stat-link {
    display: inline-block;
    padding: 8px 16px;
    background: #8b0000;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.questionnaire-stats .stat-link:hover {
    background: #a00000;
    color: white;
    text-decoration: none;
}

/* Responsive raster images: shrink in narrow layouts; never wider than natural size unless a more specific rule sets width. */
img {
    max-width: 100%;
    height: auto;
}

.character-portrait-image {
    box-sizing: border-box;
    display: block;
    max-width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.85rem;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}

/* Reusable utility for the Dark marble-7 texture background. */
.vbn-bg-dark-marble-7 {
    background-image: url('../images/Dark marble-7.jpg');
}

/* ===== Header messages popup (sitewide) ===== */
.vbn-msg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1080;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 4.5rem 1rem 1rem;
}

.vbn-msg-popup {
    width: min(420px, 92vw);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--dusk-brown-black, #1a0f0f);
    border: 1px solid var(--blood-red, #8b0000);
    border-radius: 0.5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.vbn-msg-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(139, 0, 0, 0.5);
    color: var(--text-light, #f0e6e6);
}

.vbn-msg-list {
    overflow-y: auto;
    padding: 0.5rem;
}

.vbn-msg-item {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vbn-msg-item.unread {
    background: rgba(139, 0, 0, 0.12);
}

.vbn-msg-subj {
    color: var(--text-light, #f0e6e6);
    font-weight: 600;
}

.vbn-msg-meta {
    font-size: 0.72rem;
    color: var(--text-mid, #b8a090);
}

.vbn-msg-body {
    color: #d8cccc;
    white-space: pre-wrap;
    margin-top: 0.25rem;
}

.vbn-msg-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-mid, #b8a090);
}

