/* Publications Database Search Interface Styles */

.publications-search-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: transparent;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--global-text-color-light);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-count {
    font-size: 0.85rem;
    color: var(--global-text-color-light);
    font-weight: 500;
}

.search-controls {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}

.search-field {
    display: flex;
    flex-direction: column;
    position: relative;
}

.search-field.search-input {
    flex: 2;
    min-width: 200px;
}

.search-field.filter-select {
    flex: 0 0 120px;
    min-width: 120px;
}

.search-field label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--global-text-color-light);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: "Crimson Pro", serif, "Noto Serif KR";
}

.search-field input,
.search-field select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--global-divider-color);
    border-radius: 6px;
    background: var(--global-bg-color);
    color: var(--global-text-color);
    font-size: 0.9rem;
    font-family: "Crimson Pro", serif, "Noto Serif KR";
    font-weight: 400;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    height: 2.5rem;
    box-sizing: border-box;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: var(--global-theme-color);
    box-shadow: 0 0 0 3px rgba(var(--global-theme-color-rgb, 52, 144, 220), 0.1);
}

.search-field input.has-value,
.search-field select.has-value {
    border-color: var(--global-theme-color);
    background: rgba(var(--global-theme-color-rgb, 52, 144, 220), 0.02);
}

.search-field input::placeholder {
    color: var(--global-text-color-light);
    opacity: 0.7;
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    align-self: end;
}

.btn-clear {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--global-text-color-light);
    border: 1px solid var(--global-divider-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: "Crimson Pro", serif, "Noto Serif KR";
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 2.5rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear:hover {
    background: var(--global-theme-color);
    color: white;
    border-color: var(--global-theme-color);
}

/* Enhanced publication list styles */
.publications {
    position: relative;
}

.bibliography {
    display: flex;
    flex-direction: column;
}

.pub-item {
    transition: opacity 0.3s ease, transform 0.2s ease;
    border-radius: 8px;
    padding: 0.5rem 0;
}

.pub-item:hover {
    background: rgba(var(--global-theme-color-rgb, 52, 144, 220), 0.02);
}

.pub-item.filtered-out {
    display: none !important;
}

.pub-item.highlight {
    background: rgba(var(--global-theme-color-rgb, 52, 144, 220), 0.05);
    border-left: 3px solid var(--global-theme-color);
    padding-left: 1rem;
    margin-left: -1rem;
}

/* No results message */
.no-results-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--global-text-color-light);
    background: transparent;
    border: 2px dashed var(--global-divider-color);
    border-radius: 8px;
    margin: 2rem 0;
}

.no-results-message p {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.no-results-message .btn {
    padding: 0.5rem 1rem;
    background: var(--global-theme-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: "Crimson Pro", serif, "Noto Serif KR";
    font-weight: 400;
    transition: background-color 0.2s ease;
}

.no-results-message .btn:hover {
    background: var(--global-theme-color-dark, #2a5998);
}

/* Publication metadata badges */
.pub-metadata {
    margin-top: 0.4rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pub-badge {
    display: inline-block;
    height: 1.0em;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
    text-align: center;
    vertical-align: middle;
    line-height: 1.0em;
}

.pub-badge.year {
    background: rgba(var(--global-theme-color-rgb, 52, 144, 220), 0.1);
    color: var(--global-theme-color);
}

.pub-badge.type-conference {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

.pub-badge.type-journal {
    background: rgba(255, 152, 0, 0.1);
    color: #f57c00;
}

.pub-badge.type-preprint {
    background: rgba(233, 30, 99, 0.1);
    color: #c2185b;
}

.pub-badge.type-workshop {
    background: rgba(156, 39, 176, 0.1);
    color: #7b1fa2;
}

.pub-badge.type-others {
    background: rgba(96, 125, 139, 0.1);
    color: #455a64;
}

/* Dark mode adjustments */
/* Automatic dark mode detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --search-bg-color: #1a1a1a;
        --search-border-color: #333;
        --search-text-color: #e0e0e0;
        --search-text-light: #a0a0a0;
        --search-focus-shadow: rgba(82, 164, 240, 0.2);
    }
    
    :root:not([data-theme="light"]) .search-field input,
    :root:not([data-theme="light"]) .search-field select {
        background: var(--search-bg-color, var(--global-bg-color));
        border-color: var(--search-border-color, var(--global-divider-color));
        color: var(--search-text-color, var(--global-text-color));
    }
    
    :root:not([data-theme="light"]) .search-field input:focus,
    :root:not([data-theme="light"]) .search-field select:focus {
        border-color: var(--global-theme-color);
        box-shadow: 0 0 0 3px var(--search-focus-shadow);
    }
    
    :root:not([data-theme="light"]) .pub-item:hover {
        background: rgba(var(--global-theme-color-rgb, 82, 164, 240), 0.08);
    }
    
    :root:not([data-theme="light"]) .btn-clear {
        background: transparent;
        color: var(--search-text-light);
        border-color: var(--search-border-color);
    }
    
    :root:not([data-theme="light"]) .btn-clear:hover {
        background: var(--global-theme-color);
        color: white;
        border-color: var(--global-theme-color);
    }
}

/* Manual dark mode via data-theme attribute */
html[data-theme="dark"] .search-field input,
html[data-theme="dark"] .search-field select {
    background: var(--global-bg-color, #1a1a1a);
    border-color: var(--global-divider-color, #333);
    color: var(--global-text-color, #e0e0e0);
}

html[data-theme="dark"] .search-field input:focus,
html[data-theme="dark"] .search-field select:focus {
    border-color: var(--global-theme-color);
    box-shadow: 0 0 0 3px rgba(var(--global-theme-color-rgb, 82, 164, 240), 0.2);
}

html[data-theme="dark"] .pub-item:hover {
    background: rgba(var(--global-theme-color-rgb, 82, 164, 240), 0.08);
}

html[data-theme="dark"] .btn-clear {
    background: transparent;
    color: var(--global-text-color-light);
    border-color: var(--global-divider-color);
}

html[data-theme="dark"] .btn-clear:hover {
    background: var(--global-theme-color);
    color: white;
    border-color: var(--global-theme-color);
}

/* Enhanced dark mode badge colors */
html[data-theme="dark"] .pub-badge.year {
    background: rgba(var(--global-theme-color-rgb, 82, 164, 240), 0.25);
    color: var(--global-theme-color, #52a4f0);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.year {
        background: rgba(var(--global-theme-color-rgb, 82, 164, 240), 0.25);
        color: var(--global-theme-color, #52a4f0);
    }
}

html[data-theme="dark"] .pub-badge.type-conference {
    background: rgba(76, 175, 80, 0.25);
    color: #a5d6a7;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.type-conference {
        background: rgba(76, 175, 80, 0.25);
        color: #a5d6a7;
    }
}

html[data-theme="dark"] .pub-badge.type-journal {
    background: rgba(255, 152, 0, 0.25);
    color: #ffcc80;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.type-journal {
        background: rgba(255, 152, 0, 0.25);
        color: #ffcc80;
    }
}

html[data-theme="dark"] .pub-badge.type-preprint {
    background: rgba(233, 30, 99, 0.25);
    color: #f8bbd9;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.type-preprint {
        background: rgba(233, 30, 99, 0.25);
        color: #f8bbd9;
    }
}

html[data-theme="dark"] .pub-badge.type-workshop {
    background: rgba(156, 39, 176, 0.25);
    color: #d1c4e9;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.type-workshop {
        background: rgba(156, 39, 176, 0.25);
        color: #d1c4e9;
    }
}

html[data-theme="dark"] .pub-badge.type-others {
    background: rgba(96, 125, 139, 0.25);
    color: #b0bec5;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pub-badge.type-others {
        background: rgba(96, 125, 139, 0.25);
        color: #b0bec5;
    }
}

/* Toggle authors button consistency */
.toggle-authors {
    background: transparent;
    color: var(--global-theme-color);
    border: 1px solid var(--global-theme-color);
    padding: 0.2rem 0.5rem;
    font-size: 0.9rem;
    font-family: "Crimson Pro", serif, "Noto Serif KR";
    font-weight: 400;
    line-height: 1.4;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-authors:hover {
    background: var(--global-theme-color);
    color: white;
}

html[data-theme="dark"] .toggle-authors {
    background: transparent;
    color: var(--global-theme-color);
    border: 1px solid var(--global-theme-color);
}

html[data-theme="dark"] .toggle-authors:hover {
    background: var(--global-theme-color);
    color: white;
}

/* Loading state */
.publications-loading {
    text-align: center;
    padding: 2rem;
    color: var(--global-text-color-light);
    opacity: 0.7;
}

/* Compact view option */
.publications.compact .pub-item {
    margin-bottom: 1rem;
}

.publications.compact .pub-item .col-sm-3 {
    display: none;
}

.publications.compact .pub-item .col-sm-9 {
    width: 100%;
    padding-left: 0;
}

/* Mobile layout - hide search and sort controls */
@media (max-width: 768px) {
    .search-controls {
        display: none !important;
    }
    
    .publications-search-container {
        padding: 0.5rem 0;
        border-bottom: none;
        margin-bottom: 1rem;
    }
    
    .search-header {
        margin-bottom: 0.5rem;
    }
    
    .search-title {
        font-size: 0.9rem;
    }
    
    .results-count {
        display: none;
    }
}

/* Smooth animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced smooth theme transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Improved focus states for accessibility */
.search-field input:focus,
.search-field select:focus,
.btn-clear:focus {
    outline: 2px solid var(--global-theme-color);
    outline-offset: 2px;
}

/* Better contrast for light mode */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .pub-badge {
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    :root:not([data-theme="dark"]) .search-field input,
    :root:not([data-theme="dark"]) .search-field select {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

/* Explicit light mode styles for search elements */
html[data-theme="light"] .search-field input,
html[data-theme="light"] .search-field select,
:root:not([data-theme="dark"]) .search-field input,
:root:not([data-theme="dark"]) .search-field select {
    background: var(--global-bg-color, #ffffff);
    border-color: var(--global-divider-color, #e5e5e5);
    color: var(--global-text-color, #000000);
}

html[data-theme="light"] .btn-clear,
:root:not([data-theme="dark"]) .btn-clear {
    background: transparent;
    color: var(--global-text-color-light, #828282);
    border-color: var(--global-divider-color, #e5e5e5);
}

html[data-theme="light"] .btn-clear:hover,
:root:not([data-theme="dark"]) .btn-clear:hover {
    background: var(--global-theme-color);
    color: white;
    border-color: var(--global-theme-color);
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    @keyframes fadeIn {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}
