/* Panel Styles */

/* Panel Styling - Based on D&D Beyond Monster Manual style */
.panel {
    background-color: var(--mm-bg-color);
    background-image: none; /* Remove texture from panels */
    border-radius: 8px;
    box-shadow: 0 5px 8px 0 var(--mm-shadow);
    margin-bottom: 8px;
    border: 1px solid var(--mm-border-color);
    position: relative;
    outline: 1px solid var(--mm-border-color);
    outline-offset: -4px;
    padding: 0;
    align-self: flex-start; /* Don't stretch panels */
    width: 100%; /* Keep full width */
    /* Make panels adapt to their content */
    height: auto;
    overflow: hidden;
}

/* Panel sizes - more appropriate sizing */
.panel.narrow {
    flex: 0 0 auto;
    width: 100%;
}

.panel.medium {
    flex: 0 0 auto;
    width: 100%;
}

.panel.wide {
    flex: 0 0 auto;
    width: 100%;
}

/* Full height panel - fills the available height */
.panel.full-height-panel {
    flex: 1 1 auto;
    min-height: calc(100vh - 80px); /* Account for header and margins */
    display: flex;
    flex-direction: column;
    align-self: stretch;
}

.panel.full-height-panel .panel-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Draggable panel state */
.draggable {
    cursor: move;
}

/* Panel headers with tighter spacing */
.panel-header {
    background-color: transparent;
    color: var(--mm-header-color);
    padding: 6px 10px 2px;
    margin: 0;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border-bottom: none;
    font-family: var(--mm-header-font);
    position: relative;
    z-index: 1;
}

/* Make sure the header stays above the outline */
.panel-header:after {
    content: "";
    display: block;
    width: 100%;
    margin: 3px auto 0;
    height: 2px;
    background: var(--mm-divider-color);
}

/* Different panel types with different header colors */
#conditions .panel-header {
    color: var(--mm-header-color);
}

#combat-actions .panel-header {
    color: #1a3d5a; /* D&D blue */
}

#damage-dying .panel-header {
    color: var(--mm-header-color);
}

#movement-position .panel-header {
    color: #1a3d5a; /* D&D blue */
}

/* Panel theme color classes */
.panel-theme-emerald {
    --panel-color: var(--color-emerald);
}

.panel-theme-sapphire {
    --panel-color: var(--color-sapphire);
}

.panel-theme-ruby {
    --panel-color: var(--color-ruby);
}

.panel-theme-amethyst {
    --panel-color: var(--color-amethyst);
}

.panel-theme-topaz {
    --panel-color: var(--color-topaz);
}

.panel-theme-garnet {
    --panel-color: var(--color-garnet);
}

.panel-theme-slate {
    --panel-color: var(--color-slate);
}

/* Panel header for themed panels */
.panel-theme-emerald .panel-header,
.panel-theme-sapphire .panel-header,
.panel-theme-ruby .panel-header,
.panel-theme-amethyst .panel-header,
.panel-theme-topaz .panel-header,
.panel-theme-garnet .panel-header,
.panel-theme-slate .panel-header {
    color: var(--panel-color);
}

/* Panel content with minimal padding and no scrollbars */
.panel-content {
    padding: 6px 10px 8px;
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
    background-color: transparent;
    margin: 0;
    overflow: visible;
    height: auto;
    min-height: 0;
}

/* Style for intro text above tables */
.intro-text {
    font-style: italic;
    margin-bottom: 0.7rem;
    color: #000;
    border-left: 3px solid var(--mm-divider-color);
    padding-left: 0.6rem;
    line-height: 1.3;
}

.panel-content ul {
    padding-left: 1.5rem;
    margin: 0.25rem 0;
}

/* Standardized list styles in panels */
.panel-content ul, 
.panel-content ol {
    padding-left: 1.4rem;
    margin: 0.5rem 0 0.8rem;
}

/* Remove extra vertical space between elements in panels */
.panel-content > * {
    margin-top: 0;
    margin-bottom: 4px;
}

.panel-content > *:last-child {
    margin-bottom: 0;
}

/* Special sections inside panels */
.special-section {
    background-color: var(--mm-bg-light);
    border: 1px solid var(--mm-border-color);
    border-radius: 5px;
    padding: 0.6rem;
    margin: 0.8rem 0;
    position: relative;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
}

.special-section h3 {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--mm-header-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--mm-divider-color);
}

.special-section h3:after {
    content: "";
    display: block;
    width: 100%;
    margin: 3px auto 0;
    height: 1px;
    background: var(--mm-divider-color);
}

.special-section > div,
.special-section > p {
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* Specific styles for panels with dynamic content */
.panel:has(.fivetools-results) {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
}

/* Update the height constraints for the spells panel */
#dnd-spells {
    max-height: 550px; /* Limit the overall panel height */
    overflow: hidden; /* Hide overflow */
}

#dnd-spells .panel-content {
    max-height: 500px; /* Leave room for header */
    overflow: auto; /* Make content scrollable */
}

/* When viewing spell details, allow the panel to expand */
#dnd-spells:has(.viewing-spell-details) {
    max-height: none;
}

#dnd-spells:has(.viewing-spell-details) .panel-content {
    max-height: none;
} 