/* --- css/guild-tool-modal.css --- */

#guild-tool-modal.tool-modal-container {
    position: fixed; /* Fixed position to cover the whole viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--guild-modal-overlay); /* This IS your dimmer! Semi-transparent overlay. */
                                                 /* Make sure --guild-modal-overlay is defined, e.g., rgba(0, 0, 0, 0.6); */
    display: none; /* Initially hidden, JS toggles to 'flex' or 'block' */
    justify-content: center; /* Centers .tool-modal-content horizontally */
    align-items: center;   /* Centers .tool-modal-content vertically */
    z-index: 1000;         /* Ensure it's on top of other page content */
    opacity: 0;            /* Start fully transparent for fade-in */
    transition: opacity 0.3s ease-in-out; /* Transition for the dimmer opacity */
    padding: 20px;         /* Padding for smaller screens, so modal content doesn't touch edges */
    box-sizing: border-box;
}

#guild-tool-modal.tool-modal-container.visible {
    display: flex; /* Or 'block' if you don't need flex centering for the container itself */
    opacity: 1;    /* Fade in the dimmer */
}

#guild-tool-modal .tool-modal-content {
    background-color: var(--guild-parchment-bg);
    color: var(--guild-text-main);
    padding: 25px 30px;
    border-radius: 8px;
    border: 2px solid var(--guild-wood-dark);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(var(--guild-wood-light-rgb), 0.15);
    max-width: 650px; /* Max width of the modal dialog */
    width: 90%;       /* Responsive width for smaller screens */
    max-height: 88vh; /* Max height relative to viewport height */
    overflow-y: auto; /* Add scrollbar if content is taller than max-height */
    position: relative; /* For absolute positioning of the close button */
    transform: translateY(-20px) scale(0.95); /* Start slightly up and smaller for entry animation */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease-in-out 0.1s; /* Entry animation for modal content, opacity delayed slightly */
    opacity: 0; /* Start modal content transparent for animation */
    display: flex; /* Using flex for internal layout of modal content */
    flex-direction: column;
}

#guild-tool-modal.tool-modal-container.visible .tool-modal-content {
    transform: translateY(0) scale(1); /* Animate to final position and size */
    opacity: 1; /* Fade in modal content */
}

/* Scrollbar styling for the modal content (optional) */
#guild-tool-modal .tool-modal-content::-webkit-scrollbar {
    width: 10px;
}
#guild-tool-modal .tool-modal-content::-webkit-scrollbar-track {
    background: rgba(var(--guild-wood-light-rgb), 0.2);
    border-radius: 5px;
}
#guild-tool-modal .tool-modal-content::-webkit-scrollbar-thumb {
    background: var(--guild-wood-medium);
    border-radius: 5px;
    border: 1px solid var(--guild-wood-light);
}
#guild-tool-modal .tool-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--guild-wood-light);
}


#guild-tool-modal .tool-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-family: var(--font-guild-title);
    font-size: 2rem;
    font-weight: bold;
    color: var(--guild-wood-medium);
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10; /* Ensure close button is above modal header content if they overlap */
}
#guild-tool-modal .tool-modal-close:hover {
    color: var(--guild-red-accent);
    transform: scale(1.1);
}

#guild-tool-modal .tool-modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--guild-parchment-border);
    flex-shrink: 0; /* Prevent header from shrinking if content is sparse */
}

#guild-tool-modal #tool-modal-icon { /* For <img> tool icons */
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 20px;
    border: 1px solid var(--guild-parchment-border);
    border-radius: 4px;
    padding: 3px;
    background-color: rgba(var(--guild-wood-light-rgb),0.1);
    flex-shrink: 0; /* Prevent icon from shrinking */
}
/* For Font Awesome icons if any are still used in modal */
#guild-tool-modal #tool-modal-icon.fas,
#guild-tool-modal #tool-modal-icon.fab {
    font-size: 3em; /* Adjust as needed */
    color: var(--guild-wood-dark);
    margin-right: 20px;
    width: 60px; /* Match <img> width for alignment */
    height: 60px; /* Match <img> height for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

#guild-tool-modal #tool-modal-title {
    font-family: var(--font-guild-title);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: var(--guild-text-header);
    margin: 0;
    line-height: 1.2;
    flex-grow: 1; /* Allow title to take available space */
}

#guild-tool-modal .tool-modal-body-content {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
    flex-grow: 1; /* Allow body to take available vertical space if needed, before Aljohn note */
    overflow-y: auto; /* If just this section needs to scroll independently */
    /* Consider removing overflow-y here if the main .tool-modal-content scroll is preferred */
}
#guild-tool-modal .tool-modal-body-content strong {
    font-family: var(--font-guild-heading);
    color: var(--guild-wood-dark);
}
#guild-tool-modal .tool-modal-body-content .rating {
    font-family: var(--font-guild-body);
    font-weight: bold;
    font-style: normal;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--guild-parchment-bg) !important;
    margin-left: 5px;
    font-size: 0.9em;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
    display: inline-block; /* Ensure it behaves well with margin-left */
}
#guild-tool-modal .tool-modal-body-content .rating.rating-essential { background-color: var(--guild-red-accent); }
#guild-tool-modal .tool-modal-body-content .rating.rating-highly-recommended { background-color: var(--guild-green-accent); }
#guild-tool-modal .tool-modal-body-content .rating.rating-recommended { background-color: var(--guild-gold-deep); }
#guild-tool-modal .tool-modal-body-content .rating.rating-briefly-at-start { background-color: var(--guild-wood-medium); }

#guild-tool-modal .tool-modal-body-content ul {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
    margin-bottom: 15px;
}
#guild-tool-modal .tool-modal-body-content ul li {
    margin-bottom: 10px;
    padding-left: 22px;
    position: relative;
}
#guild-tool-modal .tool-modal-body-content ul li::before {
    content: '•'; /* Or Font Awesome: '\f005' */
    /* font-family: 'Font Awesome 6 Free'; font-weight: 900; */
    color: var(--guild-gold-accent);
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.2em;
    line-height: 1;
}

#guild-tool-modal .tool-modal-body-content .btn-tool-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 18px;
    background-color: var(--guild-wood-medium);
    color: var(--guild-text-on-dark);
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid var(--guild-wood-dark);
    font-family: var(--font-guild-heading);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}
#guild-tool-modal .tool-modal-body-content .btn-tool-link:hover {
    background-color: var(--guild-wood-light);
    border-color: var(--guild-gold-accent);
    transform: translateY(-1px);
}

#guild-tool-modal .tool-modal-aljohn-note-content {
    margin-top: 5px;
    padding: 5px;
    border-top: 1px solid var(--guild-parchment-border);
    background-color: rgba(var(--guild-wood-light-rgb), 0.08);
    border-radius: 0 0 5px 5px; /* Rounded bottom corners */
    flex-shrink: 0; /* Prevent this section from shrinking if content above is sparse */
}
#guild-tool-modal .tool-modal-aljohn-note-content strong {
    font-family: var(--font-guild-heading);
    color: var(--guild-red-accent);
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
}
#guild-tool-modal .tool-modal-aljohn-note-content p {
    margin: 0;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--guild-wood-medium);
    line-height: 1.6;
}

/* Responsive for modal */
@media (max-width: 768px) {
    #guild-tool-modal .tool-modal-content {
        padding: 20px;
        max-height: 90vh;
        width: 95%; /* Take more width on smaller screens */
    }
    #guild-tool-modal #tool-modal-title {
        font-size: clamp(1.4rem, 3.5vw, 1.8rem);
    }
    #guild-tool-modal #tool-modal-icon,
    #guild-tool-modal #tool-modal-icon.fas,
    #guild-tool-modal #tool-modal-icon.fab {
        width: 45px;
        height: 45px;
        font-size: 2.5em; /* For FA */
        margin-right: 15px;
    }
}

@media (max-width: 480px) {
    #guild-tool-modal .tool-modal-content {
        padding: 15px;
    }
     #guild-tool-modal .tool-modal-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    #guild-tool-modal #tool-modal-icon,
    #guild-tool-modal #tool-modal-icon.fas,
    #guild-tool-modal #tool-modal-icon.fab {
        width: 40px;
        height: 40px;
        font-size: 2.2em;
        margin-right: 10px;
    }
    #guild-tool-modal #tool-modal-title {
        font-size: clamp(1.2rem, 3vw, 1.6rem);
    }
    #guild-tool-modal .tool-modal-body-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }
     #guild-tool-modal .tool-modal-aljohn-note-content {
        padding: 10px;
        font-size: 0.9rem;
    }
}