/* ========================================
   DIMENSIONARIUM - LIGHT MODE THEME
   Fantasy/RPG Academy Style
   ======================================== */

:root {
    --gold-primary: #d3b26c;
    --gold-secondary: #c9a961;
    --gold-dark: #b39653;
    --purple-primary: #4a2c5f;
    --purple-light: #6d4a8e;
    --blue-accent: #2d5a7b;
    --bg-light: #f8f5f0;
    --bg-card: #ffffff;
    --text-primary: #2c2416;
    --text-secondary: #5a5040;
    --border-color: #e0d5c7;
    --shadow: rgba(42, 28, 18, 0.08);
}

/* ========== GLOBAL STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lora', Georgia, serif;
    background: linear-gradient(135deg, #f8f5f0 0%, #ede8e0 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: 80px;
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--purple-primary);
    letter-spacing: 0.5px;
}

/* ========== NAVBAR ========== */
.navbar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 245, 240, 0.98) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--gold-primary);
    box-shadow: 0 4px 20px var(--shadow);
    padding: 0.8rem 0;
}

.navbar-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(211, 178, 108, 0.4));
    transition: transform 0.3s ease;
}

.navbar-logo:hover {
    transform: scale(1.05);
}

.brand-text {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-toggler {
    border-color: var(--gold-primary);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23d3b26c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem;
}

.nav-link:hover {
    color: var(--gold-primary) !important;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-secondary));
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

.btn-nav-logout {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-light) 100%);
    color: white !important;
    border-radius: 20px;
    padding: 0.4rem 1.2rem;
}

.btn-nav-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 44, 95, 0.3);
}

.btn-theme-toggle {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.btn-theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 4px 16px rgba(211, 178, 108, 0.4);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    min-height: calc(100vh - 180px);
    padding: 2rem 0;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    box-shadow: 0 8px 24px var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(42, 28, 18, 0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-light) 100%);
    color: white;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--gold-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ========== BUTTONS ========== */
.btn {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 44, 95, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 44, 95, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #3a7d5a 0%, #4a9d6a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(58, 125, 90, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(58, 125, 90, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #9d4a4a 0%, #b35a5a 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(157, 74, 74, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(157, 74, 74, 0.4);
}

.btn-outline-primary {
    border: 2px solid var(--purple-primary);
    color: var(--purple-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--purple-primary);
    color: white;
}

.btn-outline-secondary {
    border: 2px solid var(--text-secondary);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--text-secondary);
    color: white;
}

/* ========== FORMS ========== */
.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 0.2rem rgba(211, 178, 108, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ========== TABLES ========== */
.table {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-light) 100%);
    color: white;
    font-family: 'Cinzel', serif;
    border: none;
    padding: 1rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--bg-light);
    transform: scale(1.01);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(248, 245, 240, 0.5);
}

/* ========== PROGRESS BARS ========== */
.progress {
    height: 24px;
    background: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar {
    background: linear-gradient(90deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.6s ease;
}

/* ========== BADGES ========== */
.badge {
    font-family: 'Cinzel', serif;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
}

.bg-primary {
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-light) 100%) !important;
}

.bg-success {
    background: linear-gradient(135deg, #3a7d5a 0%, #4a9d6a 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #9d4a4a 0%, #b35a5a 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #d4a54a 0%, #e5b55a 100%) !important;
}

/* ========== YEARBOOK ========== */
.yearbook-img-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    position: relative;
}

.yearbook-img-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(74, 44, 95, 0.1) 100%);
    pointer-events: none;
}

.yearbook-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.3s ease;
}

.card:hover .yearbook-img {
    transform: scale(1.05);
}

/* ========== ALERTS ========== */
.alert {
    border-radius: 10px;
    border-left: 4px solid;
    box-shadow: 0 4px 12px var(--shadow);
}

.alert-success {
    border-left-color: #4a9d6a;
    background: linear-gradient(135deg, rgba(58, 125, 90, 0.1) 0%, rgba(74, 157, 106, 0.1) 100%);
}

.alert-danger {
    border-left-color: #9d4a4a;
    background: linear-gradient(135deg, rgba(157, 74, 74, 0.1) 0%, rgba(179, 90, 90, 0.1) 100%);
}

.alert-warning {
    border-left-color: #d4a54a;
    background: linear-gradient(135deg, rgba(212, 165, 74, 0.1) 0%, rgba(229, 181, 90, 0.1) 100%);
}

.alert-info {
    border-left-color: var(--blue-accent);
    background: linear-gradient(135deg, rgba(45, 90, 123, 0.1) 0%, rgba(65, 110, 143, 0.1) 100%);
}

/* ========== FOOTER ========== */
.footer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 245, 240, 0.98) 100%);
    border-top: 2px solid var(--gold-primary);
    padding: 2rem 0;
    color: var(--text-secondary);
    box-shadow: 0 -4px 20px var(--shadow);
}

/* ========== PAGE NAVIGATION ========== */
.page-nav {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 4px 12px var(--shadow);
}

.page-title h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.page-title h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-primary), transparent);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar-logo {
        height: 50px;
    }
    
    .page-title h2 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}


/* === Shared design tokens and accessibility === */
:root {
  --font-body: 'Lora', Georgia, serif;
  --font-heading: 'Cinzel', serif;

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 15px;

  --shadow-1: 0 2px 8px rgba(0,0,0,.12);
  --shadow-2: 0 6px 18px rgba(0,0,0,.18);
  --shadow-glow: 0 0 20px rgba(229,197,118,.25);

  --t-fast: .15s;
  --t-base: .3s;
  --ease: cubic-bezier(.2,.8,.2,1);

  --navbar-h: 72px;
}

:root { color-scheme: light dark; }

html, body {
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.btn, .badge, .card-header, .modal-header {
  font-family: var(--font-heading);
}

:focus-visible {
  outline: 3px solid #e5c576;
  outline-offset: 2px;
}

/* Logical props where safe */
.container, .card, .btn { margin-inline: auto; }

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Utilities */
.shadow-1 { box-shadow: var(--shadow-1); }
.shadow-2 { box-shadow: var(--shadow-2); }
.grad-gold { background: linear-gradient(135deg, #e5c576 0%, #d9b866 100%); }
.grad-purple { background: linear-gradient(135deg, #7d5a9d 0%, #9d7abd 100%); }

/* Fixed navbar helper */
.has-fixed-navbar { padding-top: var(--navbar-h); }


/* Fluid type for headings */
h1 { font-size: clamp(2rem, 1.2rem + 2.2vw, 3rem); }
h2 { font-size: clamp(1.6rem, 1.0rem + 1.8vw, 2.4rem); }
h3 { font-size: clamp(1.3rem, .9rem + 1.2vw, 1.8rem); }

/* === Fix: .table-dark bleibt im Light-Mode hell === */
body:not(.dark-mode) .table-dark{
  /* Basiston hellsetzen */
  --bs-table-color: #111;
  --bs-table-bg: #ffffff;
  --bs-table-border-color: rgba(0,0,0,.15);

  /* Stripes/Hover */
  --bs-table-striped-color: #111;
  --bs-table-striped-bg: rgba(0,0,0,.02);
  --bs-table-hover-color: #111;
  --bs-table-hover-bg: rgba(0,0,0,.04);

  /* WICHTIG: State/Type-Kette neutralisieren, damit der inset-Fill nicht dunkel/grün wird */
  --bs-table-bg-state: transparent;
  --bs-table-bg-type: transparent;
  --bs-table-color-state: initial;
  --bs-table-color-type: initial;
}

/* Tabellenzellen erhalten oft den inset-Fill: hier sicherstellen, dass er weiß ist */
body:not(.dark-mode) .table-dark > :not(caption) > *{
  box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-bg)));
}

/* Light: .table-dark sauber aufhellen + Zebra + Hover */
body:not(.dark-mode) .table-dark{
  --bs-table-color:#111;
  --bs-table-bg:#fff;
  --bs-table-border-color:rgba(0,0,0,.15);
  --bs-table-striped-bg:rgba(0,0,0,.04);
  --bs-table-hover-bg:rgba(0,0,0,.06);
  --bs-table-bg-state:transparent;
  --bs-table-bg-type:transparent;
}

/* Grundfüllung (weiß) über inset-Fill */
body:not(.dark-mode) .table-dark > :not(caption) > *{
  box-shadow: inset 0 0 0 9999px var(--bs-table-bg);
}

/* Zebra-Streifen */
body:not(.dark-mode) .table-dark.table-striped > tbody > tr:nth-of-type(odd) > *{
  box-shadow: inset 0 0 0 9999px var(--bs-table-striped-bg);
}

/* Hover-Zeile */
body:not(.dark-mode) .table-dark.table-hover > tbody > tr:hover > *{
  box-shadow: inset 0 0 0 9999px var(--bs-table-hover-bg);
}

.object-fit-cover { object-fit: cover; }
.object-fit-contain { object-fit: contain; background-color: var(--bs-body-bg); }
.character-card .badge { vertical-align: middle; }

.portrait-9x16 {
  width: 100%;
  aspect-ratio: 9 / 16;
}
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }


/* === Character card stats grid and tooltip defaults === */
.character-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem .75rem;
}
@media (min-width: 576px) {
  .character-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .character-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.character-stats .stat {
  display: flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  gap: .25rem;
}

/* Light tooltip contrast */
.tooltip {
  --bs-tooltip-bg: #212529;
  --bs-tooltip-color: #fff;
  --bs-tooltip-opacity: 1;
}




/* === Character image + level-card sync hooks ===
   Ziel: Bild-Card richtet sich NUR nach der Höhe der Level-Fortschritt-Card.
   Umsetzung: Höhe über CSS-Var --level-card-h (per JS gesetzt). Bild skaliert vollständig sichtbar.
*/
#level-table-card {
  /* signalisiert Größe für Observer; keine Layoutänderung */
  contain: size layout style;
}

#char-image-card {
  /* Standard: auto, wird via --level-card-h überschrieben */
  height: var(--level-card-h, auto);
  overflow: hidden;
}

#char-image-card .card-body {
  padding: 0; /* maximale nutzbare Fläche für das Bild */
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-image-container {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* Bild bleibt komplett sichtbar */
  display: block;
}

/* Sicherheitsnetz: falls die Row fälschlich "align-items-stretch" bekommt, neutralisieren */
.row.align-items-stretch #level-table-card,
.row.align-items-stretch #char-image-card {
  align-self: auto;
}

/* Verhindere, dass Tabellen-Card auf volle Höhe gezwungen wird */
#level-table-card .card-body { height: auto; }

