/* Dashboard Styles */
#dashboard-view {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 5rem;
}

.dashboard-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: 0 0 10px var(--accent-glow);
}

.dashboard-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease forwards;
}

.dashboard-section-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.dashboard-section-title:hover {
    color: var(--accent);
}

.dashboard-section-title::after {
    content: '▼';
    font-size: 0.8rem;
    margin-left: auto;
    transition: transform 0.3s;
}

.dashboard-section.collapsed .dashboard-section-title::after {
    transform: rotate(-90deg);
}

.dashboard-section.collapsed .dashboard-cards {
    display: none;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.dash-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dash-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
        0 0 15px var(--accent-glow);
}

.dash-card:hover::before {
    opacity: 1;
}

.dash-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.dash-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 600;
}

.dash-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation delays for cards */
.dash-card:nth-child(1) {
    animation-delay: 0.05s;
}

.dash-card:nth-child(2) {
    animation-delay: 0.1s;
}

.dash-card:nth-child(3) {
    animation-delay: 0.15s;
}

.dash-card:nth-child(4) {
    animation-delay: 0.2s;
}

.dash-card:nth-child(5) {
    animation-delay: 0.25s;
}

/* Dashboard Groups */
.dashboard-group {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.dashboard-group-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    color: var(--text-main);
    font-size: 1.1rem;
}

.dashboard-group-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.dashboard-group-header {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.dashboard-group-header:hover {
    color: var(--accent);
}

.dashboard-group-collapse {
    font-size: 0.8rem;
    margin-right: 0.5rem;
    transition: transform 0.3s;
    display: inline-block;
}

.dashboard-group.collapsed .dashboard-group-collapse {
    transform: rotate(-90deg);
}

.dashboard-group.collapsed .dashboard-cards {
    display: none;
}

/* Bookshelf View */
.dashboard-bookshelf {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    padding: 3rem 2rem 1rem 2rem;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    border-bottom: 25px solid #4a332a;
    /* Dark wood appearance */
    box-shadow: inset 0 -15px 15px rgba(0, 0, 0, 0.6), 0 10px 20px rgba(0, 0, 0, 0.4);
    border-radius: 4px 4px 0 0;
    margin-bottom: 3rem;
    align-items: flex-end;
    position: relative;
}

/* Wood grain texture effect via pseudo element */
.dashboard-bookshelf::after {
    content: '';
    position: absolute;
    bottom: -25px;
    /* Cover the border */
    left: 0;
    width: 100%;
    height: 25px;
    background: repeating-linear-gradient(90deg, #4a332a, #4a332a 5px, #422d25 5px, #422d25 10px);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
    z-index: 0;
}

.physical-book {
    width: 160px;
    height: 230px;
    background-size: cover;
    background-position: center;
    border-radius: 2px 10px 10px 2px;
    /* Binding left, pages right */
    box-shadow:
        inset 6px 0 12px rgba(0, 0, 0, 0.6),
        /* Deep spine shadow */
        inset -3px 0 5px rgba(255, 255, 255, 0.3),
        /* Light reflecting on page edge */
        6px 5px 15px rgba(0, 0, 0, 0.6);
    /* Cast shadow */
    cursor: pointer;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: left center;
    border-left: 6px solid rgba(0, 0, 0, 0.6);
    /* The spine fold */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    z-index: 1;
    /* Stay above wood grain */
    /* Give default dark edge to right side to look like pages */
    border-right: 2px solid rgba(255, 255, 255, 0.1);
}

.physical-book:hover {
    transform: perspective(800px) rotateY(-18deg) scale(1.08) translateY(-10px);
    z-index: 10;
    box-shadow:
        inset 8px 0 15px rgba(0, 0, 0, 0.7),
        inset -2px 0 5px rgba(255, 255, 255, 0.4),
        15px 15px 25px rgba(0, 0, 0, 0.7);
}

.book-cover-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffd700;
    /* Gold text to match defaults */
    text-shadow:
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        0px 5px 10px rgba(0, 0, 0, 0.9);
    padding: 0 1.5rem;
    width: 100%;
    margin-top: -1.5rem;
    /* The blue frame has a thicker top boundary, adjust visually */
    box-sizing: border-box;
}

/* Make chapters span entire width by breaking out of flex row */
.book-chapters-grid {
    flex-basis: 100%;
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--bg-panel);
    border-radius: 8px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    position: relative;
    z-index: 5;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}