/* ========================================
   SPELLBOOK MAIN STYLES - FIXED TOGGLE + VIVID CYAN
   Slimmer toggle, cyan for Action/Bonus Speed stats
   ======================================== */

.spellbook-page {
    background: linear-gradient(135deg, #0a0a0f 0%, #12121a 50%, #0d0d15 100%);
}

/* Canvas specific to spellbook */
.spellbook-canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    display: none;
}

body.spellbook-page .spellbook-canvas-container {
    display: block;
}

body.spellbook-page .grimoire-canvas-container,
body.spellbook-page .about-canvas-container,
body.spellbook-page .click-runes-canvas-container {
    display: none;
}

/* Container */
#spellbookPage {
    position: relative;
    z-index: 1;
}

/* Header - Vivid Purple */
#spellbookPage .header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    z-index: 2;
}

#spellbookPage .logo {
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    font-family: 'Lora', serif;
    line-height: 1.2;
    color: #a78bfa;
    text-shadow: 0 2px 16px rgba(167, 139, 250, 0.5);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-box {
    position: relative;
}

.stat-box input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 1.05rem;
    font-family: 'Lora', serif;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
}

.stat-box input:hover {
    border-color: rgba(167, 139, 250, 0.5);
    background: rgba(20, 20, 28, 0.95);
}

.stat-box input:focus {
    outline: none;
    border-color: rgba(167, 139, 250, 0.7);
    background: rgba(20, 20, 28, 1);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(167, 139, 250, 0.15);
    transform: translateY(-1px);
}

.stat-box input::placeholder {
    color: #6b7280;
    font-weight: 400;
    font-style: italic;
}

/* Input help icons for stat boxes */
.stat-box .input-help-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(167, 139, 250, 0.2);
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 50%;
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    transition: all 0.3s ease;
    z-index: 10;
}

.stat-box .input-help-icon:hover {
    background: rgba(167, 139, 250, 0.3);
    border-color: rgba(167, 139, 250, 0.6);
    transform: scale(1.15);
}

/* Calculated Stats Display - CLEAN & READABLE */
.calculated-stats {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 14px;
    padding: 24px;
    margin-top: 24px;
    position: relative;
}

.calculated-stats h3 {
    color: #c4b5fd;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    font-family: 'Lora', serif;
    text-shadow: 0 1px 8px rgba(167, 139, 250, 0.4);
}

.stats-display-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.stat-display {
    background: rgba(15, 15, 20, 0.95);
    padding: 16px 14px;
    text-align: center;
    border: 1px solid rgba(107, 155, 213, 0.25);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(107, 155, 213, 0.15), transparent);
    transition: left 0.5s;
}

.stat-display:hover {
    border-color: rgba(107, 155, 213, 0.4);
    box-shadow: 0 4px 16px rgba(107, 155, 213, 0.2);
    transform: translateY(-2px);
}

.stat-display:hover::before {
    left: 100%;
}

/* PURPLE STATS - Containment, Daily, Signature */
.stat-display[data-stat="containment"],
.stat-display[data-stat="daily"],
.stat-display[data-stat="signature"] {
    border-color: rgba(167, 139, 250, 0.35);
}

.stat-display[data-stat="containment"]:hover,
.stat-display[data-stat="daily"]:hover,
.stat-display[data-stat="signature"]:hover {
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.25);
}

.stat-display[data-stat="containment"] .stat-value,
.stat-display[data-stat="daily"] .stat-value,
.stat-display[data-stat="signature"] .stat-value {
    color: #c4b5fd;
    text-shadow: 0 1px 8px rgba(167, 139, 250, 0.4);
}

/* CYAN STATS - Action Speed, Bonus Speed */
.stat-display[data-stat="action-speed"],
.stat-display[data-stat="bonus-speed"] {
    border-color: rgba(0, 217, 255, 0.35);
}

.stat-display[data-stat="action-speed"]:hover,
.stat-display[data-stat="bonus-speed"]:hover {
    border-color: rgba(0, 217, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.3);
}

.stat-display[data-stat="action-speed"] .stat-value,
.stat-display[data-stat="bonus-speed"] .stat-value {
    color: #00ffcc;
    text-shadow: 0 1px 8px rgba(0, 255, 204, 0.5);
}

/* HIDE ONLY CASTING SPEED */
.stat-display[data-stat="casting-speed"] {
    display: none !important;
}

.stat-display .stat-label {
    color: #9ca3af;
    font-size: 0.7rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    font-family: 'Lora', serif;
}

.stat-display .stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: 'Lora', serif;
}

/* Tooltip icon in top-right corner of stat displays */
.stat-display .stat-tooltip-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(167, 139, 250, 0.2);
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 50%;
    color: #c4b5fd;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    transition: all 0.3s ease;
    z-index: 10;
}

.stat-display .stat-tooltip-icon:hover {
    background: rgba(167, 139, 250, 0.3);
    border-color: rgba(167, 139, 250, 0.6);
    transform: scale(1.15);
}

/* ========================================
   TOGGLE WRAPPER & BUTTONS - Unified System
   ======================================== */

/* Wrapper holds toggle buttons + settings button */
.spell-list-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 24px 0;
    position: relative;
    z-index: 10;
}

/* Toggle buttons container */
.spell-list-toggle {
    display: flex;
    gap: 0;
    background: rgba(20, 20, 30, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 4px;
    border: 2px solid rgba(167, 139, 250, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.spell-list-toggle:hover {
    border-color: rgba(167, 139, 250, 0.6);
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.3);
}

.spell-list-toggle-btn {
    background: transparent;
    color: #9ca3af;
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Lora', serif;
    letter-spacing: 0.02em;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.spell-list-toggle-btn:hover {
    color: #d1d5db;
    background: rgba(167, 139, 250, 0.05);
}

.spell-list-toggle-btn.active {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.5);
    transform: scale(1.02);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Empty State */
.empty-spellbook {
    text-align: center;
    padding: 80px 40px;
    color: #6b7280;
}

.empty-spellbook-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-spellbook p {
    font-size: 1rem;
    line-height: 1.6;
    color: #9ca3af;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    #spellbookPage .logo {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-display-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .spell-list-toggle-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .spell-list-toggle {
        width: 100%;
        padding: 3px;
    }
    
    .spell-list-toggle-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-display-grid {
        grid-template-columns: 1fr;
    }
    
    .spell-list-toggle-btn {
        padding: 7px 12px;
        font-size: 0.75rem;
    }
}