/* Custom CSS Variables */
:root {
    --brand-navy: #0B1220;
    --brand-off-white: #F7F9FC;
    --brand-accent: #2563EB;
    --brand-teal: #0BB37F;
    --author-pi: #4338CA;
    --author-external: #0B1220;
}

/* Base Styles */
body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--brand-off-white);
    color: var(--brand-navy);
}

/* Brand Colors */
.bg-brand-navy { background-color: var(--brand-navy); }
.text-brand-navy { color: var(--brand-navy); }
.bg-brand-off-white { background-color: var(--brand-off-white); }
.text-brand-off-white { color: var(--brand-off-white); }
.bg-brand-accent { background-color: var(--brand-accent); }
.text-brand-accent { color: var(--brand-accent); }
.border-brand-accent { border-color: var(--brand-accent); }
.ring-brand-accent { --tw-ring-color: var(--brand-accent); }
.bg-brand-teal { background-color: var(--brand-teal); }
.text-brand-teal { color: var(--brand-teal); }

/* Fix for grid-cols-4 if Tailwind is not working properly */
.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

@media (min-width: 1024px) {
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Home page card grid specific fixes */
.home-cards-grid {
    display: grid !important;
    gap: 1.5rem !important;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .home-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .home-cards-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Card styling fallback */
.home-card {
    display: block;
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
}

.home-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
}

/* Fix for bg-blue-100 if not working */
.bg-blue-100 {
    background-color: #DBEAFE !important;
}

/* Fix for transform utilities */
.hover\:-translate-y-1:hover {
    transform: translateY(-0.25rem) !important;
}

/* Publication Author Colors */
.text-author-pi, 
.text-author-lab { 
    color: var(--author-pi); 
    font-weight: 600; 
}
.text-author-external { 
    color: var(--author-external); 
}

/* Focus Ring */
*:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth Transitions */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

/* Side Drawer Styling */
#drawer-container {
    visibility: hidden;
    transition: visibility 0s linear 300ms;
}

#drawer-backdrop {
    opacity: 0;
    transition: opacity 300ms ease-in-out;
}

#drawer-panel {
    transform: translateX(100%);
    transition: transform 300ms ease-in-out;
}

#drawer-container.is-open {
    visibility: visible;
    transition-delay: 0s;
}

#drawer-container.is-open #drawer-backdrop {
    opacity: 1;
}

#drawer-container.is-open #drawer-panel {
    transform: translateX(0);
}

/* News Modal Styling */
#news-detail-modal .news-modal-title {
    color: white !important;
}

#news-detail-modal .news-modal-subtitle {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Image Modal Styling */
#image-modal {
    backdrop-filter: blur(4px);
}

#image-modal img {
    max-height: 90vh;
    max-width: 90vw;
}

/* News Modal Content */
#news-detail-modal .prose p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

#news-detail-modal .figure-container {
    margin: 2rem 0;
    text-align: center;
}

#news-detail-modal .figure-container img {
    transition: all 0.3s ease;
}

#news-detail-modal .figure-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Accordion Styling */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.accordion-toggle svg {
    transition: transform 0.3s ease-in-out;
}

.accordion-toggle.active svg {
    transform: rotate(180deg);
}

/* Tab Navigation */
.nav-link.active {
    color: var(--brand-navy);
    font-weight: 600;
}

/* Mobile Menu */
#mobile-menu {
    transition: max-height 0.3s ease-in-out;
}

/* Publication Item Hover */
.publication-item {
    transition: background-color 0.2s ease;
}

.publication-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Additional styles for improved publications page */

/* Search highlight styles */
.search-highlight {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

.highlight-match {
    background-color: #f8fafc;
    border-left: 3px solid var(--brand-accent);
    transform: translateX(0);
    transition: all 0.2s ease-in-out;
}

.highlight-match:hover {
    background-color: #f1f5f9;
    transform: translateX(2px);
}

/* Improved sticky search bar */
.sticky {
    transition: all 0.3s ease-in-out;
}

/* Publication item animations */
.publication-item {
    transition: all 0.3s ease-in-out;
    opacity: 1;
}

.publication-item[style*="display: none"] {
    opacity: 0;
    transform: translateY(-10px);
}

/* Enhanced search input */
#publication-search:focus {
    transform: scale(1.02);
    transition: transform 0.2s ease-in-out;
}

/* Loading animation improvements */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* No results message animation */
#no-results-message {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}