/* D&D Playbook CSS Stylesheet */

:root {
    --bg-primary: #0b0c10;
    --bg-secondary: #14151b;
    --bg-tertiary: #1b1e25;
    --card-bg: rgba(27, 30, 37, 0.65);
    
    --accent-red: #8b0000;
    --accent-red-glow: rgba(139, 0, 0, 0.4);
    --gold-color: #d4af37;
    --gold-light: #f3c63f;
    --gold-glow: rgba(212, 175, 55, 0.35);
    
    --text-primary: #e0e0e6;
    --text-secondary: #a0a2b0;
    --text-muted: #6e707d;
    --border-color: rgba(212, 175, 55, 0.15);
    --border-glow: rgba(212, 175, 55, 0.3);
    
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-speed: 0.25s;
    --border-radius: 8px;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --gold-gradient: linear-gradient(135deg, #d4af37 0%, #aa7c11 100%);
    --dark-gradient: linear-gradient(185deg, #181a22 0%, #0d0e12 100%);
}

[data-theme="light"] {
    --bg-primary: #f5f4ef;
    --bg-secondary: #eae6db;
    --bg-tertiary: #dfdaca;
    --card-bg: rgba(223, 218, 202, 0.7);
    
    --accent-red: #a31d1d;
    --accent-red-glow: rgba(163, 29, 29, 0.25);
    --gold-color: #996515;
    --gold-light: #b8860b;
    --gold-glow: rgba(153, 101, 21, 0.2);
    
    --text-primary: #2d2a26;
    --text-secondary: #5a544c;
    --text-muted: #8c8273;
    --border-color: rgba(153, 101, 21, 0.25);
    --border-glow: rgba(153, 101, 21, 0.4);
    --glass-shadow: 0 6px 20px 0 rgba(45, 42, 38, 0.15);
    --dark-gradient: linear-gradient(185deg, #eae6db 0%, #dfdaca 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    border: 1px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold-color);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: background-color var(--transition-speed);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 26px;
    color: var(--gold-color);
    text-shadow: 0 0 10px var(--gold-glow);
    animation: pulse 3s infinite ease-in-out;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 1px;
    background: linear-gradient(to right, var(--text-primary), var(--gold-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    flex-grow: 1;
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.menu-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    transition: color var(--transition-speed);
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--gold-color);
    padding-left: 13px;
}

.menu-item.active {
    color: var(--gold-light);
    background-color: var(--card-bg);
    border-left: 3px solid var(--gold-color);
    padding-left: 13px;
    box-shadow: inset 5px 0 15px -5px var(--gold-glow);
}

.menu-item.active i {
    color: var(--gold-color);
    text-shadow: 0 0 8px var(--gold-glow);
}

.menu-divider {
    margin: 15px 16px 8px 16px;
    font-family: var(--font-heading);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: #2ec4b6;
    box-shadow: 0 0 8px rgba(46, 196, 182, 0.6);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--dark-gradient);
}

.top-bar {
    height: 70px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.page-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 16px 10px 40px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all var(--transition-speed);
}

.search-box input:focus {
    border-color: var(--gold-color);
    box-shadow: 0 0 10px var(--gold-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Quick Search Dropdown */
.quick-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.quick-search-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-speed);
    border-bottom: 1px solid rgba(212, 175, 55, 0.05);
}

.quick-search-item:last-child {
    border-bottom: none;
}

.quick-search-item:hover {
    background-color: var(--bg-tertiary);
}

.quick-search-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gold-light);
}

.quick-search-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.action-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.action-btn:hover {
    border-color: var(--gold-color);
    color: var(--gold-light);
    box-shadow: 0 0 8px var(--gold-glow);
}

/* Views wrapper container */
.view-wrapper {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    position: relative;
}

.view-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.view-section.hidden {
    display: none !important;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    font-family: var(--font-heading);
    color: var(--gold-color);
    font-size: 18px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* ==========================================================================
   VIEW: DASHBOARD
   ========================================================================== */

.hero-banner {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.4) 0%, rgba(20, 21, 27, 0.9) 100%), 
                border-box;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--glass-shadow);
}

.hero-content h2 {
    font-family: var(--font-heading);
    font-size: 28px;
    color: var(--gold-light);
    margin-bottom: 8px;
    text-shadow: 0 0 10px var(--gold-glow);
}

.hero-content p {
    color: var(--text-secondary);
    max-width: 600px;
    font-size: 15px;
    line-height: 1.6;
}

.d20-floating {
    font-size: 60px;
    color: var(--gold-color);
    opacity: 0.8;
    filter: drop-shadow(0 0 15px var(--gold-glow));
    animation: float 6s infinite ease-in-out;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.stat-cards-container {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-speed);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    border-color: var(--gold-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--gold-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(212, 175, 55, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gold-color);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-panel {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
}

.dash-panel h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--gold-light);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gold-icon {
    color: var(--gold-color);
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.favorites-grid.wide {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.fav-card {
    background-color: rgba(11, 12, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-speed);
}

.fav-card:hover {
    border-color: var(--gold-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--gold-glow);
}

.fav-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    color: var(--gold-light);
    margin-bottom: 6px;
    padding-right: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fav-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fav-remove-btn {
    position: absolute;
    top: 14px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-speed);
}

.fav-remove-btn:hover {
    color: var(--accent-red);
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mini-dice-widget, .tip-of-the-day-widget {
    background-color: rgba(11, 12, 16, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
}

.dice-roller-mini-ui {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.roll-d20-btn {
    flex-grow: 1;
    background: var(--gold-gradient);
    color: #0b0c10;
    border: none;
    padding: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.roll-d20-btn:hover {
    box-shadow: 0 0 15px var(--gold-glow);
    filter: brightness(1.1);
}

.mini-roll-result {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 2px dashed var(--gold-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--gold-light);
}

.mini-roll-result.rolling {
    animation: rotateDice 0.5s infinite linear;
}

.tip-of-the-day-widget p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    font-style: italic;
}

/* ==========================================================================
   SPLIT VIEW: RULES
   ========================================================================== */

.split-view {
    display: flex;
    gap: 30px;
    height: calc(100vh - 190px);
    overflow: hidden;
}

.split-sidebar {
    width: 250px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.split-sidebar h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--gold-light);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.rule-categories-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rule-cat-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.rule-cat-item:hover {
    background-color: rgba(212, 175, 55, 0.05);
    color: var(--text-primary);
}

.rule-cat-item.active {
    background-color: var(--bg-primary);
    color: var(--gold-light);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px var(--gold-glow);
}

.split-main {
    flex-grow: 1;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.rule-details-container {
    height: 100%;
}

.rule-details-header {
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gold-color);
    padding-bottom: 12px;
}

.rule-details-header h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    color: var(--gold-light);
    text-shadow: 0 0 8px var(--gold-glow);
}

.rule-sections-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.rule-section-tab {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.rule-section-tab:hover {
    border-color: var(--gold-color);
    color: var(--text-primary);
}

.rule-section-tab.active {
    background: var(--gold-gradient);
    color: #0b0c10;
    border-color: transparent;
    font-weight: 600;
}

.rule-html-content {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 14px;
}

.rule-html-content h3 {
    font-family: var(--font-heading);
    color: var(--gold-light);
    margin: 20px 0 10px 0;
    font-size: 18px;
}

.rule-html-content p {
    margin-bottom: 14px;
}

.rule-html-content ul, .rule-html-content ol {
    margin: 10px 0 20px 24px;
}

.rule-html-content li {
    margin-bottom: 6px;
}

.rule-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 13px;
}

.rule-html-content th, .rule-html-content td {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.rule-html-content th {
    background-color: var(--bg-secondary);
    color: var(--gold-light);
    font-family: var(--font-heading);
}

.rule-html-content tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   GRID LISTS: CLASSES, RACES
   ========================================================================== */

.classes-grid, .races-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.class-card, .race-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.class-card:hover, .race-card:hover {
    border-color: var(--gold-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--gold-glow);
}

.class-header, .race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.class-name, .race-name {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--gold-light);
}

.class-icon, .race-icon {
    font-size: 22px;
    color: var(--gold-color);
}

.class-desc, .race-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 18px;
    flex-grow: 1;
}

.class-meta, .race-meta {
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.class-meta span strong, .race-meta span strong {
    color: var(--text-primary);
}

/* ==========================================================================
   VIEW: SPELLS, MONSTERS, EQUIPMENT
   ========================================================================== */

.filter-bar {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 20px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.filter-group.search {
    flex-grow: 2;
}

.filter-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-group select, .filter-group input {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-speed);
}

.filter-group select:focus, .filter-group input:focus {
    border-color: var(--gold-color);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.item-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    cursor: pointer;
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 140px;
}

.item-card:hover {
    border-color: var(--gold-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--gold-glow);
}

.item-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    color: var(--gold-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.item-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: auto;
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.item-tag {
    font-size: 10px;
    background-color: rgba(212, 175, 55, 0.08);
    color: var(--gold-color);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.12);
}

.item-tag.level-tag {
    background-color: rgba(139, 0, 0, 0.1);
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.15);
}

.item-tag.cr-tag {
    background-color: rgba(46, 196, 182, 0.1);
    color: #2ec4b6;
    border-color: rgba(46, 196, 182, 0.15);
}

/* ==========================================================================
   VIEW: DICE ROLLER
   ========================================================================== */

.dice-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 30px;
    min-height: calc(100vh - 190px);
}

.dice-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
}

.dice-card h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--gold-light);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.dice-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.die-select-btn {
    background-color: rgba(11, 12, 16, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-speed);
}

.die-select-btn:hover {
    border-color: var(--gold-light);
}

.die-shape {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: #0b0c10;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-speed);
}

.die-shape:hover {
    transform: scale(1.1);
}

.die-number {
    z-index: 2;
}

/* Custom Die Shapes with SVGs or styling */
.d4 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,10 90,80 10,80" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }
.d6 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="15" y="15" width="70" height="70" rx="10" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }
.d8 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,5 90,50 50,95 10,50" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }
.d10 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,5 90,40 50,95 10,40" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }
.d12 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,5 92,35 76,85 24,85 8,35" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }
.d20 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,5 95,30 95,70 50,95 5,70 5,30" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; text-shadow: 0 0 3px rgba(255,255,255,0.4); }
.d100 { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="%23d4af37"/></svg>') no-repeat center/contain; color: #0b0c10; }

.die-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 4px;
}

.die-counter button {
    background: none;
    border: none;
    color: var(--gold-color);
    cursor: pointer;
    font-weight: bold;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.die-counter button:hover {
    color: var(--gold-light);
}

.count-val {
    font-size: 13px;
    font-weight: 600;
    min-width: 14px;
    text-align: center;
}

.dice-modifier-container {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.dice-modifier-container label {
    font-family: var(--font-heading);
    font-size: 14px;
    color: var(--text-secondary);
}

.modifier-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2px;
}

.modifier-input-wrapper button {
    background: none;
    border: none;
    color: var(--gold-color);
    font-size: 16px;
    font-weight: bold;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.modifier-input-wrapper input {
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: center;
    width: 50px;
    outline: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
}

/* Remove spin buttons from number input */
.modifier-input-wrapper input::-webkit-outer-spin-button,
.modifier-input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dice-formula {
    background-color: rgba(11, 12, 16, 0.4);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    font-family: var(--font-heading);
    color: var(--gold-light);
    font-size: 16px;
    letter-spacing: 0.5px;
    margin-bottom: 24px;
}

.dice-actions {
    display: flex;
    gap: 16px;
}

.dice-action-btn {
    flex-grow: 1;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 14px 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dice-action-btn:hover {
    border-color: var(--gold-color);
    color: var(--text-primary);
}

.dice-action-btn.primary {
    background: var(--gold-gradient);
    color: #0b0c10;
    border-color: transparent;
    box-shadow: 0 4px 15px var(--gold-glow);
}

.dice-action-btn.primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 20px var(--gold-glow);
}

.current-roll-display {
    height: 180px;
    background-color: rgba(11, 12, 16, 0.4);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.total-result-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 14px;
}

.roll-total-value {
    font-family: var(--font-heading);
    font-size: 72px;
    font-weight: 900;
    color: var(--gold-light);
    text-shadow: 0 0 20px var(--gold-glow);
    line-height: 1;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.roll-breakdown {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
    max-width: 90%;
}

.roll-history-container {
    height: calc(100% - 320px);
    overflow-y: auto;
}

.roll-history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.roll-history-item {
    background-color: rgba(11, 12, 16, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.05);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.hist-formula {
    color: var(--text-secondary);
}

.hist-breakdown {
    color: var(--text-muted);
    font-style: italic;
}

.hist-total {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-light);
}

.empty-history {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding-top: 20px;
}

/* ==========================================================================
   VIEW: DRAFT SHEET
   ========================================================================== */

.draft-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    align-items: start;
}

.draft-config {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
}

.draft-config h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--gold-light);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.form-group input, .form-group select {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-speed);
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--gold-color);
}

.draft-rolls-holder {
    background-color: rgba(11, 12, 16, 0.4);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-top: 14px;
}

.draft-rolls-holder strong {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.rolled-values-list {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.rolled-stat-val {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gold-light);
    cursor: grab;
}

/* Character Sheet Preview */
.character-sheet-card {
    background-color: #f4efdf;
    border: 4px double #5c4015;
    border-radius: 4px;
    padding: 30px;
    color: #2b251e;
    box-shadow: var(--glass-shadow);
}

.sheet-header {
    border-bottom: 2px solid #5c4015;
    padding-bottom: 16px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
}

.sheet-field {
    border-bottom: 1px solid #5c4015;
    padding-bottom: 4px;
}

.field-value {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #5c4015;
    min-height: 28px;
}

.field-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6e6357;
    margin-top: 2px;
    font-weight: 700;
}

.sheet-fields-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sheet-body {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 24px;
}

.sheet-stats-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ability-score-box {
    border: 1px solid #5c4015;
    border-radius: 8px;
    background-color: #fffdf5;
    height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    position: relative;
}

.ability-name {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    color: #6e6357;
}

.ability-modifier {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #2b251e;
    background-color: #fffdf5;
    width: 32px;
    height: 32px;
    border: 1px solid #5c4015;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: -10px;
    z-index: 2;
}

.ability-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
    width: 44px;
    border: none;
    background: transparent;
    text-align: center;
    color: #5c4015;
    outline: none;
    margin-bottom: 6px;
}

/* Hide spin buttons */
.ability-value::-webkit-outer-spin-button,
.ability-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sheet-details-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sheet-panel-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.sheet-stat-bubble {
    border: 1px solid #5c4015;
    background-color: #fffdf5;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bubble-value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #5c4015;
}

.bubble-label {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    color: #6e6357;
    text-align: center;
    margin-top: 2px;
}

.sheet-traits-box {
    border: 1px solid #5c4015;
    background-color: #fffdf5;
    border-radius: 6px;
    padding: 16px;
}

.sheet-traits-box h4 {
    font-family: var(--font-heading);
    font-size: 13px;
    color: #5c4015;
    border-bottom: 1px solid #5c4015;
    padding-bottom: 4px;
    margin-bottom: 10px;
}

.sheet-traits-box ul {
    list-style: none;
    padding-left: 0;
}

.sheet-traits-box li {
    font-size: 11.5px;
    line-height: 1.5;
    margin-bottom: 6px;
    padding-left: 12px;
    position: relative;
}

.sheet-traits-box li::before {
    content: "•";
    color: #5c4015;
    position: absolute;
    left: 0;
}

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.sheet-btn {
    background-color: #5c4015;
    color: #fffdf5;
    border: 1px solid #2b251e;
    padding: 10px 18px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.sheet-btn:hover {
    background-color: #7b5924;
    box-shadow: 0 4px 10px rgba(92, 64, 21, 0.3);
}

/* ==========================================================================
   DETAIL MODAL OVERLAY
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    backdrop-filter: blur(5px);
    transition: opacity var(--transition-speed);
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 2px solid var(--gold-color);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    box-shadow: 0 0 40px var(--gold-glow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlide 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 26px;
    cursor: pointer;
    z-index: 1010;
    transition: color var(--transition-speed);
}

.modal-close:hover {
    color: var(--gold-light);
}

.modal-bookmark {
    position: absolute;
    top: 18px;
    right: 48px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    z-index: 1010;
    transition: color var(--transition-speed);
}

.modal-bookmark:hover, .modal-bookmark.active {
    color: var(--gold-light);
}

.modal-content {
    overflow-y: auto;
    padding: 30px;
    flex-grow: 1;
}

/* Modal Content Types */
.modal-title {
    font-family: var(--font-heading);
    font-size: 28px;
    color: var(--gold-light);
    margin-bottom: 4px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 20px;
    text-transform: capitalize;
}

/* Spell Details Modal Specific */
.spell-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
}

.spell-meta-item {
    font-size: 13px;
}

.spell-meta-item strong {
    color: var(--gold-light);
    display: block;
    margin-bottom: 2px;
}

.modal-desc-box {
    margin-top: 16px;
}

.modal-desc-box h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--gold-light);
    margin-bottom: 8px;
}

.modal-desc-box p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

/* D&D Monster Stat Block Styling */
.monster-stat-block {
    background-color: #fdfaf3;
    color: #2b251e;
    font-family: Georgia, serif;
    border: 1px solid #ddccbb;
    border-top: 6px solid #e69a28;
    border-bottom: 6px solid #e69a28;
    padding: 20px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.monster-stat-block h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    color: #9c2a2a;
    margin-bottom: 4px;
}

.monster-stat-block .m-type {
    font-style: italic;
    font-size: 12px;
    color: #5c534c;
    margin-bottom: 12px;
    display: block;
}

.monster-stat-block hr {
    border: 0;
    height: 2px;
    background-color: #9c2a2a;
    margin: 8px 0;
}

.monster-stat-block .stat-line {
    font-size: 13.5px;
    margin-bottom: 6px;
}

.monster-stat-block .stat-line strong {
    color: #9c2a2a;
}

/* Attributes grid for monsters */
.m-attributes-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    text-align: center;
    margin: 12px 0;
}

.m-attr-box {
    font-size: 12px;
}

.m-attr-name {
    font-weight: bold;
    color: #9c2a2a;
    text-transform: uppercase;
    display: block;
}

.m-attr-val {
    font-size: 14px;
}

.m-section-title {
    font-family: var(--font-heading);
    font-size: 16px;
    color: #9c2a2a;
    border-bottom: 1px solid #9c2a2a;
    margin: 14px 0 8px 0;
    padding-bottom: 2px;
}

.m-ability-desc {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.m-ability-desc strong {
    font-style: italic;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px var(--gold-glow)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 15px var(--gold-glow)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--gold-glow)); }
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes rotateDice {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes modalSlide {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   FAVORITES PAGE STYLING
   ========================================================================== */

.favorites-full-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.favorites-categories {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.fav-cat-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition-speed);
}

.fav-cat-btn:hover {
    border-color: var(--gold-color);
    color: var(--text-primary);
}

.fav-cat-btn.active {
    background: var(--gold-gradient);
    color: #0b0c10;
    border-color: transparent;
    box-shadow: 0 4px 10px var(--gold-glow);
}
