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

:root {
    --primary: #e91e63;
    --primary-dark: #c2185b;
    --secondary: #9c27b0;
    --accent: #ff4081;
    --bg: #fff5f7;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #f0e6e8;
    --shadow: 0 4px 15px rgba(233, 30, 99, 0.1);
    --radius: 16px;
    --nav-bg: #ffffff;
    --footer-bg: #2c3e50;
    --footer-text: #ecf0f1;
    --tag-bg: #fce4ec;
    --tag-text: #c2185b;
    --gradient: linear-gradient(135deg, #e91e63, #9c27b0);
    --hero-gradient: linear-gradient(135deg, #e91e63 0%, #9c27b0 50%, #3f51b5 100%);
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --text: #e0e0e0;
    --text-light: #b0b0b0;
    --border: #2a2a4a;
    --shadow: 0 4px 15px rgba(0,0,0,0.3);
    --nav-bg: #16213e;
    --footer-bg: #0f0f23;
    --tag-bg: #2a2a4a;
    --tag-text: #e91e63;
}

[data-template="tech"] {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --secondary: #00BCD4;
    --accent: #448AFF;
    --gradient: linear-gradient(135deg, #2196F3, #00BCD4);
    --hero-gradient: linear-gradient(135deg, #0D47A1, #00BCD4);
    --tag-bg: #E3F2FD;
    --tag-text: #1565C0;
}

[data-template="fashion"] {
    --primary: #FF5722;
    --primary-dark: #E64A19;
    --secondary: #FF9800;
    --accent: #FF7043;
    --gradient: linear-gradient(135deg, #FF5722, #FF9800);
    --hero-gradient: linear-gradient(135deg, #BF360C, #FF9800);
    --tag-bg: #FBE9E7;
    --tag-text: #BF360C;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: var(--nav-bg);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-brand h1 {
    font-size: 1.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--gradient);
    color: white;
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
}

.nav-controls button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
    transition: all 0.3s;
}

.nav-controls button:hover {
    background: var(--gradient);
    color: white;
    border-color: transparent;
}

.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;
    transition: all 0.3s;
}

/* Hero Section */
.hero {
    background: var(--hero-gradient);
    padding: 6rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: heroGlow 10s ease-in-out infinite;
}

@keyframes heroGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.search-bar {
    background: white;
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.search-bar i {
    color: var(--primary);
    font-size: 1.2rem;
    margin-right: 1rem;
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    padding: 0.8rem 0;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-light);
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

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

/* Tutorials Grid */
.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

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

.tutorial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(233, 30, 99, 0.2);
}

.card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

.tutorial-card:hover .card-image img {
    transform: scale(1.1);
}

.price-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--gradient);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.price-badge.free {
    background: #4CAF50;
}

.card-content {
    padding: 1.5rem;
}

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

.card-content p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.card-meta i {
    margin-right: 0.3rem;
    color: var(--primary);
}

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

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Stats Section */
.stats-section {
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

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

.stat-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.chart-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
}

/* Heatmap */
.heatmap-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.heatmap-container h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.heatmap-cell {
    background: var(--tag-bg);
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Share Section */
.share-section {
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-card);
    margin: 2rem;
    border-radius: var(--radius);
}

.share-section h2 {
    margin-bottom: 2rem;
    color: var(--text);
}

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

.share-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.share-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.share-btn.wechat { background: #07C160; }
.share-btn.weibo { background: #E6162D; }
.share-btn.qq { background: #12B7F5; }
.share-btn.twitter { background: #1DA1F2; }
.share-btn.facebook { background: #1877F2; }

/* Footer */
footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 4rem 2rem 2rem;
}

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

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

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
}

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

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

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

.footer-newsletter form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.footer-newsletter input {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
}

.footer-newsletter input::placeholder {
    color: rgba(255,255,255,0.5);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

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

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.auth-form input:focus {
    border-color: var(--primary);
    outline: none;
}

.auth-form p {
    text-align: center;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Admin Styles */
.admin-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.admin-login {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 100%;
}

.admin-login h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.admin-dashboard {
    width: 100%;
    max-width: 1200px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.admin-tab {
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.admin-tab.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.table-container {
    overflow-x: auto;
}

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

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

th {
    background: var(--gradient);
    color: white;
    font-weight: 600;
}

tr:hover {
    background: var(--tag-bg);
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--nav-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    .nav-links.active {
        display: flex;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .admin-nav {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 1rem;
    }

    .hero {
        padding: 4rem 1rem;
    }

    .tutorials-grid {
        padding: 1rem;
    }

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