/* custom.css - Variable-Based Theming */

/* 1. DEFAULT THEME (Blue Mode) */
:root {
    /* --- CORE COLORS --- */
    --bs-body-bg: rgba(43,62,80,1);
    --bs-body-color: rgba(235,235,235,1);

    /* --- TEXT & BG OVERRIDES (Fixes the Black Text Issues) --- */
    /* This forces .text-body-emphasis to be White */
    --bs-emphasis-color: #ffffff;

    /* This forces .text-muted / .small to be light gray */
    --bs-secondary-color: rgba(235,235,235, 0.6);

    /* This forces .bg-body-tertiary (Card BG) to be White (as you requested) */
    --bs-tertiary-bg: #ffffff;

    /* --- CUSTOM BRUKE VARIABLES --- */
    --bruke-nav-bg: rgba(72,101,131,1.00);
    --bruke-nav-color: rgba(255,255,255,0.95);
    --bruke-link-hover: #34d8ed;

    /* Button Colors for Blue Mode */
    --bruke-btn-color: #cccccc; /* Light Gray */
    --bruke-btn-border: #cccccc;
    --bruke-btn-hover-bg: #ffffff;
    --bruke-btn-hover-text: #333333;

    --bruke-hr-color: #ffffff;
    --bruke-hr-opacity: 0.5;
}

/* DARK MODE OVERRIDES */
[data-bs-theme="dark"] {
    /* Reset Bootstrap variables to dark mode defaults */
    --bs-body-bg: #212529;
    --bs-body-color: #dee2e6;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(222, 226, 230, 0.75);
    --bs-tertiary-bg: rgba(255,255,255,0.05); /* Transparent/Grey in Dark Mode */

    /* Update Custom Variables */
    --bruke-nav-bg: #343a40;
    --bruke-nav-color: rgba(255,255,255,0.55);

    /* Button Colors for Dark Mode */
    --bruke-btn-color: #6c757d;
    --bruke-btn-border: #6c757d;
    --bruke-btn-hover-bg: #bbbbbb;
    --bruke-btn-hover-text: #000;

    --bruke-hr-color: inherit;
    --bruke-hr-opacity: 0.25;
}

/* 2. APPLY VARIABLES */

/* Navbar */
.bruke-navbar {
    background-color: var(--bruke-nav-bg);
    transition: background-color 0.3s ease;
}

.bruke-navbar .navbar-brand,
.bruke-navbar .nav-link {
    color: var(--bruke-nav-color);
    font-weight: 500;
}

.bruke-navbar .nav-link:hover {
    color: var(--bruke-link-hover);
}

/* Dropdowns */
.dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 0;
}

/* Horizontal Rules */
hr {
    color: var(--bruke-hr-color);
    opacity: var(--bruke-hr-opacity);
}

/* Spotlight Images */
.spotlight img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

/* 3. CUSTOM BUTTON CLASS (The "Gray" Button) */
/* We create a custom class so we don't have to fight btn-secondary or btn-light logic */
.btn-bruke {
    color: var(--bruke-btn-color);
    border-color: var(--bruke-btn-border);
    background-color: transparent;
}

.btn-bruke:hover {
    color: var(--bruke-btn-hover-text);
    background-color: var(--bruke-btn-hover-bg);
    border-color: var(--bruke-btn-hover-bg);
}

/* --- GAMES OVERVIEW STYLES --- */

/* 1. MAP CONTAINER */
.map-container {
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.map-pin {
    position: absolute;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -100%);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.map-pin img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

.map-pin:hover {
    transform: translate(-50%, -120%) scale(1.2);
    z-index: 10;
}

/* 2. 3D FLIP CARDS */
.flip-card {
    background-color: transparent;
    width: 100%;
    /* Aspect ratio for the card */
    aspect-ratio: 2.5 / 3.5;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 8px;
}

.character-link:hover .flip-card-inner,
.character-link:focus .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
}

.flip-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flip-card-back {
    background-color: var(--bruke-nav-bg);
    color: #fff;
    transform: rotateY(180deg);
    border: 2px solid rgba(255,255,255,0.2);
}

.character-link { display: block; }
.character-link:hover { text-decoration: none; }


/* --- SCOPED VARIABLE OVERRIDES (No !important) --- */
/* We target the card specifically in "Blue Mode" (not dark).
   Instead of forcing properties, we redefine the variables that
   Bootstrap uses for text colors inside this scope.
*/
/* --- SCOPED VARIABLE OVERRIDES (Corrected Selector) --- */

/* FIX: We must check 'html' (the root), not 'body', because that is where
   the Javascript applies the data-bs-theme attribute.
*/
html:not([data-bs-theme="dark"]) .card {
    /* Tell inputs inside the card that the 'background' here is white */
    --bs-body-bg: #ffffff;

    /* Standard Text Colors for Light Mode (Blue Theme) */
    --bs-body-color: #212529;        /* Standard Dark Text */
    --bs-secondary-color: #6c757d;   /* Standard Grey Muted Text */
    --bs-heading-color: #212529;     /* Dark Headings */
    --bs-link-color: #0d6efd;        /* Standard Blue Links */
    --bs-link-hover-color: #0a58ca;

    /* Ensure the text actually uses these variables */
    color: var(--bs-body-color);
}

/* --- BACK TO TOP BUTTON --- */
#btn-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: none; /* Hidden by default */
    z-index: 999; /* Ensure it sits on top of tables/maps */
    border-radius: 50%;
    width: 50px;
    height: 50px;

    /* Ensure visibility against page content */
    background-color: var(--bruke-nav-bg);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

#btn-back-to-top:hover {
    background-color: var(--bruke-link-hover); /* Your Cyan Hover Color */
    color: #000;
}