/* Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Merriweather', Georgia, serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border-color: #334155;
    }
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.nav-admin {
    background: var(--primary-color);
    color: var(--white) !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

.nav-admin:hover {
    background: var(--primary-dark);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    transition: var(--transition);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Search Box */
.search-box {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--gray-800);
}

.search-btn {
    background: var(--primary-color);
    border: none;
    padding: 0 1.5rem;
    color: var(--white);
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Main Content */
.main {
    flex: 1;
    padding: 3rem 0;
}

/* Filter Section */
.filter-section {
    margin-bottom: 2rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-filter {
    background: var(--white);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.tag-filter:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tag-filter.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filter-info {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.article-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.article-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--gray-200);
}

.article-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.article-title a {
    color: inherit;
    text-decoration: none;
}

.article-title a:hover {
    color: var(--primary-color);
}

.article-intro {
    color: var(--gray-600);
    margin-bottom: 1rem;
    flex: 1;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.article-tag {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    text-decoration: none;
    transition: var(--transition);
}

.article-tag:hover {
    background: var(--primary-color);
    color: var(--white);
}

.read-more {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
}

.read-more:hover {
    gap: 0.5rem;
}

/* Skeleton Loading */
.article-skeleton {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-image {
    height: 200px;
    margin-bottom: 1rem;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 0.75rem;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.page-btn {
    background: var(--white);
    border: 1px solid var(--gray-300);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 0;
    color: var(--gray-500);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: var(--gray-400);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--white);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-800);
    border-radius: 50%;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-800);
    color: var(--gray-500);
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-4px);
}

/* Article Single Page */
.article-main {
    padding: 2rem 0;
    min-height: calc(100vh - 4rem);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.article-single {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.article-header {
    margin-bottom: 2rem;
}

.article-single h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.article-meta-single {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.article-meta-single span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.article-body {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--gray-700);
}

.article-body h2,
.article-body h3,
.article-body h4 {
    font-family: var(--font-sans);
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: var(--gray-900);
}

.article-body h2 {
    font-size: 1.75rem;
}

.article-body h3 {
    font-size: 1.5rem;
}

.article-body h4 {
    font-size: 1.25rem;
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.5rem 2rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--gray-600);
}

.article-body pre {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.article-body code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

/* Article Actions */
.article-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.btn-share,
.btn-print {
    background: var(--white);
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-share:hover,
.btn-print:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Share Modal */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 2000;
}

.share-modal.show {
    opacity: 1;
    visibility: visible;
}

.share-modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    position: relative;
}

.share-modal h3 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.share-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--white);
    transition: var(--transition);
}

.share-btn:hover {
    transform: translateY(-4px);
}

.share-btn:nth-child(1) { background: #1DA1F2; }
.share-btn:nth-child(2) { background: #1877F2; }
.share-btn:nth-child(3) { background: #0A66C2; }
.share-btn:nth-child(4) { background: #25D366; }

.share-link {
    display: flex;
    gap: 0.5rem;
}

.share-link input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.btn-copy {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy:hover {
    background: var(--primary-dark);
}

.share-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.share-close:hover {
    color: var(--gray-700);
}

/* Related Articles */
.related-articles {
    margin-bottom: 3rem;
}

.related-articles h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 4rem;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        box-shadow: var(--shadow-lg);
        transition: 0.3s;
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .hero {
        padding: 3rem 0;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .article-single {
        padding: 1rem;
    }

    .article-body {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .back-to-top,
    .article-actions,
    .related-articles,
    .breadcrumb {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .article-single {
        box-shadow: none;
        padding: 0;
    }

    .article-body {
        font-size: 12pt;
        line-height: 1.5;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}