@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
                      radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 80px 20px 32px 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin: 24px 24px 0;
    border-radius: var(--radius-xl);
    position: relative;
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.mobile-menu-toggle {
    display: none;
    position: absolute;
    top: 24px;
    right: 24px;
    flex-direction: column;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 28px;
    height: 2px;
    background: var(--text-primary);
    margin: 4px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

.header-nav-links {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
}

.header-nav-link {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    border-radius: var(--radius-md);
}

.header-nav-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: white;
}

.header-nav-link:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.nav-links {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.articles-link {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

.articles-link:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    color: white;
}

.articles-link:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.search-container {
    margin: 32px 24px;
    text-align: center;
}

.search-input {
    padding: 14px 20px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-md);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.item-count {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 12px 0;
    font-weight: 500;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
}

.items-grid-container {
    position: relative;
    min-height: 500px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    height: 160px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.item-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.item-card:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.item-card.placeholder {
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

.item-card.placeholder:hover {
    transform: none;
}

.item-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.item-icon img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-icon img.loaded {
    opacity: 1;
}

.item-icon .loading-spinner {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.item-id {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.load-more {
    text-align: center;
    padding: 24px;
    margin: 24px 0;
}

.load-more-btn {
    padding: 14px 32px;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
}

.load-more-btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: var(--bg-secondary);
    border: 1px solid var(--secondary-color);
    padding: 24px 32px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
    z-index: 1000;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1), var(--shadow-xl);
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    max-width: 80%;
    word-break: break-all;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-5deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05) rotate(2deg);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
}

.copy-notification.fade-out {
    animation: popOut 0.2s ease-out forwards;
}

@keyframes popOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

.loading {
    text-align: center;
    padding: 60px;
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.error {
    text-align: center;
    padding: 60px;
    font-size: 16px;
    color: #ef4444;
    font-weight: 500;
}

@media (max-width: 768px) {
    .header {
        margin: 16px;
        padding: 72px 16px 24px 16px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .header p {
        font-size: 0.9rem;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }

    .item-card {
        height: 150px;
        padding: 16px;
    }

    .mobile-menu-toggle {
        display: flex;
        top: 20px;
        right: 20px;
    }

    .header-nav-links {
        position: absolute;
        top: 70px;
        right: 16px;
        left: 16px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        padding: 16px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-xl);
        transform: translateY(-20px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
        backdrop-filter: blur(10px);
    }

    .header-nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .header-nav-link {
        font-size: 14px;
        padding: 12px 18px;
        text-align: center;
        margin: 0;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 10px;
    }

    .articles-link {
        font-size: 13px;
        padding: 10px 16px;
        flex: 1 1 calc(50% - 5px);
        min-width: 130px;
    }

    .search-container {
        margin: 24px 16px;
    }

    .container {
        padding: 16px;
    }
}

/* News Section Styles */
.news-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

.news-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.news-section-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.view-all-news {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

.view-all-news:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.news-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.loading-news-preview {
    text-align: center;
    padding: 48px;
    font-size: 16px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.news-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: var(--radius-lg);
}

.news-preview-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-xl);
}

.news-preview-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.news-preview-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-preview-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.news-preview-title a:hover {
    color: var(--primary-light);
}

.news-preview-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    gap: 10px;
}

.news-preview-author {
    color: var(--secondary-color);
    font-weight: 500;
}

.news-preview-date {
    color: var(--text-secondary);
}

.news-preview-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .news-section {
        margin: 24px auto;
        padding: 0 16px;
    }

    .news-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .news-section-header h2 {
        font-size: 1.5rem;
    }

    .news-preview-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .view-all-news {
        width: 100%;
        text-align: center;
    }
}