/* ========== Global Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0645ad;
    --primary-dark: #0645ad;
    --secondary-color: #f0ad4e;
    --accent-color: #5cb85c;
    --danger-color: #d9534f;
    --text-color: #202122;
    --text-light: #666;
    --bg-color: #f8f9fa;
    --bg-light: #ffffff;
    --border-color: #a2a9b1;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

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

/* ========== Navigation Bar ========== */
.navbar {
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

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

.nav-logo a {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 28px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 12px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    text-decoration: none;
}

.nav-search {
    display: flex;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 250px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

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

/* Search suggestions dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    max-height: 320px;
    overflow: auto;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 14px;
    border-bottom: 1px solid #efefef;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover,
.search-result-item.active {
    background-color: #f5f8ff;
    color: var(--primary-color);
}

@media (max-width: 480px) {
    .search-results { right: -8px; left: -8px; }
}

/* ========== Main Layout ========== */
.main-wrapper {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

/* ========== Sidebar ========== */
.sidebar {
    grid-column: 1;
}

.sidebar-widget {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.widget-title {
    background: linear-gradient(to right, #eee, #f9f9f9);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
}

.widget-list {
    list-style: none;
    padding: 0;
}

.widget-list li {
    border-bottom: 1px solid #f0f0f0;
}

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

.widget-list a {
    display: block;
    padding: 12px 15px;
    color: var(--primary-color);
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.widget-list a:hover {
    background-color: #f9f9f9;
    text-decoration: none;
    color: var(--primary-dark);
}

/* ========== Content Area ========== */
.content {
    grid-column: 2;
}

/* ========== Hero Section ========== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a5fa0 100%);
    color: white;
    padding: 60px 40px;
    border-radius: 8px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 15px;
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 25px;
    opacity: 0.95;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

/* ========== Buttons ========== */
.btn {
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    border: none;
}

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

.btn-primary:hover {
    background-color: #ec971f;
    text-decoration: none;
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--primary-color);
    text-decoration: none;
}

/* ========== Sections ========== */
.section-title {
    font-size: 32px;
    font-weight: bold;
    margin: 40px 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

/* ========== Features Grid ========== */
.features-section {
    margin-bottom: 50px;
}

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

.feature-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

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

.feature-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.feature-card p {
    color: var(--text-light);
    font-size: 14px;
    flex-grow: 1;
    margin-bottom: 15px;
}

.card-link {
    color: var(--primary-color);
    font-weight: 600;
    align-self: center;
}

/* ========== Quick Start ========== */
.quick-start {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px;
    margin-bottom: 50px;
    box-shadow: var(--shadow);
}

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

.step {
    text-align: center;
}

.step-number {
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 15px;
}

.step h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.step p {
    color: var(--text-light);
    font-size: 14px;
}

/* ========== Popular Section ========== */
.popular-section {
    margin-bottom: 50px;
}

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

.article-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.article-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
}

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

.article-card h3 a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.article-card p {
    color: var(--text-light);
    font-size: 14px;
    flex-grow: 1;
    margin-bottom: 15px;
}

.article-meta {
    display: inline-block;
    background-color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

/* ========== Info Box ========== */
.info-box {
    background-color: #fff3cd;
    border-left: 4px solid var(--secondary-color);
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.info-box h3 {
    margin-bottom: 10px;
    color: #856404;
    font-size: 18px;
}

.info-box p {
    color: #856404;
    margin: 0;
}

.info-box code {
    background-color: #ffeaa7;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* ========== Footer ========== */
.footer {
    background-color: #2c3e50;
    color: white;
    margin-top: 60px;
    padding: 40px 20px 20px;
}

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

.footer-section h4 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #ecf0f1;
}

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

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

.footer-section a {
    color: #bdc3c7;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: #ecf0f1;
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .main-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .content {
        order: 1;
        grid-column: 1;
    }

    .nav-menu {
        display: none;
    }

    .hero {
        padding: 40px 20px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
        gap: 10px;
    }

    .nav-search {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

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

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

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

    .hero-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

/* ========== Code Styling ========== */
code {
    background-color: #f4f4f4;
    color: black;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

pre {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* ========== Tables ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

th {
    background-color: #f0f0f0;
    padding: 12px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

tr:hover {
    background-color: #f9f9f9;
}

/* ========== Utilities ========== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ========== Edit button (top-right) ========== */
.edit-button {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1100;
    background-color: var(--bg-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    opacity: 0.98;
}

.edit-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

@media (max-width: 480px) {
    .edit-button {
        top: 8px;
        right: 8px;
        padding: 6px 8px;
        font-size: 13px;
    }
}
