/**
 * TrinityDC Network Search Autocomplete
 * Plugin Version: 0.1.5
 * File: assets/css/autocomplete-custom.css
 * File Version: 0.1.5-001
 * Last Updated: 2025-10-15
 * 
 * Purpose: Custom styling for autocomplete dropdown and modal details (supports both www2 and discover)
 * 
 * Changelog:
 * 0.1.5-001: Added positioning fixes for discover's #nav-search form
 * 0.1.4-002: Fixed - kept h3 name at original size/weight (24px)
 * 0.1.4-001: Reduced suggestion font size by 2px, added 2px padding top/bottom, adjusted modal spacing
 * 0.1.2-006: New modal approach - centered modal with backdrop overlay
 * 0.1.2-005: Position details absolutely within inner-wrap, below the content
 * 0.1.2-004: Updated positioning - details relative to .col.span_12, static positioning to flow naturally
 * 0.1.2-003: Fixed details positioning - use absolute positioning to overlay instead of pushing content
 * 0.1.2-002: Added position relative to search-box for absolute positioning context
 * 0.1.1-004: Simplified - removed full-screen expansion, ensure dropdown visible
 * 0.1.1-003: Fixed vertical centering issue, removed borders/shadows, stay expanded until close
 * 0.1.1-002: Fixed layout issues - full width, larger padding/font, full-screen presentation
 * 0.1.1-001: Initial version
 */

/* ========================================
   WWW2.TRINITYDC.EDU SEARCH FORM STYLES
   ======================================== */

/* Make search input full width */
#search-box input[name="q"] { 
    width: 100% !important;
    max-width: 100% !important;
}

/* Override Awesomplete default styling to match Trinity search form */
#search-box .awesomplete {
    display: block;
    width: 100% !important;
    position: relative;
}

/* Ensure search-outer can accommodate dropdown without clipping */
#search-outer {
    overflow: visible !important;
}

#search {
    overflow: visible !important;
}

.container {
    overflow: visible !important;
}

#search-box {
    overflow: visible !important;
}

/* Make sure the container doesn't constrain width */
#search-box .inner-wrap,
#search-box .col.span_12 {
    width: 100%;
}

#search-box .awesomplete > ul {
    width: 100%;
}

/* ========================================
   DISCOVER.TRINITYDC.EDU SEARCH FORM STYLES
   ======================================== */

/* Ensure nav-search can accommodate dropdown */
#nav-search {
    overflow: visible !important;
    position: relative;
}

#nav-search .container {
    overflow: visible !important;
}

/* Make search input full width in discover form */
#nav-search input[name="q"] {
    width: 100% !important;
}

/* Awesomplete container for discover */
#nav-search .awesomplete {
    display: block;
    width: 100% !important;
    position: relative;
}

/* Position dropdown correctly for discover form */
#nav-search .awesomplete > ul {
    width: 100% !important;
    top: 100% !important; /* Position directly below the input */
    left: 0 !important;
    margin-top: 0 !important; /* Remove extra margin that was pushing it up */
}

/* ========================================
   SHARED AUTOCOMPLETE DROPDOWN STYLES
   ======================================== */

/* Override Awesomplete default styling */
.awesomplete {
    display: block;
    width: 100% !important;
}

/* Autocomplete dropdown */
.awesomplete > ul {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    padding: 0;
    list-style: none;
    z-index: 999999; /* High z-index to appear above everything */
    position: absolute !important;
    width: 100% !important;
}

.awesomplete > ul[hidden] {
    display: none;
}

/* Individual suggestion items */
.awesomplete > ul > li {
    padding: 18px 20px; /* Increased from 16px to 18px (added 2px top/bottom) */
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    color: #333333;
    font-size: 18px; /* Reduced from 20px to 18px (2px smaller) */
    line-height: 1.5;
    background: #ffffff;
}

/* Remove border from last item */
.awesomplete > ul > li:last-child {
    border-bottom: none;
} 

/* Hover state */
.awesomplete > ul > li:hover,
.awesomplete > ul > li[aria-selected="true"] {
    background: #f5f5f5;
}

/* Highlighted text within suggestions */
.awesomplete mark {
    background: rgba(254,210,65,0.3) !important;
    color: #333333;
    font-weight: 600;
    padding: 0;
}

/* ========================================
   MODAL STYLES FOR PERSON/OFFICE DETAILS
   ======================================== */

/* Modal container */
.trinitydc-nsa-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999; /* Above everything, including search overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal backdrop/scrim */
.trinitydc-nsa-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Modal content box */
.trinitydc-nsa-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1; /* Above backdrop */
}

/* Modal content text styles */
.trinitydc-nsa-modal-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 24px; /* Keep original size */
    font-weight: bold; /* Keep original weight */
    color: #333333;
    padding-right: 40px; /* Make room for close button */
}

.trinitydc-nsa-modal .trinitydc-nsa-modal-content p {
    margin: 0 !important;
    padding: 0 !important;
    padding-bottom: 0 !important;
    color: #666666;
    font-size: 16px;
    line-height: 1.6;
}

.trinitydc-nsa-modal .trinitydc-nsa-modal-content p.title {
    font-style: italic;
    color: #888888;
    font-size: 16px;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.trinitydc-nsa-modal .trinitydc-nsa-modal-content p.department {
    color: #888888;
    font-size: 16px;
    margin-bottom: 16px !important;
    padding-bottom: 0 !important;
}

.trinitydc-nsa-modal .trinitydc-nsa-modal-content p:not(.title):not(.department):not(:last-of-type) {
    margin-bottom: 8px !important;
    padding-bottom: 0 !important;
}

.trinitydc-nsa-modal .trinitydc-nsa-modal-content strong {
    color: #333333;
    font-weight: 600;
}

/* Remove margin from last paragraph */
.trinitydc-nsa-modal-content p:last-of-type {
    margin-bottom: 0;
}

.trinitydc-nsa-modal-content strong {
    color: #333333;
    font-weight: 600;
}

.trinitydc-nsa-modal-content a {
    color: #0066cc;
    text-decoration: none;
}

.trinitydc-nsa-modal-content a:hover {
    text-decoration: underline;
}

/* Close button */
.trinitydc-nsa-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.trinitydc-nsa-modal-close:hover {
    color: #333333;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .trinitydc-nsa-modal {
        padding: 10px;
    }
    
    .trinitydc-nsa-modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    
    .trinitydc-nsa-modal-content h3 {
        font-size: 20px;
    }
    
    .trinitydc-nsa-modal-content p {
        font-size: 14px;
    }
    
    .trinitydc-nsa-modal-content p.title {
        font-size: 14px;
    }
    
    .trinitydc-nsa-modal-content p.department {
        font-size: 14px;
    }
}