:root {
    color-scheme: light dark;
    --theme-transition-duration: 0.3s;
}

html {
  visibility: visible;
  opacity: 1;
}
#loading-overlay {
  display: flex;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.8s ease-out;
  z-index: 9999;
}
body {
  visibility: hidden; /* Hide content initially */
}

/* Base transitions */
* {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                fill 0.3s ease;
}

/* Theme transition specific styles */
.theme-transition * {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease !important;
}

/* Remove transition for loading overlay */
#loading-overlay * {
    transition: none !important;
}

.theme-transition {
  transition: background-color var(--theme-transition-duration) ease-in-out,
              color var(--theme-transition-duration) ease-in-out,
              border-color var(--theme-transition-duration) ease-in-out;
}
.custom-bg {
  background-image: url('https://images.unsplash.com/photo-1672858460787-fb29ed7352f8');
}

/* Mobile menu animations */
#mobileMenu {
    display: flex;
    pointer-events: none;
}

#mobileMenu.hidden {
    display: none;
}

#mobileMenu:not(.hidden) {
    pointer-events: auto;
}

#mobileMenu .menu a {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

#mobileMenu.opacity-0 .menu a {
    transform: translateX(-1rem);
    opacity: 0;
}

/* Stagger animation delays for menu items */
#mobileMenu .menu li:nth-child(1) a { transition-delay: 0.1s; }
#mobileMenu .menu li:nth-child(2) a { transition-delay: 0.15s; }
#mobileMenu .menu li:nth-child(3) a { transition-delay: 0.2s; }
#mobileMenu .menu li:nth-child(4) a { transition-delay: 0.25s; }
#mobileMenu .menu li:nth-child(5) a { transition-delay: 0.3s; }

@font-face {
    font-family: 'LINESeedSansTH';
    src: url('./fonts/LINESeedSansTH_W_Rg.woff2') format('woff2'),
         url('./fonts/LINESeedSansTH_W_Rg.woff') format('woff'),
         url('./fonts/LINESeedSansTH_W_Rg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* You can add additional @font-face declarations for different weights */
@font-face {
    font-family: 'LINESeedSansTH';
    src: url('./fonts/LINESeedSansTH_W_Bd.woff2') format('woff2'),
         url('./fonts/LINESeedSansTH_W_Bd.woff') format('woff'),
         url('./fonts/LINESeedSansTH_W_Bd.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

/* Certificate filter styles */
.tag-filter {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 100px;
    font-weight: 500;
    transform-origin: center;
    opacity: 1;
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.tag-filter.hidden {
    transform: scale(0.8) translateY(-20px);
    width: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.tag-filter::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0.1;
}

.tag-filter:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.tag-filter.active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Tag-specific styles */
.tag-filter[data-tag="all"].active {
    background: #374151;
    color: white;
}

.tag-filter[data-tag="robotics"] i { color: rgb(239, 68, 68); }
.tag-filter[data-tag="coding"] i { color: rgb(59, 130, 246); }
.tag-filter[data-tag="camp"] i { color: rgb(34, 197, 94); }
.tag-filter[data-tag="contest"] i { color: rgb(234, 179, 8); }
.tag-filter[data-tag="ai"] i { color: rgb(6, 182, 212); }
.tag-filter[data-tag="stem"] i { color: rgb(168, 85, 247); }

.tag-filter i {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.tag-filter:hover i {
    transform: scale(1.2);
}

/* Add badge counts */
.tag-filter .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.certificates-grid {
    transition: opacity 0.5s ease;
}

.certificates-grid.filtering {
    opacity: 0.3;
}

/* Tag-specific hover effects */
.tag-filter i {
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.tag-filter:hover i {
    transform: scale(1.2);
}

.tag-filter.btn-primary {
    border-width: 2px;
}

/* Active tag display styles */
#activeTagDisplay {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#activeTagDisplay .badge {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    min-width: 120px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

#activeTagDisplay i {
    font-size: 1.1em;
}

#activeTagDisplay.updating .badge {
    transform: scale(1.05);
}

/* Active tag icon colors */
#currentTag i {
    transition: color 0.3s ease;
}

#currentTag.border-red-500 i { color: rgb(239, 68, 68); }
#currentTag.border-blue-500 i { color: rgb(59, 130, 246); }
#currentTag.border-green-500 i { color: rgb(34, 197, 94); }
#currentTag.border-yellow-500 i { color: rgb(234, 179, 8); }
#currentTag.border-cyan-500 i { color: rgb(6, 182, 212); }
#currentTag.border-purple-500 i { color: rgb(168, 85, 247); }

/* Clear filter button hover effect */
#clearFilter {
    transition: all 0.3s ease;
}

#clearFilter:hover {
    background-color: rgba(var(--color-error-base), 0.1);
    color: var(--color-error);
    color: rgb(239, 68, 68);
    transform: scale(1.05);
}

/* Tag filter container */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem; /* Maintain consistent height */
    padding: 0.25rem;
    transition: height 0.3s ease;
}
