/* 1. Global Reset & Theme */
:root {
    --bg-color: #0e1013;
    --card-color: #252a30;
    --text-color: #f0f0f0;
    --primary-color: #086c84;
    --border-color: #064b5c;
    --input-bg: #181b1f;
    --shadow-light: rgba(255, 255, 255, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.4);
    --text-muted: #aaa;

    font-family: 'Inter', sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] {
    --bg-color: #f4f4f9;
    --card-color: #ffffff;
    --text-color: #1a1a1a;
    --primary-color: #086c84;
    --border-color: #064b5c;
    --input-bg: #eee;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.1);
    --text-muted: #555;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

/* 2. Header & Navigation */
header {
    background-color: var(--card-color);
    box-shadow: 0 2px 5px var(--shadow-dark);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-color);
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

.nav-links a.github-link {
    line-height: 0; /* Aligns the icon-only link properly */
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
}

.icon {
    width: 24px;
    height: 24px;
}

/* --- THEME ICON CSS --- */
[data-theme="light"] .icon-moon {
    display: none;
}
[data-theme="light"] .icon-sun {
    display: block;
}
[data-theme="dark"] .icon-sun {
    display: none;
}
[data-theme="dark"] .icon-moon {
    display: block;
}
/* --- END THEME ICON CSS --- */


/* 3. Controls Container */
.controls-container {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#search-bar {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

select {
    padding: 0.75rem;
    font-size: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
}

/* --- 3.5 Welcome Section --- */
.welcome-section {
    width: min(100% - 4rem, 1336px);
    margin-top: 2rem;
    margin-inline: auto;
    padding: 2.5rem 2rem;
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow-dark);
}

.welcome-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.welcome-section p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 80ch; /* Limits line length for readability */
    margin: 0 auto;
    line-height: 1.7;
}
/* --- END: 3.5 Welcome Section --- */

/* --- 3.6 Welcome Logo --- */
.welcome-logo {
    width: 150px;
    height: 150px;
   /* border-radius: 50%;  This makes your logo circular */
   /* border: 2px solid var(--border-color);  Keeps the border */
   /* margin: 0 auto 1.5rem; */
    object-fit: cover; /* Ensures your image fills the circle */
}
/* --- END: 3.6 Welcome Logo --- */


/* 4. Main Content Grid */
#item-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 2rem 2rem;
}

.item-card {
    background-color: var(--card-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px var(--shadow-dark);
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px var(--shadow-dark);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    word-break: break-word;
}

.card-author {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 0.25rem;
}

.card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.card-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.card-body {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    word-break: break-word;
}

/* --- NEW: Style for links in description --- */
.card-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

.card-notes {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-bottom: 0.75rem;
    word-break: break-word;
}

.card-notes a {
    color: var(--primary-color);
    text-decoration: underline;
}

.card-secondary {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.card-secondary-item strong {
    color: var(--text-color);
}

.card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem; /* Space between buttons */
    margin-top: auto; /* Pushes footer to the bottom */
}

.card-footer a {
    display: inline-block;
    background-color: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

.card-footer a:hover {
    background-color: #064b5c;
    transform: scale(1.03);
}

.card-footer a.btn-preview {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.card-footer a.btn-preview:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

.card-footer a.disabled {
    background-color: var(--input-bg);
    color: #888;
    pointer-events: none;
    cursor: not-allowed;
    border-color: var(--border-color);
}

/* 5. Static Pages (Credits, Legal) */
.static-page {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card-color);
    border-radius: 12px;
}

.static-page h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.static-page h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.static-page p, .static-page li {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.static-page ul {
    list-style-position: inside;
    padding-left: 1rem;
}

.static-page a {
    color: var(--primary-color);
}

.static-page pre {
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 0.9rem;
}

.static-footer {
    text-align: center;
    padding: 2rem;
        font-size: 0.9rem;
        color: #888;
    }
    
    /* 6. Back to Top Button */
    #back-to-top {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        background-color: var(--primary-color);
        color: #ffffff;
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
        box-shadow: 0 4px 8px var(--shadow-dark);
        z-index: 1000;
    }
    
    #back-to-top:hover {
        background-color: #064b5c;
    }
    
    #back-to-top.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    