/* Gire Orthodontic Dictionary Widget Styles */

.nx-od-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    min-height: 100vh;
}

/* Search Box Styles */
.nx-od-container .nx-od-search-box {
    position: relative !important;
    margin-bottom: 30px !important;
}

.nx-od-container .nx-od-search-input,
.nx-od-container input.nx-od-search-input,
.nx-od-container input[type="text"].nx-od-search-input {
    width: 100% !important;
    height: 60px !important;
    padding: 0 24px 0 60px !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 25px !important;
    outline: none !important;
    background: white !important;
    color: #1a202c !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.nx-od-container .nx-od-search-input:focus,
.nx-od-container input.nx-od-search-input:focus,
.nx-od-container input[type="text"].nx-od-search-input:focus {
    border-color: #4a90e2 !important;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15) !important;
}

.nx-od-container .nx-od-search-input:hover,
.nx-od-container input.nx-od-search-input:hover,
.nx-od-container input[type="text"].nx-od-search-input:hover {
    border-color: #cbd5e0 !important;
}

.nx-od-container .nx-od-search-box::before {
    content: '' !important;
    position: absolute !important;
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    background-image: url('../icons/search.svg') !important;
    background-size: 20px 20px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    opacity: 0.5 !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

.nx-od-search-input::placeholder {
    color: #94a3b8;
}

/* Category Navigation Styles */
.nx-od-category-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
}

.nx-od-container .nx-od-category-btn,
.nx-od-container button.nx-od-category-btn,
.nx-od-container .nx-od-category-btn:not(:disabled) {
    display: inline-block !important;
    background: #4a90e2 !important;
    background-color: #4a90e2 !important;
    color: white !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.nx-od-container .nx-od-category-btn:hover,
.nx-od-container button.nx-od-category-btn:hover,
.nx-od-container .nx-od-category-btn.active,
.nx-od-container button.nx-od-category-btn.active,
.nx-od-container .nx-od-category-btn:not(:disabled):hover,
.nx-od-container .nx-od-category-btn:not(:disabled).active {
    background: #005bac !important;
    background-color: #005bac !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0, 91, 172, 0.3) !important;
}

.nx-od-category-btn:active {
    transform: translateY(0);
}

/* Content Area Styles */
.nx-od-content-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    min-height: 400px;
}

/* Section Styles */
.nx-od-section {
    margin-bottom: 50px;
}

.nx-od-section:last-child {
    margin-bottom: 0;
}

.nx-od-section-title {
    color: #005bac;
    font-size: 2em;
    margin-bottom: 25px;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    line-height: 1.3;
}

.nx-od-section-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(74, 144, 226, 0.15) 100%);
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.1);
}

.nx-od-section-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.2);
    border-color: rgba(74, 144, 226, 0.3);
}

.nx-od-section-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Term Styles */
.nx-od-term {
    margin-bottom: 25px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.nx-od-term:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.15);
    border-color: #4a90e2;
}

.nx-od-term-name {
    color: #005bac;
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.3;
}

.nx-od-term-description {
    color: #555;
    line-height: 1.6;
    font-size: 1.05em;
    margin: 0;
}

/* Only add extra bottom margin when term has read more link */
.nx-od-has-read-more .nx-od-term-description {
    margin-bottom: 35px;
}

/* Read More Link */
.nx-od-read-more-link {
    position: absolute !important;
    bottom: 15px !important;
    right: 15px !important;
    color: #4a90e2 !important;
    text-decoration: none !important;
    font-size: 0.9em !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    z-index: 2 !important;
}

.nx-od-read-more-link:hover {
    color: #005bac !important;
    text-decoration: none !important;
}

.nx-od-read-more-link:hover .nx-od-arrow {
    transform: translateX(3px) !important;
}

.nx-od-read-more-link:focus {
    outline: 2px solid #4a90e2 !important;
    outline-offset: 2px !important;
    color: #005bac !important;
    text-decoration: none !important;
}

.nx-od-read-more-link:visited {
    color: #4a90e2 !important;
    text-decoration: none !important;
}

.nx-od-arrow {
    display: inline-block !important;
    transition: transform 0.3s ease !important;
    font-size: 1.1em !important;
    line-height: 1 !important;
}

/* No Results Message */
.nx-od-no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.2em;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #005bac;
}

.nx-od-no-results::before {
    content: "🔍";
    display: block;
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Preview Message for Editor */
.nx-od-preview-message {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #e6f3fc 0%, #cce8ff 100%);
    border: 2px dashed #005bac;
    border-radius: 15px;
    color: #005bac;
}

.nx-od-preview-message p {
    font-size: 1.2em;
    margin: 0;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nx-od-container {
        padding: 15px;
    }
    
    .nx-od-content-area {
        padding: 20px;
    }
    
    .nx-od-section-title {
        font-size: 1.5em;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .nx-od-section-icon {
        width: 50px;
        height: 50px;
        font-size: 1em;
    }
    
    .nx-od-section-icon img {
        width: 32px;
        height: 32px;
    }
    
    .nx-od-category-nav {
        gap: 8px;
    }
    
    .nx-od-category-btn {
        padding: 8px 20px;
        font-size: 0.9em;
    }
    
    .nx-od-search-input {
        font-size: 1em;
        padding: 12px 15px;
    }
    
    .nx-od-term {
        padding: 15px;
    }
    
    .nx-od-term-name {
        font-size: 1.2em;
    }
    
    .nx-od-term-description {
        font-size: 1em;
    }
    
    /* Only add extra bottom margin on mobile when term has read more link */
    .nx-od-has-read-more .nx-od-term-description {
        margin-bottom: 40px; /* More space on mobile for link */
    }
    
    .nx-od-read-more-link {
        font-size: 0.85em !important;
        bottom: 12px !important;
        right: 12px !important;
    }
}

@media (max-width: 480px) {
    .nx-od-category-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .nx-od-category-btn {
        width: 200px;
        text-align: center;
    }
    
    .nx-od-search-box {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .nx-od-content-area {
        padding: 15px;
        border-radius: 15px;
    }
    
    .nx-od-section {
        margin-bottom: 40px;
    }
    
    .nx-od-section-title {
        font-size: 1.3em;
        padding-bottom: 8px;
    }
    
    .nx-od-read-more-link {
        font-size: 0.8em !important;
        bottom: 10px !important;
        right: 10px !important;
    }
}

/* Animation for smooth loading */
.nx-od-term {
    opacity: 1;
    display: block;
}

.nx-od-term.nx-od-loaded {
    animation: nx-od-fadeInUp 0.6s ease forwards;
}

.nx-od-term.nx-od-loaded:nth-child(1) { animation-delay: 0.1s; }
.nx-od-term.nx-od-loaded:nth-child(2) { animation-delay: 0.2s; }
.nx-od-term.nx-od-loaded:nth-child(3) { animation-delay: 0.3s; }
.nx-od-term.nx-od-loaded:nth-child(4) { animation-delay: 0.4s; }
.nx-od-term.nx-od-loaded:nth-child(5) { animation-delay: 0.5s; }

@keyframes nx-od-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure terms are visible by default */
.nx-od-term {
    display: block !important;
    opacity: 1 !important;
}

.nx-od-term[style*="display: none"] {
    display: none !important;
}

/* Screen reader only content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Search results count */
.nx-od-results-count {
    color: #64748b !important;
    font-style: italic !important;
    margin-bottom: 20px !important;
    padding: 10px !important;
    background: #f8f9fa !important;
    border-left: 3px solid #4a90e2 !important;
}

/* Modern search match highlighting */
.nx-od-term.nx-od-search-match {
    animation: nx-od-highlight 0.8s ease-out !important;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.03) 0%, rgba(74, 144, 226, 0.08) 100%) !important;
    border: 1px solid rgba(74, 144, 226, 0.3) !important;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
    position: relative !important;
}

.nx-od-term.nx-od-search-match::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 3px !important;
    background: linear-gradient(90deg, #4a90e2, #005bac) !important;
    border-radius: 12px 12px 0 0 !important;
}

@keyframes nx-od-highlight {
    0% { 
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.12) 0%, rgba(74, 144, 226, 0.18) 100%) !important;
        border-color: rgba(74, 144, 226, 0.5) !important;
        box-shadow: 0 8px 30px rgba(74, 144, 226, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        transform: translateY(-2px) !important;
    }
    50% { 
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.08) 0%, rgba(74, 144, 226, 0.12) 100%) !important;
        border-color: rgba(74, 144, 226, 0.4) !important;
        box-shadow: 0 6px 25px rgba(74, 144, 226, 0.12), 0 1px 6px rgba(0, 0, 0, 0.08) !important;
        transform: translateY(-1.5px) !important;
    }
    100% { 
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.03) 0%, rgba(74, 144, 226, 0.08) 100%) !important;
        border-color: rgba(74, 144, 226, 0.3) !important;
        box-shadow: 0 4px 20px rgba(74, 144, 226, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        transform: translateY(-1px) !important;
    }
}

/* Modern text highlighting for search matches */
.nx-od-highlight-text,
mark.nx-od-highlight-text {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(74, 144, 226, 0.25) 100%) !important;
    color: #003f84 !important;
    font-weight: 600 !important;
    padding: 2px 6px !important;
    border-radius: 6px !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(74, 144, 226, 0.2) !important;
    position: relative !important;
    display: inline-block !important;
    transition: all 0.2s ease !important;
}

.nx-od-highlight-text::before,
mark.nx-od-highlight-text::before {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 2px !important;
    background: linear-gradient(90deg, #4a90e2, #005bac) !important;
    border-radius: 0 0 6px 6px !important;
    opacity: 0.6 !important;
}

.nx-od-highlight-text:hover,
mark.nx-od-highlight-text:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2) 0%, rgba(74, 144, 226, 0.3) 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3) !important;
}

/* Accessibility Improvements */
.nx-od-search-input:focus {
    outline: none;
}

.nx-od-category-btn:focus {
    outline: 2px solid #005bac;
    outline-offset: 2px;
}

.nx-od-term:focus-within {
    outline: 2px solid #005bac;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nx-od-term {
        border-color: #000;
        border-width: 3px;
    }
    
    .nx-od-term-name {
        color: #000;
    }
    
    .nx-od-term-description {
        color: #333;
    }
    
    .nx-od-search-input {
        border-color: #000;
        border-width: 3px;
    }
}

/* Print styles */
@media print {
    .nx-od-search-box,
    .nx-od-category-nav {
        display: none;
    }
    
    .nx-od-container {
        box-shadow: none;
        padding: 0;
    }
    
    .nx-od-content-area {
        box-shadow: none;
        padding: 20px 0;
    }
    
    .nx-od-term {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: 15px;
    }
    
    .nx-od-term:hover {
        transform: none;
    }
}