/* Import ANSI color support for game color constants */
@import url('ansi_colors.css');

/* Global overrides for Cyborg theme fixes */

/* Fix badge vertical alignment issues */
.badge {
    vertical-align: middle !important;
    line-height: 1.2 !important;
}

/* Override Bootstrap text-muted for better contrast on dark theme */
.text-muted {
    color: #adb5bd !important;
}

/* Form controls - dark theme styling */
.form-control {
    background-color: #495057 !important;
    border-color: #6c757d !important;
    color: #ffffff !important;
}

.form-control:focus {
    background-color: #495057 !important;
    border-color: #80bdff !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.form-control::placeholder {
    color: #adb5bd !important;
    opacity: 1 !important;
}

/* Select dropdowns */
.form-control option {
    background-color: #495057 !important;
    color: #ffffff !important;
}

/* Census page navigation */
.census-nav {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

/* Data field styling */
.field-value {
    font-weight: 500;
}

.field-name {
    font-size: 0.75rem;
    opacity: 0.9;
    font-style: italic;
}

/* Census table styling - minimal custom styling */

/* Force table headers to stay dark - Cyborg theme has broken table-dark */
.census-table thead.table-dark th {
    background-color: #282828 !important;
    color: #fff !important;
    border-color: #000000 !important;
}

/* Sortable table headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable.sorted {
    background-color: rgba(42, 159, 214, 0.3) !important;
}

.sortable i {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.sortable.sorted i {
    opacity: 1;
}

/* Empty cell indicator styling */
.empty-cell-indicator {
    position: relative;
    min-height: 2.5rem;
}

.empty-cell-indicator::before {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #6c757d;
    font-size: 0.875rem;
    opacity: 0.6;
    pointer-events: none;
}

/* Book badge colors - specific color overrides for book references */
/* These ensure proper contrast while maintaining book-specific identity */
.badge[data-book="Chronicles of Darkness, Second Edition"] {
    background-color: #6c757d !important;
    color: white !important;
}

.badge[data-book="Hurt Locker"] {
    background-color: #495057 !important;
    color: white !important;
}

.badge[data-book="Hunter: The Vigil, Second Edition"] {
    background-color: #dc3545 !important;
    color: white !important;
}

.badge[data-book="Werewolf: The Forsaken"] {
    background-color: #d4a574 !important;
    color: white !important;
}

.badge[data-book="Night Horrors: Shunned by the Moon"] {
    background-color: #d4a574 !important;
    color: white !important;
}

.badge[data-book="Changeling: The Lost"] {
    background-color: #87af00 !important;
    color: white !important;
}

.badge[data-book="The Hedge"] {
    background-color: #87af87 !important;
    color: white !important;
}

.badge[data-book="Mostly Harmless Goblin Fruits and Oddments"] {
    background-color: #87d700 !important;
    color: white !important;
}

.badge[data-book="Changeling: The Lost - Swords at Dawn"] {
    background-color: #87d75f !important;
    color: white !important;
}

.badge[data-book="Changeling: The Lost - Dancers in the Dusk"] {
    background-color: #87d787 !important;
    color: white !important;
}

.badge[data-book="Changeling: The Lost - Kith and Kin"] {
    background-color: #87d7af !important;
    color: white !important;
}

.badge[data-book="Book of Seemings"] {
    background-color: #87d7d7 !important;
    color: white !important;
}

.badge[data-book="Promethean: The Created"] {
    background-color: #ffc107 !important;
    color: black !important;
}

.badge[data-book="Changing Breeds"] {
    background-color: #8b4513 !important;
    color: white !important;
}

.badge[data-book="In Nomine"] {
    background-color: #6f42c1 !important;
    color: white !important;
}

.badge[data-book="Wild at Heart"] {
    background-color: #20c997 !important;
    color: white !important;
}

.badge[data-book="War Against the Pure"] {
    background-color: #fd7e14 !important;
    color: white !important;
}

.badge[data-book="World of Darkness: Armory"] {
    background-color: #6c757d !important;
    color: white !important;
}

.badge[data-book="Homebrew"] {
    background-color: #17a2b8 !important;
    color: white !important;
}

/* Card with Line-Tabs styling */
.tab-card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.375rem;
}

.tab-card-header {
    background: #313e45;
    border-bottom: 3px solid black;
    padding: 0;
}

.tab-card-header>.nav-tabs {
    border: none;
    margin: 0px;
}

.tab-card-header>.nav-tabs>.nav-item {
    margin-right: 2px;
}

.tab-card-header>.nav-tabs>.nav-item>.nav-link {
    border: 0;
    border-bottom: 2px solid transparent;
    margin-right: 0;
    color: #6c757d;
    padding: 12px 15px;
    background: none;
    border-radius: 0;
}

.tab-card-header>.nav-tabs>.nav-item>.nav-link.active {
    border-bottom: 2px solid #2a9fd6;
    color: #2a9fd6;
    background: rgba(42, 159, 214, 0.1);
}

.tab-card-header>.nav-tabs>.nav-item>.nav-link:hover {
    color: #2a9fd6;
    border-color: transparent transparent #2a9fd6 transparent;
    background: rgba(42, 159, 214, 0.05);
}

/* ===========================
   SOURCEBOOKS PAGE STYLING
   =========================== */

/* Sourcebooks page styling - compatible with Cyborg theme */
.book-card {
    background-color: var(--bs-gray-800, #343a40);
    border: 1px solid var(--bs-gray-600, #6c757d);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.book-card:hover {
    border-color: var(--bs-primary, #2a9fd6);
    box-shadow: 0 2px 8px rgba(42, 159, 214, 0.2);
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.book-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.book-acronym {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.no-link {
    color: var(--bs-gray-400, #adb5bd);
    font-style: italic;
}

.sphere-section {
    margin-bottom: 3rem;
}

.sphere-header {
    border-bottom: 3px solid var(--bs-primary, #2a9fd6);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.stats-summary {
    background-color: var(--bs-gray-700, #495057);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 2rem;
    border: 1px solid var(--bs-gray-600, #6c757d);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.header-explanation {
    background-color: var(--bs-gray-700, #495057);
    border-left: 4px solid var(--bs-primary, #2a9fd6);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0.375rem;
    border: 1px solid var(--bs-gray-600, #6c757d);
}

.header-explanation p {
    margin-bottom: 0.5rem;
}

.header-explanation p:last-child {
    margin-bottom: 0;
}

/* ===========================
   CHARACTER SHEET STYLING
   =========================== */

/* Profile Image Styling - Fixed 350px */
.profile-image-container {
    /* Fixed 350px container */
    flex-shrink: 0;
    width: 350px;
    height: 350px;
    margin-right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.profile-image {
    /* Fixed 350px square */
    width: 350px;
    height: 350px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.portrait-square {
    /* Fixed 350px square */
    width: 350px;
    height: 350px;
    background: var(--bs-secondary, #555);
    color: var(--bs-light, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(32px, 6vw, 64px);
    font-weight: bold;
    border-radius: 8px;
    border: 2px solid var(--bs-border-color, #6c757d);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Profile content styling moved from profile-box */
.profile-content {
    min-width: 0;
    /* Prevent flex item from growing beyond container */
    background: var(--bs-dark, #343a40);
    border: 1px solid var(--bs-border-color, #6c757d);
    color: var(--bs-light, #f8f9fa);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Profile Box - no styling, just a container */
.profile-box {
    /* Container only - no styling */
}

/* Background classification icon for profile content */
.profile-content.has-bg-icon::before {
    content: '';
    position: absolute;
    transform: rotate(var(--bg-icon-rotation, 20deg));
    transform-origin: center center;
    width: 150%;
    height: 150%;
    background-image: var(--bg-icon);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
}

.profile-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 20px;
}

.profile-divider {
    height: 1px;
    background: var(--bs-border-color, #6c757d);
    margin: 15px 0;
}

.profile-row {
    margin-bottom: 10px;
}

.profile-label {
    font-weight: bold;
}

/* Description and Text Styling */
.description-text {
    line-height: 1.6;
    font-family: inherit;
}

.note-text {
    white-space: pre-wrap;
}

.description-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
}

/* Badge Colors */
.badge-mask {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-mien {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.badge-form {
    background-color: #e8f5e8;
    color: #388e3c;
}

.badge-default {
    background-color: #f5f5f5;
    color: #616161;
}

/* Masonry Gallery Layout */
.masonry-gallery {
    column-count: 1;
    column-gap: 1rem;
    column-fill: balance;
}

@media (min-width: 576px) {
    .masonry-gallery {
        column-count: 2;
    }
}

@media (min-width: 768px) {
    .masonry-gallery {
        column-count: 3;
    }
}

@media (min-width: 1200px) {
    .masonry-gallery {
        column-count: 4;
    }
}

.masonry-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Gallery image styles */
.gallery-image {
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Profile Tab Styling */
.profile-tab {
    margin-top: 30px;
}

.tab-cover {
    text-align: center;
    padding: 40px;
    color: var(--bs-muted, #6c757d);
    font-style: italic;
}

/* ===========================
   ICON SYSTEM STYLES
   =========================== */

/* Character icon sizing */
.character-icon {
    transition: border-color 0.2s ease;
}

.character-icon:hover {
    border-color: var(--bs-primary, #007bff);
}

/* Icon size variants */
.icon-xs {
    width: 16px !important;
    height: 16px !important;
    font-size: 12px !important;
}

.icon-sm {
    width: 24px !important;
    height: 24px !important;
    font-size: 18px !important;
}

.icon-md {
    width: 32px !important;
    height: 32px !important;
    font-size: 24px !important;
}

.icon-lg {
    width: 48px !important;
    height: 48px !important;
    font-size: 36px !important;
}

.icon-xl {
    width: 64px !important;
    height: 64px !important;
    font-size: 48px !important;
}

/* Character display layouts */
.character-display {
    margin: 5px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.character-display:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.character-display-inline {
    min-width: 150px;
}

.character-display-portrait {
    min-width: 80px;
    max-width: 120px;
}

.character-label {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Icon list styling */
.icon-list {
    margin: 8px 0;
}

.icon-list-item {
    padding: 2px 6px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.icon-list-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Status and action icons */
.icon-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.icon-status i {
    flex-shrink: 0;
}

/* Accessibility improvements */
.character-icon,
.icon-list img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* Dark theme adjustments */
.character-display-portrait .character-name a {
    color: var(--bs-light, #f8f9fa);
    text-decoration: none;
}

.character-display-portrait .character-name a:hover {
    color: var(--bs-primary, #007bff);
    text-decoration: underline;
}

/* ===== CHARACTER LIST / CENSUS TABLE STYLES ===== */

/* Character list table rows */
.census-character-row {
    position: relative;
}

/* Icon column styling */
.icon-column {
    width: 70px;
    /* Increased to accommodate 50px icon + padding + borders */
    text-align: center;
    vertical-align: middle;
    /* Center icon vertically in the cell */
}

/* Ensure icon column doesn't expand and centers content properly */
.census-table .icon-column {
    min-width: 70px;
    max-width: 70px;
    vertical-align: middle;
    /* Ensure vertical centering is applied */
    padding: 0;
    /* Remove padding from cell */
}

/* Flex wrapper inside icon column for centering */
.census-table .icon-column>* {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    /* Match icon height for proper centering */
    padding: 4px 2px;
}

/* Fix character icon vertical alignment specifically for census table */
.census-table .character-icon {
    /* Force the icon container to use flex alignment rather than inline-block */
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0;
    /* Remove any default margins */
    vertical-align: middle;
}

/* Ensure the image inside the character icon is properly centered */
.census-table .character-icon img {
    display: block;
    /* Remove inline element spacing issues */
    margin: 0;
    /* Remove any default margins on the img */
    vertical-align: middle;
}

/* Table cell styling - including 3px borders */
.census-character-row td {
    position: relative;
    z-index: 1;
    overflow: hidden;
    /* Apply clipping to cells instead of row for better table compatibility */
    vertical-align: middle;
    /* Center all cell content vertically */
    padding-top: 0.35rem;
    /* Reduced from default 0.75rem */
    padding-bottom: 0.35rem;
    /* Reduced from default 0.75rem */
    border-bottom: 3px solid #000000;
    /* 3px thick black borders between rows */
}

/* PNPC name color - orange */
.text-pnpc {
    color: #fd7e14 !important;
    /* Bootstrap orange for PNPCs */
}

/* Ensure text remains readable on black background by preserving original colors */
.census-table tbody tr:hover td {
    color: inherit;
}

/* Maintain link colors on hover */
.census-table tbody tr:hover a {
    color: inherit;
}

/* ============================================================================
   Tilt and Condition Icon Styling - Character Sheets
   ============================================================================
   Import matching styles from dashboard for consistent icon display.
   Uses ANSI color variables for game theme consistency.
   ============================================================================ */

/* Tilt Icon Color Variables (matches dashboard) */
:root {
    --tilt-icon-bg: #000000;
    --tilt-icon-border: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --tilt-icon-fill: #fff;
    --tilt-icon-text: var(--color-secondary);
    --condition-icon-bg: #000000;
    --condition-icon-border: linear-gradient(135deg, var(--color-tertiary) 0%, var(--color-primary) 100%);
    --condition-icon-fill: #fff;
    --condition-icon-text: var(--color-tertiary);
}

/* Base icon styling for both tilts and conditions */
.effect-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 10px;
    border: 2px solid transparent;
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-sizing: border-box;
}

/* Tilt-specific styling */
.effect-icon.tilt {
    background: var(--tilt-icon-bg);
    color: var(--tilt-icon-text);
    background-image: linear-gradient(var(--tilt-icon-bg), var(--tilt-icon-bg)), var(--tilt-icon-border);
}

/* Condition-specific styling */
.effect-icon.condition {
    background: var(--condition-icon-bg);
    color: var(--condition-icon-text);
    background-image: linear-gradient(var(--condition-icon-bg), var(--condition-icon-bg)), var(--condition-icon-border);
}

/* SVG styling for effect icons */
.effect-icon svg {
    width: 90%;
    height: 90%;
}

/* Override all SVG child element fill attributes */
.effect-icon.tilt svg,
.effect-icon.tilt svg *,
.effect-icon.tilt svg path,
.effect-icon.tilt svg circle,
.effect-icon.tilt svg rect,
.effect-icon.tilt svg polygon,
.effect-icon.tilt svg ellipse {
    fill: var(--tilt-icon-fill) !important;
}

.effect-icon.condition svg,
.effect-icon.condition svg *,
.effect-icon.condition svg path,
.effect-icon.condition svg circle,
.effect-icon.condition svg rect,
.effect-icon.condition svg polygon,
.effect-icon.condition svg ellipse {
    fill: var(--condition-icon-fill) !important;
}

/* Fallback image styling */
.effect-icon img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}