/* ============================================
   Glossary Custom Styles
   Space Portal - Astronomy Glossary
   ============================================ */

/* ============================================
   1. GLOSSARY HEADER
   ============================================ */

.glossary-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    position: relative;
    overflow: hidden;
}

.glossary-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.glossary-header .container {
    position: relative;
    z-index: 1;
}

.bg-gradient {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

/* ============================================
   2. BREADCRUMB
   ============================================ */

.breadcrumb-section {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2em;
    color: #6c757d;
}

/* ============================================
   3. STATISTICS CARDS
   ============================================ */

.glossary-stats .stat-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.glossary-stats .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.glossary-stats .stat-card h3 {
    font-size: 2.5rem;
    font-weight: bold;
}

.glossary-stats .stat-card small {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ============================================
   4. TERM CARDS
   ============================================ */

.term-card {
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.term-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    border-color: #2563eb;
}

.term-card .card-title a {
    color: #333;
    font-weight: 600;
    transition: color 0.2s ease;
}

.term-card .card-title a:hover {
    color: #2563eb;
}

.term-card .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 600;
}

/* ============================================
   5. ALPHABET NAVIGATION
   ============================================ */

.alphabet-nav {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.alphabet-nav .btn {
    min-width: 40px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.alphabet-nav .btn:hover {
    transform: scale(1.1);
}

.alphabet-nav .btn.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* ============================================
   6. LETTER GROUPS
   ============================================ */

.letter-group {
    scroll-margin-top: 100px; /* For smooth scroll with sticky header */
}

.letter-heading {
    position: sticky;
    top: 60px;
    background: white;
    z-index: 10;
    padding: 1rem 0;
    margin-bottom: 1.5rem !important;
}

.letter-heading .badge {
    font-weight: 700;
    padding: 0.5rem 1rem;
}

/* ============================================
   7. TERM DETAIL PAGE
   ============================================ */

.term-detail .card {
    border-radius: 10px;
    overflow: hidden;
}

.term-definition {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.term-definition p {
    margin-bottom: 1.2rem;
}

.term-examples,
.term-formulas,
.term-practical {
    margin-top: 2rem;
}

.term-examples h4,
.term-formulas h4,
.term-practical h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.examples-content,
.formulas-content,
.practical-content {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 1.5rem;
    border-radius: 5px;
}

.formulas-content {
    border-left-color: #17a2b8;
}

.practical-content {
    border-left-color: #28a745;
}

/* ============================================
   8. RELATED TERMS
   ============================================ */

.related-term-card {
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.related-term-card:hover {
    background: #e9ecef;
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.related-term-card h6 a {
    color: #333;
    font-weight: 600;
}

.related-term-card h6 a:hover {
    color: #2563eb;
}

/* ============================================
   9. FILTERS
   ============================================ */

.glossary-filters .card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.glossary-filters .btn-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.glossary-filters .btn.active {
    font-weight: 600;
}

/* ============================================
   10. SEARCH PAGE
   ============================================ */

.search-form .form-control,
.search-form .form-select {
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s ease;
}

.search-form .form-control:focus,
.search-form .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.result-card {
    transition: all 0.3s ease;
    border-radius: 8px;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
}

.result-card mark {
    background-color: #fff3cd;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 600;
}

/* ============================================
   11. SIDEBAR
   ============================================ */

.glossary-wrapper aside .card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.glossary-wrapper aside .card:hover {
    transform: translateY(-3px);
}

.glossary-wrapper aside .card-header {
    font-weight: 600;
    border-bottom: none;
}

.glossary-wrapper aside .list-group-item {
    border-left: none;
    border-right: none;
    transition: all 0.2s ease;
}

.glossary-wrapper aside .list-group-item:hover {
    background-color: #f8f9fa;
    padding-left: 1.5rem;
}

.glossary-wrapper aside .list-group-item:first-child {
    border-top: none;
}

/* ============================================
   12. CATEGORY CARDS
   ============================================ */

.hover-card {
    transition: all 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
}

.hover-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2) !important;
}

.hover-card .fa-3x {
    transition: transform 0.3s ease;
}

.hover-card:hover .fa-3x {
    transform: scale(1.2) rotate(5deg);
}

/* ============================================
   13. BADGES & LABELS
   ============================================ */

.badge {
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 5px;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #333 !important;
}

/* ============================================
   14. BUTTONS
   ============================================ */

.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: transparent;
}

/* ============================================
   15. ANIMATIONS
   ============================================ */

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

.term-card,
.result-card,
.hover-card {
    animation: fadeIn 0.5s ease-out;
}

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

/* ============================================
   16. LOADING STATES
   ============================================ */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   17. RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .glossary-header h1 {
        font-size: 2rem;
    }
    
    .glossary-header .lead {
        font-size: 1rem;
    }
    
    .alphabet-nav .btn {
        min-width: 35px;
        font-size: 0.875rem;
    }
    
    .glossary-stats .stat-card h3 {
        font-size: 2rem;
    }
    
    .letter-heading {
        top: 56px; /* Adjust for mobile navbar */
    }
}

@media (max-width: 576px) {
    .glossary-header {
        padding: 2rem 0 !important;
    }
    
    .term-card {
        margin-bottom: 1rem;
    }
    
    .alphabet-nav {
        padding: 0.5rem;
    }
    
    .alphabet-nav .btn {
        min-width: 30px;
        padding: 0.25rem 0.5rem;
    }
}

/* ============================================
   18. PRINT STYLES
   ============================================ */

@media print {
    .glossary-header,
    .breadcrumb-section,
    .glossary-filters,
    .alphabet-nav,
    aside,
    .btn,
    .badge {
        display: none !important;
    }
    
    .term-card,
    .result-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* ============================================
   19. ACCESSIBILITY
   ============================================ */

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

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* ============================================
   20. DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .term-card,
    .result-card,
    .hover-card {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .term-card .card-title a,
    .related-term-card h6 a {
        color: #e2e8f0;
    }
    
    .examples-content,
    .formulas-content,
    .practical-content {
        background-color: #1a202c;
        color: #e2e8f0;
    }
}

/* ============================================
   END OF GLOSSARY STYLES
   ============================================ */
