/*
Theme Name: Optimized SEO Theme
Theme URI: https://example.com
Author: Your Name
Author URI: https://example.com
Description: Theme WordPress tối ưu SEO, tốc độ và responsive cho mọi thiết bị
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: optimized-theme
Tags: blog, news, seo, responsive, fast, mobile-first, schema-ready
*/

/* ================================
   CSS RESET & BASE
   ================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ================================
   LAYOUT CONTAINER
   ================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ================================
   HEADER
   ================================ */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

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

.site-description {
    font-size: 0.875rem;
    color: #6b7280;
    display: none;
}

/* ================================
   NAVIGATION
   ================================ */
.main-navigation {
    display: none;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-navigation a {
    font-weight: 500;
    color: #374151;
    padding: 0.5rem 0;
    position: relative;
}

.main-navigation a:hover {
    color: #2563eb;
    text-decoration: none;
}

.main-navigation .current-menu-item a {
    color: #2563eb;
}

/* Mobile Menu Button */
.menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #374151;
    margin: 5px 0;
    transition: 0.3s;
}

/* ================================
   MOBILE MENU
   ================================ */
.mobile-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.mobile-menu.active {
    display: block;
}

.mobile-menu ul {
    list-style: none;
}

.mobile-menu li {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-menu a {
    display: block;
    padding: 0.75rem 0;
    color: #374151;
    font-weight: 500;
}

/* ================================
   MAIN CONTENT
   ================================ */
.site-main {
    min-height: 60vh;
    padding: 2rem 0;
}

.content-area {
    width: 100%;
}

/* ================================
   POSTS GRID
   ================================ */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.post-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.post-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.post-thumbnail {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f3f4f6;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content {
    padding: 1.5rem;
}

.post-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    color: #111;
}

.post-title a {
    color: inherit;
}

.post-title a:hover {
    color: #2563eb;
    text-decoration: none;
}

.post-excerpt {
    color: #4b5563;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #2563eb;
}

/* ================================
   SINGLE POST
   ================================ */
.single-post .entry-header {
    margin-bottom: 2rem;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.single-post .entry-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111;
}

.single-post .entry-meta {
    color: #6b7280;
    font-size: 0.875rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.entry-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #374151;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111;
    line-height: 1.3;
}

.entry-content h2 { font-size: 1.75rem; }
.entry-content h3 { font-size: 1.5rem; }
.entry-content h4 { font-size: 1.25rem; }

.entry-content p {
    margin-bottom: 1.5rem;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #4b5563;
}

.entry-content img {
    border-radius: 0.5rem;
    margin: 2rem 0;
}

.entry-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ================================
   PAGINATION
   ================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination .current {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.pagination a {
    background: #f3f4f6;
    color: #374151;
}

.pagination a:hover {
    background: #e5e7eb;
    text-decoration: none;
}

.pagination .current {
    background: #2563eb;
    color: #fff;
}

/* ================================
   SIDEBAR
   ================================ */
.widget-area {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.widget {
    margin-bottom: 2rem;
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #111;
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.widget a {
    color: #4b5563;
}

.widget a:hover {
    color: #2563eb;
}

/* ================================
   FOOTER
   ================================ */
.site-footer {
    background: #111827;
    color: #9ca3af;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-widgets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-widget-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

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

.footer-widget li {
    margin-bottom: 0.5rem;
}

.footer-widget a {
    color: #9ca3af;
}

.footer-widget a:hover {
    color: #fff;
}

.site-info {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    font-size: 0.875rem;
}

/* ================================
   BREADCRUMBS
   ================================ */
.breadcrumbs {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
}

.breadcrumbs a {
    color: #6b7280;
}

.breadcrumbs a:hover {
    color: #2563eb;
}

.breadcrumbs .current {
    color: #111;
    font-weight: 500;
}

/* ================================
   SEARCH FORM
   ================================ */
.search-form {
    display: flex;
    max-width: 600px;
    margin: 2rem auto;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem 0 0 0.375rem;
    font-size: 1rem;
    outline: none;
}

.search-form input[type="search"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-form button {
    padding: 0.75rem 1.5rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 0 0.375rem 0.375rem 0;
    cursor: pointer;
    font-weight: 600;
}

.search-form button:hover {
    background: #1d4ed8;
}

/* ================================
   404 PAGE
   ================================ */
.error-404 {
    text-align: center;
    padding: 4rem 1rem;
}

.error-404 .page-title {
    font-size: 6rem;
    font-weight: 800;
    color: #e5e7eb;
    line-height: 1;
    margin-bottom: 1rem;
}

.error-404 h2 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 1rem;
}

/* ================================
   ACCESSIBILITY
   ================================ */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ================================
   LAZY LOAD PLACEHOLDER
   ================================ */
.lazyload,
.lazyloading {
    opacity: 0;
}

.lazyloaded {
    opacity: 1;
    transition: opacity 0.3s;
}

/* ================================
   RESPONSIVE - TABLET
   ================================ */
@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .single-post .entry-title {
        font-size: 2.5rem;
    }

    .site-description {
        display: block;
    }
}

/* ================================
   RESPONSIVE - DESKTOP
   ================================ */
@media (min-width: 1024px) {
    .menu-toggle {
        display: none;
    }

    .main-navigation {
        display: block;
    }

    .mobile-menu {
        display: none !important;
    }

    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-widgets {
        grid-template-columns: repeat(4, 1fr);
    }

    .content-sidebar {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 3rem;
    }

    .widget-area {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    .single-post .entry-title {
        font-size: 3rem;
    }
}

/* ================================
   DARK MODE SUPPORT
   ================================ */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #e2e8f0;
    }

    .site-header {
        background: #1e293b;
        border-color: #334155;
    }

    .site-title {
        color: #f8fafc;
    }

    .main-navigation a {
        color: #cbd5e1;
    }

    .post-card {
        background: #1e293b;
        border-color: #334155;
    }

    .post-title {
        color: #f8fafc;
    }

    .entry-content {
        color: #cbd5e1;
    }

    .entry-content h2,
    .entry-content h3,
    .entry-content h4 {
        color: #f8fafc;
    }
}

/* ================================
   PRINT STYLES
   ================================ */
@media print {
    .site-header,
    .widget-area,
    .site-footer,
    .comments-area,
    .post-navigation,
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    a {
        text-decoration: underline;
        color: #000;
    }

    .entry-content {
        max-width: 100%;
    }
}
