/*
Theme Name: Theme LBd Custom
Description: Theme WordPress tùy chỉnh 3 cột với nhiều tính năng: custom post hiển thị, tùy chỉnh màu sắc, SEO tối ưu, cache, analytics, mobile responsive
Version: 1.0.1
Author: LBd Developer
Author URI: https://linhbadien.com
Theme URI: https://linhbadien.com
Text Domain: themelbd
Domain Path: /languages
Requires at least: 5.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, news, three-columns, custom-colors, custom-menu, custom-logo, featured-images, footer-widgets, full-width-template, sticky-post, theme-options, threaded-comments, translation-ready, responsive-layout
*/

/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family, 'Arial, sans-serif');
    line-height: 1.6;
    color: var(--text-color, #333);
    background-color: var(--bg-color, #ffffff);
}

/* CSS Variables cho tùy chỉnh màu sắc */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --menu-bg: #34495e;
    --menu-text: #ffffff;
    --menu-hover: #3498db;
    --sidebar-width: 250px;
    --sidebar-bg: #f8f9fa;
    --sidebar-text: #333333;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
    --accent-color: #3498db;
    --border-color: #e9ecef;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --container-width: 1200px;
    --banner-height: 400px;
    --banner-overlay: 0.4;
    --posts-columns: 2;
}

/* Container chính */
.container {
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 0.5rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
    width: 100%;
    overflow: visible;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.site-title {
    font-size: 2rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--header-text);
}

.site-description {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Header Widgets - Removed completely */

/* Navigation Menu - Sticky và căn giữa với content area */
.main-navigation {
    background-color: var(--menu-bg);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Sticky menu effect khi scroll */
.main-navigation.scrolled {
    background-color: rgba(52, 73, 94, 0.95);
    backdrop-filter: blur(10px);
}

/* Navigation container - Align với content area, không full width */
.main-navigation .container {
    max-width: calc(var(--container-width) - 2 * var(--sidebar-width) - 4rem);
    margin: 0 auto;
    padding: 0 1rem;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    justify-content: center; /* Center menu items */
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--menu-text);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.main-navigation a:hover {
    background-color: var(--menu-hover);
}

/* Dropdown Menu */
.main-navigation .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--menu-bg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 300;
}

.main-navigation li:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-navigation .sub-menu li {
    width: 100%;
}

.main-navigation .sub-menu a {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--menu-text);
    cursor: pointer;
    padding: 0.5rem;
    align-items: center;
    gap: 0.5rem;
}

.hamburger {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 15px;
    justify-content: space-between;
}

.hamburger span {
    width: 100%;
    height: 2px;
    background-color: var(--menu-text);
    transition: all 0.3s ease;
}

.primary-menu-container {
    display: flex;
}

/* Banner/Hero Section - Complete and Consolidated */
.site-banner {
    position: relative;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    margin-bottom: 0;
    height: var(--banner-height, 400px);
    min-height: 300px;
    max-height: 80vh;
    z-index: 50;
    width: 100%;
    clear: both;
    transition: height 0.3s ease;
    overflow: hidden;
    /* Default gradient background */
    background: linear-gradient(135deg, var(--header-bg) 0%, var(--accent-color) 100%);
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, var(--banner-overlay, 0.4));
    z-index: 1;
}

.banner-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
}

.banner-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.banner-description {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
}

.banner-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.banner-button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    color: white;
}

/* Layout 3 cột */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 2rem;
    margin: 2rem 0;
    max-width: var(--container-width, 1200px);
    margin-left: auto;
    margin-right: auto;
}

/* Sidebar trái */
.sidebar-left {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 2rem;
    height: fit-content;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.sidebar-left:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

/* Nội dung chính */
.content-area {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(74, 144, 226, 0.08);
    min-height: 600px;
}

/* Sidebar phải */
.sidebar-right {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 2rem;
    height: fit-content;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.sidebar-right:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

/* Custom Post Display */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(var(--posts-columns, 2), 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.post-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.post-thumbnail {
    position: relative;
    overflow: hidden;
}

.post-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}

.post-content {
    padding: 1.5rem;
}

.post-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.post-title a {
    color: inherit;
    text-decoration: none;
}

.post-title a:hover {
    color: var(--accent-color);
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-meta {
    font-size: 0.875rem;
    color: #888;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Widget styles */
.widget {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.widget-title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.widget li:last-child {
    border-bottom: none;
}

.widget a {
    color: var(--text-color);
    text-decoration: none;
}

.widget a:hover {
    color: var(--accent-color);
}

/* Footer */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 2rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    text-align: center;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-widget {
    padding: 1rem;
}

.footer-widget h3 {
    margin-bottom: 1rem;
    color: var(--footer-text);
}

/* Footer widget styling để giữ màu sắc nhất quán */
.footer-widget .widget {
    background: transparent;
    border: none;
    color: var(--footer-text);
}

.footer-widget .widget-title {
    color: var(--footer-text);
    border-bottom: none;
}

.footer-widget .widget a {
    color: var(--footer-text);
    opacity: 0.9;
}

.footer-widget .widget a:hover {
    color: #ffffff;
    opacity: 1;
}

.footer-widget .widget li {
    border-bottom: none;
}

.footer-widget .widget p {
    color: var(--footer-text);
    opacity: 0.9;
}

/* Styling cho footer content mặc định */
.footer-widget .social-links a {
    color: var(--footer-text);
    margin-right: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-widget .social-links a:hover {
    opacity: 1;
}

.footer-widget .footer-menu {
    list-style: none;
    padding: 0;
}

.footer-widget .footer-menu li {
    padding: 0.25rem 0;
    border-bottom: none;
}

.footer-widget .footer-menu li:last-child {
    border-bottom: none;
}

.footer-widget .footer-menu a {
    color: var(--footer-text);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.footer-widget .footer-menu a:hover {
    opacity: 1;
}

.footer-widget .contact-info p {
    color: var(--footer-text);
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.footer-widget .contact-info i {
    color: var(--footer-text);
    margin-right: 0.5rem;
    width: 16px;
}

.footer-widget .contact-info a {
    color: var(--footer-text);
    text-decoration: none;
    opacity: 0.9;
}

.footer-widget .contact-info a:hover {
    opacity: 1;
}

/* Đảm bảo tất cả elements trong footer widgets có màu phù hợp */
.footer-widget * {
    color: inherit;
}

.footer-widget h1, .footer-widget h2, .footer-widget h3, 
.footer-widget h4, .footer-widget h5, .footer-widget h6 {
    color: var(--footer-text) !important;
}

.footer-widget input, .footer-widget textarea, .footer-widget select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--footer-text);
}

.footer-widget input::placeholder, .footer-widget textarea::placeholder {
    color: rgba(255,255,255,0.7);
}

.copyright {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }
    
    .main-content {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    /* Layout mobile */
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar-left,
    .sidebar-right {
        order: 2;
    }
    
    .content-area {
        order: 1;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;        min-height: auto;
        padding: 1rem 0;
    }
    
    /* Header widgets removed */
    
    .menu-toggle {
        display: flex;
    }
    
    .primary-menu-container {
        display: none;
        width: 100%;
    }
    
    .primary-menu-container.active {
        display: block;
    }
    
    .main-navigation .menu {
        flex-direction: column;
    }
    
    .main-navigation .menu a {
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 1rem;
    }
    
    .main-navigation .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(0,0,0,0.1);
        margin-left: 1rem;
    }
    
    .search-field {
        width: 150px;
    }
    
    .search-field:focus {
        width: 180px;
    }
    
    /* Footer mobile layout */
    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-widget {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
    }
    
    .search-field {
        width: 200px;
    }
    
    .banner-title {
        font-size: 1.5rem;
    }
    
    .banner-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .container {
        padding: 0 15px;
    }
}

/* Admin Bar Compatibility */
.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Animation cho load trang */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-left,
.sidebar-right {
    animation: slideInUp 0.6s ease-out;
}

.sidebar-left .widget,
.sidebar-right .widget {
    animation: slideInUp 0.6s ease-out;
    animation-delay: 0.1s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.sidebar-right .widget {
    animation-delay: 0.2s;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sidebar-left,
    .sidebar-right {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        border-color: rgba(74, 144, 226, 0.3);
    }
    
    .sidebar-left .widget,
    .sidebar-right .widget {
        background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
        border-color: rgba(74, 144, 226, 0.2);
    }
    
    .content-area {
        background: #1a1a1a;
        border-color: rgba(74, 144, 226, 0.2);
        color: #e0e0e0;
    }
}

/* Responsive Banner Media Queries - Consolidated */
@media (max-width: 768px) {
    .site-banner {
        height: calc(var(--banner-height, 400px) * 0.75);
        min-height: 250px;
        max-height: 60vh;
        background-attachment: scroll;
    }
    
    .banner-title {
        font-size: 2rem;
    }
    
    .banner-description {
        font-size: 1rem;
    }
    
    .banner-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .site-banner {
        height: calc(var(--banner-height, 400px) * 0.6);
        min-height: 200px;
        max-height: 50vh;
    }
    
    .banner-title {
        font-size: 1.5rem;
    }
    
    .banner-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Banner responsive cho các tỷ lệ màn hình khác nhau */
@media (min-aspect-ratio: 21/9) {
    .site-banner {
        height: calc(var(--banner-height, 400px) * 0.7);
        max-height: 450px;
    }
}

@media (max-aspect-ratio: 4/3) {
    .site-banner {
        height: calc(var(--banner-height, 400px) * 1.1);
        max-height: 70vh;
    }
}

/* Admin Bar Compatibility */
.admin-bar .site-banner {
    margin-top: 0;
}

@media (max-width: 782px) {
    .admin-bar .site-banner {
        margin-top: 0;
    }
}
