* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

:root {
    --bg: #f8f9fa;
    --text: #333;
    --card-bg: #fff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --primary: #4a90d9;
    --primary-hover: #357abd;
    --radius: 16px;
    --nav-bg: #fff;
    --border: #e0e0e0;
    --footer-bg: #2c3e50;
    --footer-text: #ecf0f1;
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --text: #eaeaea;
    --card-bg: #16213e;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --primary: #e94560;
    --primary-hover: #d63851;
    --nav-bg: #0f3460;
    --border: #2a2a4a;
    --footer-bg: #0f3460;
    --footer-text: #eaeaea;
}

[data-template="tech"] { --primary: #4a90d9; --primary-hover: #357abd; }
[data-template="fashion"] { --primary: #e91e63; --primary-hover: #c2185b; }
[data-template="food"] { --primary: #ff5722; --primary-hover: #e64a19; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    padding-bottom: 2rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: var(--nav-bg);
    color: var(--text);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu li a {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.3s;
}

.nav-menu li a:hover, .nav-menu li a.active {
    background: var(--primary);
    color: #fff;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text);
    border-radius: 3px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-actions button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
}

.nav-actions button:hover {
    background: rgba(0,0,0,0.1);
}

.btn-login {
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    color: #fff;
}

.header-banner {
    text-align: center;
    padding: 3rem 1rem;
}

.header-banner h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

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

/* Search & Filter */
.search-filter-section {
    padding: 2rem 5%;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
}

.search-bar input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 25px 0 0 25px;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text);
}

.search-bar button {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
}

.filter-group select {
    padding: 0.6rem 1rem;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    margin: 0 0.3rem;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
}

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.article-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 1.5rem;
}

.card-category {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.card-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.card-content p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-rating, .card-price {
    font-size: 0.9rem;
    color: var(--text);
}

.btn-read {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--primary);
    color: #fff;
    border-radius: 25px;
    transition: background 0.3s;
}

.btn-read:hover {
    background: var(--primary-hover);
    color: #fff;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

.footer-links a {
    color: var(--footer-text);
    margin: 0 0.5rem;
}

.social-share a {
    color: var(--footer-text);
    margin: 0 0.5rem;
    font-size: 1.5rem;
    transition: color 0.3s;
}

.social-share a:hover {
    color: var(--primary);
}

.footer-copy {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Admin */
.admin-body {
    background: var(--bg);
}

.admin-header {
    background: var(--primary);
    color: #fff;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header nav a, .admin-header nav span {
    color: #fff;
    margin-left: 1rem;
}

.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.admin-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    max-width: 600px;
}

.admin-form h2 {
    margin-bottom: 1rem;
}

.admin-form input, .admin-form textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.admin-form button {
    background: var(--primary);
    color: #fff;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.admin-form button:hover {
    background: var(--primary-hover);
}

.login-register-forms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error { background: #f8d7da; color: #721c24; }
.alert-success { background: #d4edda; color: #155724; }

.admin-section {
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th, .admin-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--primary);
    color: #fff;
}

.btn-delete {
    color: #e74c3c;
    font-weight: 600;
}

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

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #666;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 70px;
        left: 0;
        background: var(--nav-bg);
        padding: 1rem;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    .nav-menu.active {
        display: flex;
    }
    .nav-actions {
        gap: 0.5rem;
    }
    .header-banner h1 {
        font-size: 1.6rem;
    }
    .articles-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    .login-register-forms {
        grid-template-columns: 1fr;
    }
    .filter-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}