/* css/glossary.css */

/* --- GLOSSARY GRID LAYOUT --- */
.glossary-grid {
    display: grid;
    /* 3 columns on medium/large screens, 2 on small, 1 on extra small */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem; /* Gap between grid items */
}

/* Base style for the term card in the grid */
.glossary-item {
    cursor: pointer;
    border-radius: 12px;
    background-color: rgba(30, 41, 59, 0.7); /* slate-800 semi-transparent */
    transition: all 0.2s;
    border: 1px solid transparent;
}

.glossary-item:hover {
    border-color: #6366f1; /* Indigo border on hover */
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.glossary-item-term {
    padding: 1.25rem;
}

/* --- MODAL STYLING --- */
#definition-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 17, 23, 0.9); /* Deep dark background */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#definition-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content-wrapper {
    background: #1e293b; /* slate-800 */
    border: 2px solid #6366f1; /* Primary accent border */
    border-radius: 16px;
    max-width: 700px;
    max-height: 90vh;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#definition-modal.open .modal-content-wrapper {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #334155; /* slate-700 */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close-btn:hover {
    color: #a5b4fc; /* light indigo */
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: #cbd5e1;
}


/* --- RICH TEXT CONTENT STYLING (Inside Modal Body) --- */
.definition-content p { margin-bottom: 1rem; color: #cbd5e1; line-height: 1.7; }
.definition-content strong { color: #a5b4fc; font-weight: 700; }
.definition-content em { font-style: italic; color: #94a3b8; }
.definition-content ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 1rem; color: #cbd5e1; }
.definition-content ol { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 1rem; color: #cbd5e1; }
.definition-content li { margin-bottom: 0.5rem; }

/* Auto-Linked Terms (Inside Modal Body) */
.definition-content a.glossary-link { 
    color: #818cf8; 
    text-decoration: none; 
    border-bottom: 1px dashed #6366f1;
    transition: all 0.2s;
    cursor: pointer;
}
.definition-content a.glossary-link:hover { 
    background: rgba(99, 102, 241, 0.1);
    color: #fff;
    border-bottom-style: solid;
}