/* =============================================
   NamaTutorial - Main Stylesheet
   W3Schools-like responsive design
   ============================================= */

/* =============================================
   CSS Variables (Color Palette)
   ============================================= */
:root {
    /* Primary Colors - W3Schools Green */
    --primary: #04AA6D;
    --primary-dark: #059862;
    --primary-light: #f3fcf8;
    
    /* Header Background */
    --header-bg: #282A35;
    --header-dark: #1a1c22;
    
    /* Text Colors */
    --text-dark: #333333;
    --text-light: #ffffff;
    --text-muted: #666666;
    --text-muted-light: #999999;
    
    /* Background Colors */
    --bg-main: #ffffff;
    --bg-light: #f1f1f1;
    --bg-lighter: #f9f9f9;
    --bg-code: #f4f4f4;
    
    /* Sidebar */
    --sidebar-bg: #f1f1f1;
    --sidebar-hover: #e4e4e4;
    
    /* Borders */
    --border-light: #dddddd;
    --border-color: #e0e0e0;
    
    /* Code Block */
    --code-bg: #f4f4f4;
    --code-border: #04AA6D;
    
    /* Accent Colors */
    --accent-yellow: #ffc107;
    --accent-red: #dc3545;
    --accent-blue: #007bff;
    --accent-purple: #6f42c1;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.1);
    
    /* Border Radius */
    --radius-sm: 3px;
    --radius-md: 5px;
    --radius-lg: 10px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* =============================================
   Reset and Base Styles
   ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

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

a:hover {
    color: var(--primary-dark);
}

ul, ol {
    list-style-position: inside;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* =============================================
   Site Container & Layout
   ============================================= */
.site-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-container > .main-content {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    gap: 20px;
}

/* =============================================
   Header Styles
   ============================================= */
.site-header {
    background: var(--header-bg);
    color: var(--text-light);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 60px;
}

/* Logo */
.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 0;
}

.logo:hover {
    color: var(--primary);
}

.logo span {
    color: var(--primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

/* Navigation */
.main-nav {
    flex: 1;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.nav-menu > li > a {
    color: var(--text-light);
    text-decoration: none;
    padding: 20px 15px;
    display: block;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    background: var(--primary);
    color: var(--text-light);
}

/* Header Search */
.header-search {
    margin: 0 20px;
}

.search-form {
    display: flex;
}

.search-box {
    display: flex;
    align-items: stretch;
}

.search-box input[type="text"] {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 0.95rem;
    width: 200px;
    min-width: 150px;
}

.search-box input[type="text"]:focus {
    outline: none;
}

.search-box button {
    padding: 8px 15px;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

/* User Menu */
.user-menu {
    position: relative;
}

.login-btn {
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.login-btn:hover {
    background: var(--primary);
    color: var(--text-light);
}

.user-dropdown {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    font-size: 0.95rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: var(--bg-main);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 1001;
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-dark);
    padding: 12px 16px;
    display: block;
    transition: background var(--transition-fast);
}

.dropdown-content a:hover {
    background: var(--bg-light);
    color: var(--primary);
}

/* =============================================
   Sidebar Styles (Left)
   ============================================= */
.left-sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--sidebar-bg);
    border-radius: var(--radius-md);
    padding: 15px;
    position: sticky;
    top: 70px;
    height: fit-content;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

/* Tutorial Tree / Menu */
.tutorial-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tutorial-tree li {
    margin-bottom: 5px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.category-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    padding: 8px 10px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.category-link:hover {
    background: var(--sidebar-hover);
}

.category-link.active {
    background: var(--primary);
    color: var(--text-light);
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: transform var(--transition-fast);
}

.subcategory-list {
    display: none;
    padding-left: 15px;
    margin: 5px 0;
}

.subcategory-list.show {
    display: block;
}

.subcategory-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-dark);
    padding: 6px 10px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.subcategory-list li a:hover {
    background: var(--sidebar-hover);
}

.subcategory-list li a.active {
    background: var(--primary);
    color: var(--text-light);
}

.subcategory-list .count {
    background: var(--border-light);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.sidebar-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.sitemap-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =============================================
   Main Content Area
   ============================================= */
.content-area {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
}

/* =============================================
   Right Sidebar
   ============================================= */
.right-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-lighter);
    border-radius: var(--radius-md);
    padding: 15px;
    position: sticky;
    top: 70px;
    height: fit-content;
}

.sidebar-widget {
    margin-bottom: 20px;
}

.sidebar-widget:last-child {
    margin-bottom: 0;
}

.sidebar-widget h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

/* Quick Links */
.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-links li {
    margin-bottom: 8px;
}

.quick-links a {
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* Tag Cloud */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-cloud a {
    background: var(--bg-light);
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.tag-cloud a:hover {
    background: var(--primary);
    color: var(--text-light);
}

/* Popular List */
.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.popular-list li:last-child {
    border-bottom: none;
}

.popular-list a {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.4;
}

.popular-list .number {
    background: var(--primary);
    color: var(--text-light);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Popular Section (Homepage) */
.popular-section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.popular-section h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.popular-section h2 i {
    color: #ff6b35;
}

.popular-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 18px;
    background: var(--bg-light);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.popular-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
    background: var(--card-bg);
}

.popular-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-light);
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.popular-item:nth-child(1) .popular-number {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4);
}

.popular-item:nth-child(2) .popular-number {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    box-shadow: 0 4px 10px rgba(192, 192, 192, 0.4);
}

.popular-item:nth-child(3) .popular-number {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    box-shadow: 0 4px 10px rgba(205, 127, 50, 0.4);
}

.popular-content {
    flex: 1;
    min-width: 0;
}

.popular-content h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.popular-content h4 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.popular-content h4 a:hover {
    color: var(--primary);
}

.popular-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.popular-meta .category {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.75rem;
}

.popular-meta .views {
    display: flex;
    align-items: center;
    gap: 5px;
}

.popular-meta .views i {
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .popular-section {
        padding: 20px;
    }
    
    .popular-list {
        grid-template-columns: 1fr;
    }
    
    .popular-item {
        padding: 15px;
    }
}

/* =============================================
   Footer Styles
   ============================================= */
.site-footer {
    background: var(--header-bg);
    color: var(--text-light);
    padding: 40px 20px 20px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3,
.footer-section h4 {
    color: var(--text-light);
    margin-bottom: 15px;
}

.footer-section h3 {
    font-size: 1.3rem;
}

.footer-section h4 {
    font-size: 1.1rem;
}

.footer-section p {
    color: var(--text-muted-light);
    font-size: 0.9rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-muted-light);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.footer-social a {
    color: var(--text-muted-light);
    font-size: 1.2rem;
    transition: color var(--transition-fast);
}

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

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

.footer-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    color: var(--text-muted-light);
    font-size: 0.9rem;
}

.footer-legal {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.footer-legal a {
    color: var(--text-muted-light);
    font-size: 0.85rem;
}

/* =============================================
   Hero Section (Homepage)
   ============================================= */
.hero-section {
    background: linear-gradient(135deg, var(--header-bg) 0%, #3d3f4a 100%);
    color: var(--text-light);
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 40px;
    border-radius: var(--radius-lg);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted-light);
    margin-bottom: 30px;
}

.hero-search {
    margin-bottom: 30px;
}

.hero-search form {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.hero-search input {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    font-size: 1rem;
}

.hero-search button {
    padding: 12px 25px;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

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

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

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

/* =============================================
   Category Section
   ============================================= */
.category-section {
    margin-bottom: 40px;
}

.category-section h2 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 25px;
    text-align: center;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.category-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.category-icon i {
    font-size: 1.8rem;
    color: var(--primary);
}

.category-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.category-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.category-count {
    display: inline-block;
    background: var(--bg-light);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* =============================================
   Tutorial Grid (Latest/Popular)
   ============================================= */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.tutorial-card {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
}

.tutorial-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.tutorial-card-header {
    margin-bottom: 10px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tutorial-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.tutorial-card h3 a {
    color: var(--text-dark);
}

.tutorial-card h3 a:hover {
    color: var(--primary);
}

.tutorial-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: -webkit-box;
    display: box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.tutorial-card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted-light);
}

/* =============================================
   Tutorial Content Page
   ============================================= */
.tutorial-page {
    padding-top: 20px;
}

.tutorial-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.tutorial-header h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.tutorial-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tutorial-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tutorial-meta .meta-item i {
    color: var(--primary);
}

.tutorial-share {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tutorial-share > span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.share-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: transform var(--transition-fast);
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn.facebook { background: #3b5998; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0077b5; }
.share-btn.whatsapp { background: #25d366; }

/* Tutorial Content */
.tutorial-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.tutorial-content h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.tutorial-content h3 {
    margin-top: 25px;
    margin-bottom: 12px;
}

.tutorial-content ul,
.tutorial-content ol {
    margin-bottom: 20px;
    padding-left: 25px;
}

.tutorial-content li {
    margin-bottom: 8px;
}

.tutorial-content a {
    color: var(--primary);
    text-decoration: underline;
}

.tutorial-content img {
    border-radius: var(--radius-md);
    margin: 20px 0;
}

/* Code Block */
.code-examples-section {
    margin-top: 40px;
}

.code-examples-section h2 {
    margin-bottom: 15px;
}

.code-block-wrapper {
    background: var(--code-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    border-left: 4px solid var(--code-border);
    margin: 15px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    color: var(--text-light);
    padding: 10px 15px;
    font-size: 0.9rem;
}

.copy-btn {
    background: var(--primary);
    color: var(--text-light);
    border: none;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background var(--transition-fast);
}

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

.code-block-wrapper pre {
    padding: 15px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block-wrapper code {
    font-family: inherit;
}

/* Try It Button */
.tryit-btn {
    background: var(--header-bg);
    color: var(--text-light);
    border: none;
    padding: 12px 25px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    transition: background var(--transition-fast);
}

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

/* Tutorial Navigation */
.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.nav-btn {
    flex: 1;
    padding: 15px 20px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--primary-light);
}

.nav-btn.prev {
    text-align: left;
}

.nav-btn.next {
    text-align: right;
}

.nav-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.nav-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

/* Related Tutorials */
.related-tutorials {
    margin-top: 40px;
}

.related-tutorials h3 {
    margin-bottom: 20px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-dark);
    transition: all var(--transition-fast);
}

.related-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.related-item i {
    color: var(--primary);
}

/* =============================================
   Search Page
   ============================================= */
.search-page h1 {
    margin-bottom: 20px;
}

.search-form-wrapper {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.search-input-group button {
    padding: 12px 25px;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.search-input-group button:hover {
    background: var(--primary-dark);
}

.search-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-filter label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-filter select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.results-info {
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--text-muted);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-result-item {
    padding: 20px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.search-result-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.search-result-item h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.search-result-item h3 a {
    color: var(--text-dark);
}

.search-result-item h3 a:hover {
    color: var(--primary);
}

.search-result-item h3 mark {
    background: var(--accent-yellow);
    color: var(--text-dark);
    padding: 2px 4px;
    border-radius: 2px;
}

.result-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.result-description mark {
    background: var(--accent-yellow);
    color: var(--text-dark);
    padding: 2px 4px;
    border-radius: 2px;
}

.result-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted-light);
}

.no-results,
.search-prompt {
    text-align: center;
    padding: 40px 20px;
}

.no-results i,
.search-prompt i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.no-results h3,
.search-prompt h3 {
    margin-bottom: 10px;
    color: var(--text-dark);
}

.no-results p,
.search-prompt p {
    color: var(--text-muted);
}

.popular-searches {
    margin-top: 30px;
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.search-tag {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.search-tag:hover {
    background: var(--primary);
    color: var(--text-light);
}

/* =============================================
   404 Error Page
   ============================================= */
.error-page {
    padding: 40px 0;
}

.error-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 20px;
}

.error-container h1 {
    margin-bottom: 15px;
}

.error-container > p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.error-suggestions {
    background: var(--bg-light);
    padding: 25px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    text-align: left;
}

.error-suggestions h3 {
    margin-bottom: 15px;
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
}

.error-suggestions li {
    margin-bottom: 10px;
}

.error-search {
    margin-bottom: 30px;
}

.error-search h3 {
    margin-bottom: 15px;
}

.error-popular .popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.popular-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-dark);
    transition: all var(--transition-fast);
}

.popular-card:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.popular-card i {
    color: var(--primary);
}

/* =============================================
   Sitemap Page
   ============================================= */
.sitemap-page h1 {
    margin-bottom: 10px;
}

.sitemap-page > p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.sitemap-section {
    margin-bottom: 40px;
}

.sitemap-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.sitemap-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.sitemap-list a {
    color: var(--text-dark);
    padding: 8px 12px;
    display: block;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sitemap-list a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sitemap-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.sitemap-category {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius-md);
}

.sitemap-category h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.sitemap-category h3 a {
    color: var(--text-dark);
}

.sitemap-category h3 a:hover {
    color: var(--primary);
}

.sitemap-category p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.sitemap-subcategories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sitemap-subcategories li {
    margin-bottom: 5px;
}

.sitemap-subcategories a {
    color: var(--primary);
    font-size: 0.9rem;
}

.sitemap-tutorials h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.sitemap-tutorials h3:first-child {
    border-top: none;
    padding-top: 0;
}

.sitemap-tutorials-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.sitemap-tutorials-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.sitemap-tutorials-list a {
    color: var(--text-dark);
}

.sitemap-tutorials-list a:hover {
    color: var(--primary);
}

.tutorial-date {
    font-size: 0.85rem;
    color: var(--text-muted-light);
}

/* =============================================
   Pagination
   ============================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.pagination span.active {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.pagination span.disabled {
    color: var(--text-muted-light);
    border-color: transparent;
}

/* =============================================
   Breadcrumbs
   ============================================= */
.breadcrumbs {
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

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

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

.breadcrumbs span {
    color: var(--text-muted);
    margin: 0 5px;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background var(--transition-fast);
}

.btn:hover {
    background: var(--primary-dark);
    color: var(--text-light);
}

.btn-secondary {
    background: var(--header-bg);
}

.btn-secondary:hover {
    background: #3d3f4a;
}

/* =============================================
   Ad Placeholder
   ============================================= */
.ad-placeholder {
    background: var(--bg-light);
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-muted-light);
    font-size: 0.9rem;
}

/* =============================================
   Features Section
   ============================================= */
.features-section {
    margin: 40px 0;
}

.features-section h2 {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-card {
    text-align: center;
    padding: 30px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 2rem;
    color: var(--text-light);
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 1200px) {
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
        padding: 15px;
    }
    
    .left-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
    
    .content-area {
        padding: 0;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-nav {
        display: none;
        width: 100%;
        order: 3;
    }
    
    .main-nav.show {
        display: block;
    }
    
    .nav-menu {
        flex-direction: column;
        padding: 10px 0;
    }
    
    .nav-menu > li > a {
        padding: 12px 15px;
    }
    
    .header-search {
        order: 2;
        margin: 10px 0;
    }
    
    .search-box input[type="text"] {
        width: 100%;
    }
    
    .hero-section {
        padding: 40px 15px;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .tutorial-navigation {
        flex-direction: column;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-top {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-legal {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.4rem;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-input-group button {
        width: 100%;
    }
    
    .tutorial-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .tutorial-share {
        flex-wrap: wrap;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .tutorial-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    .site-header,
    .left-sidebar,
    .right-sidebar,
    .site-footer,
    .breadcrumb,
    .tutorial-share,
    .tutorial-navigation,
    .related-tutorials,
    .tryit-btn,
    .copy-btn {
        display: none !important;
    }
    
    .main-content {
        display: block;
    }
    
    .content-area {
        width: 100%;
        padding: 0;
    }
    
    .tutorial-content {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .code-block-wrapper {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}