/*
Theme Name: SMP Theme
Theme URI: https://yourdomain.com/
Author: SMP Developer
Description: Theme tối giản quản lý bố cục, header, footer, menu và sidebar qua Customizer.
Version: 1.3.6
License: GNU General Public License v2 or later
Text Domain: smptheme
*/

/* ===========================================
   BASE
=========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
}

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

/* ===========================================
   CONTAINER
=========================================== */
.container {
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    /* max-width được inject qua wp_add_inline_style từ Customizer */
}

/* ===========================================
   HEADER
=========================================== */
header {
    background: #23282d;
    color: #fff;
    padding: 20px 0;
    position: relative;
}

.header-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.site-branding {
    flex: 1 1 auto;
}

.site-branding h1 {
    margin: 0;
    font-size: 1.5em;
    line-height: 1.2;
}

.site-branding p {
    margin: 4px 0 0;
    font-size: 0.85em;
    opacity: 0.75;
}

.header-custom-widget {
    font-size: 0.9em;
    flex-shrink: 0;
}

header a {
    color: #fff;
    text-decoration: none;
}

/* ===========================================
   NAVIGATION — Desktop
=========================================== */
.main-navigation {
    width: 100%;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95em;
    padding: 4px 0;
    display: block;
    transition: opacity 0.2s;
}

nav ul li a:hover {
    opacity: 0.75;
}

/* Hamburger button — ẩn trên desktop */
.nav-toggle {
    display: none;
    background: none;
    border: 2px solid #fff;
    color: #fff;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.2em;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
}

/* ===========================================
   LAYOUT — Main Content + Sidebar
=========================================== */
.main-content {
    display: flex;
    margin-top: 30px;
    gap: 30px;
}

.layout-sidebar-right  { flex-direction: row; }
.layout-sidebar-left   { flex-direction: row-reverse; }

.layout-no-sidebar .site-sidebar { display: none; }
.layout-no-sidebar .site-main    { flex: 0 0 100%; max-width: 100%; }

.site-main {
    flex: 1;
    min-width: 0; /* ngăn nội dung dài tràn flex container */
    background: #fff;
    padding: 20px;
    border: 1px solid #e5e5e5;
}

.site-sidebar {
    flex: 0 0 300px;
    width: 300px;
    background: #fff;
    padding: 20px;
    border: 1px solid #e5e5e5;
}

/* ===========================================
   ENTRY META & CONTENT
=========================================== */
.entry-meta {
    margin-bottom: 15px;
    color: #666;
    font-size: 0.9em;
}

/* Content alignment */
.entry-content.content-align-left   { text-align: left; }
.entry-content.content-align-center { text-align: center; }
.entry-content.content-align-right  { text-align: right; }

/* ===========================================
   FOOTER
=========================================== */
footer {
    background: #23282d;
    color: #fff;
    /* padding được inject qua wp_add_inline_style từ Customizer */
    margin-top: 30px;
}

/* Ưu tiên 2: chuyển inline style của footer-widgets-container ra đây */
.footer-widgets-container {
    display: flex;
    gap: 30px;
    text-align: left;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.footer-column {
    flex: 1;
    min-width: 0;
}

.copyright-text {
    margin: 10px 0;
    padding: 0 15px;
    color: #ffffff;
}

.footer-column ul {
    list-style: none;
    padding-left: 0;
    line-height: 1.6;
    margin: 0;
}

.footer-column a {
    color: #ccc;
    text-decoration: none;
}

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

.footer-navigation ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-navigation ul li a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9em;
}

.footer-navigation ul li a:hover {
    color: #fff;
}

/* ===========================================
   RESPONSIVE — Tablet (≤ 900px)
=========================================== */
@media (max-width: 900px) {
    .site-sidebar {
        flex: 0 0 240px;
        width: 240px;
    }
}

/* ===========================================
   RESPONSIVE — Mobile (≤ 768px)
=========================================== */
@media (max-width: 768px) {

    /* Header */
    .header-wrap {
        flex-wrap: wrap;
        align-items: center;
    }

    .site-branding {
        flex: 1 1 auto;
    }

    /* Hamburger hiện ra */
    .nav-toggle {
        display: inline-block;
    }

    /* Nav ẩn mặc định, hiện khi có class .nav-open */
    .main-navigation {
        width: 100%;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.3s ease;
    }

    .main-navigation.nav-open {
        max-height: 600px;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
        margin-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.15);
        padding-top: 8px;
    }

    nav ul li a {
        padding: 8px 4px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    /* Layout: main + sidebar xếp dọc */
    .main-content {
        flex-direction: column !important;
        gap: 20px;
    }

    .site-sidebar {
        flex: 0 0 auto;
        width: 100%;
    }

    /* Footer widget columns xếp dọc */
    .footer-widgets-container {
        flex-direction: column;
        gap: 20px;
    }

    .footer-navigation ul {
        flex-direction: column;
        gap: 6px;
    }
}

/* ===========================================
   RESPONSIVE — Small Mobile (≤ 480px)
=========================================== */
@media (max-width: 480px) {

    .container {
        padding: 0 12px;
    }

    .site-main,
    .site-sidebar {
        padding: 15px;
    }

    .site-branding h1 {
        font-size: 1.2em;
    }

    footer {
        padding-left: 0;
        padding-right: 0;
    }

    .copyright-text {
        font-size: 0.85em;
    }
}

/* ===========================================
   ACCESSIBILITY — Reduced Motion
=========================================== */
@media (prefers-reduced-motion: reduce) {
    .main-navigation {
        transition: none;
    }
    nav ul li a {
        transition: none;
    }
}

/* ===========================================
   TOP BAR (Thanh trên Header)
=========================================== */
.site-top-bar {
    width: 100%;
    font-size: 0.85em;
    line-height: 1.4;
}

.top-bar-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.top-bar-text {
    flex: 1 1 auto;
}

.top-bar-text a {
    color: inherit;
    text-decoration: underline;
}

.top-bar-widget {
    flex-shrink: 0;
}

/* Ẩn nội dung widget phụ trong top-bar (tiêu đề widget) */
.topbar-widget-item .widget-title {
    display: none;
}

/* ===========================================
   BỐ CỤC DẠNG HỘP (Boxed)
   body.layout-boxed — wrapper giới hạn giữa trang
=========================================== */
body.layout-boxed {
    /* Màu nền inject từ Customizer qua wp_add_inline_style */
}

body.layout-boxed .site-wrap {
    /* max-width + box-shadow inject từ Customizer */
    overflow: hidden;
}

/* Header và footer trong boxed: giới hạn theo site-wrap */
body.layout-boxed header,
body.layout-boxed footer {
    /* background inject từ Customizer, width tự nhiên */
}

/* ===========================================
   BỐ CỤC FULL-WIDTH
   body.layout-fullwidth — trải rộng toàn màn hình
=========================================== */
body.layout-fullwidth .container {
    /* max-width: 100% inject từ Customizer */
}

body.layout-fullwidth .site-wrap {
    max-width: 100%;
    box-shadow: none;
}

/* ===========================================
   RESPONSIVE — Top Bar
=========================================== */
@media (max-width: 768px) {
    .top-bar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .top-bar-widget {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .site-top-bar {
        font-size: 0.8em;
    }
}
