/* Main Stylesheet for Word Lists Platform */

/* =========================================
   1. Reset & Base
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme (Default) */
    --bg-color: #fafaf8;
    --text-color: #2d2d2d;
    --text-light: #555;
    --text-muted: #888;
    --border-color: #e8e8e6;
    --accent-color: #1a1a1a;
    --card-bg: #fff;
    --hover-bg: #f5f5f3;
    --badge-bg: #f0f0ee;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --primary: #1a1a1a;
    --secondary: #555;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --text-muted: #7f8c8d;
    --border-color: #404040;
    --accent-color: #f39c12;
    --card-bg: #2d2d2d;
    --hover-bg: #383838;
    --badge-bg: #383838;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --nav-bg: rgba(26, 26, 26, 0.95);
    --primary: #fff;
    --secondary: #ccc;
}

/* Smooth transition */
body,
.item-card,
.header-search input,
.site-header,
.footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    margin-left: 1rem;
}

.theme-toggle:hover {
    background: var(--hover-bg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
}

html:not([data-theme]) .icon-sun {
    display: none;
}

/* Default */

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

/* =========================================
   2. Typography
   ========================================= */
h1,
h2,
h3,
.serif {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 700;
    color: var(--accent-color);
}

h1 {
    font-size: 2.25rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

/* =========================================
   3. Layout Components
   ========================================= */
/* Layout Containers */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Portal Layout Grid */
.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .portal-grid {
        grid-template-columns: minmax(0, 3fr) 300px;
        gap: 2rem;
    }
}

.content-column {
    min-width: 0;
    /* Prevents flex/grid blowouts */
}

.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .sidebar-column {
        position: sticky;
        top: 2rem;
        height: fit-content;
    }
}

/* Sidebar Widgets */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Word of the Day Widget */
.wotd-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--hover-bg) 100%);
    border-color: var(--accent-color);
    text-align: center;
}

.wotd-word {
    font-size: 2.25rem;
    font-family: var(--font-serif);
    font-weight: 700;
    color: #1a1a1a;
    /* Hardcoded black for safety */
    margin: 0.5rem 0;
    line-height: 1.2;
    display: block;
}

.wotd-definition {
    font-style: italic;
    color: var(--text-color);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    opacity: 0.8;
    display: block;
}

.wotd-link {
    display: inline-block;
    background: var(--primary);
    color: #fff !important;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-size: 0.95rem;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wotd-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

/* Newsletter Widget */
.newsletter-form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
}

.newsletter-form button {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.newsletter-form button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--accent-color);
}

.breadcrumbs .separator {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.breadcrumbs span.current {
    color: var(--text-color);
    font-weight: 500;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary);
    z-index: 1002;
    transition: width 0.1s ease;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--hover-bg) 25%, var(--badge-bg) 50%, var(--hover-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
}

/* Search Suggestions */
.search-container {
    position: relative;
}

#searchResults {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    margin-top: -1px;
}

#searchResults.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--hover-bg);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Micro-interactions */
.hub-card,
.widget-card,
.wotd-link {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.hub-card:hover {
    transform: translateY(-5px) scale(1.01);
}


/* Trending List links */
.trending-list {
    list-style: none;
    padding: 0;
}

.trending-list li a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s, padding-left 0.2s;
}

.trending-list li:last-child a {
    border-bottom: none;
}

.trending-list li a:hover {
    color: var(--primary);
    padding-left: 5px;
}

/* Header */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Source Serif 4', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* Hero Section */
.hero {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.hero h1 {
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    background: var(--badge-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Page Introduction (SEO Content) */
.page-intro {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
    font-size: 1.05rem;
    line-height: 1.7;
}

[data-theme="dark"] .page-intro {
    background: rgba(255, 255, 255, 0.03);
}

.page-intro strong {
    color: var(--accent-color);
    font-weight: 600;
}

.page-intro p {
    margin: 0;
}

/* =========================================
   4. Navigation Components
   ========================================= */
/* Alphabet Nav */
.alpha-nav {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 2.5rem;
}

.alpha-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.alpha-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.letter-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hover-bg);
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.95rem;
}

.letter-btn:hover,
.letter-btn.active {
    background: var(--accent-color);
    color: #fff;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    align-items: center;
}

.breadcrumbs a {
    color: var(--text-light);
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--text-muted);
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s, transform 0.2s;
    pointer-events: none;
    z-index: 90;
    font-size: 1.2rem;
    border: none;
    cursor: pointer;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    transform: translateY(-2px);
}

/* =========================================
   5. Card Components
   ========================================= */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.item-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    border-color: #d0d0d0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0;
}

.card-badge {
    font-size: 0.75rem;
    background: var(--badge-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    color: var(--text-light);
    white-space: nowrap;
}

.card-content p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.card-meta {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* =========================================
   6. FAQ Section
   ========================================= */
.faq-section {
    border-top: 1px solid var(--border-color);
    padding-top: 3rem;
    margin-top: 3rem;
    max-width: 800px;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 1.25rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question:hover {
    background: var(--hover-bg);
}

.faq-question::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
}

.faq-item.open .faq-question::after {
    content: '−';
}

.faq-answer {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-light);
    font-size: 0.95rem;
    display: none;
}

.faq-item.open .faq-answer {
    display: block;
}

/* =========================================
   7. Footer
   ========================================= */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--card-bg);
}

.footer-links {
    margin-bottom: 1rem;
}

.footer-links a {
    margin: 0 0.5rem;
    color: var(--text-light);
}

/* =========================================
   8. Search
   ========================================= */
.search-container {
    margin-bottom: 2rem;
    position: relative;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: white url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 0.8rem center;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* =========================================
   9. Responsive
   ========================================= */
@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    .hero {
        padding: 2rem 0;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    /* Mobile menu TODO */
}

/* Header Search */
.header-search {
    position: relative;
    width: 280px;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s ease;
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    display: none;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
    color: var(--accent-color);
}

/* Copy Button */
.item-card {
    position: relative;
    /* Ensure relative positioning for absolute child */
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
    /* Hidden by default */
}

.item-card:hover .copy-btn {
    opacity: 1;
    /* Show on hover */
}

.copy-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive Search */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .header-search {
        width: 100%;
        order: 3;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }
}
/* Hero Stats */
.hero-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 480px) {
    .hero-stats {
        gap: 1rem;
    }
    .stat-number {
        font-size: 1.25rem;
    }
}
