/*
Theme Name: Xoso Mega
Theme URI: https://xosomy.com/
Author: Antigravity AI
Author URI: https://google.com/
Description: Theme WordPress tối ưu cho tiếp thị liên kết (affiliate) bán vé số quốc tế, xổ số Mỹ. Giao diện chuẩn SEO, siêu nhẹ, tốc độ cao.
Version: 1.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: xoso-mega
Tags: blog, affiliate, lottery, fast-loading, mobile-first, seo-friendly, two-columns, custom-menu, custom-background
*/

/* 
 * -------------------------------------------------------------------------
 * XOSO MEGA CORE CSS 
 * ------------------------------------------------------------------------- 
 * Note: Để tối ưu tốc độ, CSS sẽ được viết Vanilla và minify khi cần.
 * File này chỉ chứa header theme, style thực sự sẽ đặt ở assets/css/main.css 
 * hoặc viết trực tiếp tại đây nếu muốn gộp 1 file. Để tiện quản lý, chúng ta viết tại đây.
 */

:root {
  --color-primary: #0056b3;
  --color-primary-dark: #004494;
  --color-secondary: #dc3545; /* Đỏ nhấn */
  --color-secondary-hover: #c82333;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-bg: #f4f6f9;
  --color-white: #ffffff;
  --color-border: #e0e0e0;
  
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --container-width: 1140px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

/* Reset cơ bản */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  font-size: 16px;
}

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

a:hover {
  color: var(--color-secondary);
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-bottom: 0.5em;
  font-weight: 700;
  color: #222;
}

/* Layout */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 15px;
}

.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content {
  flex: 1;
  padding: 30px 0;
}

/* Header */
.site-header {
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.site-logo .custom-logo-link {
  display: flex;
  align-items: center;
}

.site-logo .custom-logo-link img {
  max-height: 70px;
  width: auto;
  display: block;
}

.site-logo a.site-logo-text {
  font-size: 28px;
  font-weight: 900;
  color: var(--color-primary);
  text-transform: uppercase;
}

.header-ad {
  display: none; /* Hide on small screens by default */
}

/* ===================================================
   NAVIGATION – Compact, Dropdown, Mobile Hamburger
   =================================================== */
.main-navigation {
    background: linear-gradient(90deg, #003d8a 0%, #0056b3 100%);
    position: relative;
    z-index: 900;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* Container trong nav */
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* ── Hamburger Button (chỉ hiển thị mobile) ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 6px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 6px;
    cursor: pointer;
    margin: 6px 0;
}
.hamburger-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}
/* Hiệu ứng X khi mở */
.nav-toggle.is-open .hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open .hamburger-bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Menu List ── */
#primary-menu {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* ── Item cấp 1 ── */
#primary-menu > li {
    position: relative;
}
#primary-menu > li > a {
    display: block;
    padding: 14px 16px;
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    transition: background .2s;
}
#primary-menu > li > a:hover,
#primary-menu > li.current-menu-item > a,
#primary-menu > li.current-menu-parent > a {
    background: rgba(255,255,255,.15);
    color: #FFD700;
}

/* ── DROPDOWN – cấp 2 ── */
#primary-menu li ul.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    list-style: none;
    padding: 6px 0;
    z-index: 9999;
    animation: xm-dropdown-in .2s ease;
    border-top: 3px solid #FFD700;
}

@keyframes xm-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hiện dropdown khi hover */
#primary-menu > li:hover > ul.sub-menu,
#primary-menu > li:focus-within > ul.sub-menu {
    display: block;
}

#primary-menu ul.sub-menu li a {
    display: block;
    padding: 9px 18px;
    color: #333;
    font-size: .83rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background .15s, color .15s;
    border-bottom: 1px solid #f0f0f0;
}
#primary-menu ul.sub-menu li:last-child a {
    border-bottom: none;
}
#primary-menu ul.sub-menu li a:hover {
    background: #f0f4ff;
    color: #0056b3;
    padding-left: 24px;
}

/* Dropdown bên phải nếu bị tràn */
#primary-menu > li:last-child > ul.sub-menu,
#primary-menu > li:nth-last-child(2) > ul.sub-menu {
    left: auto;
    right: 0;
}

/* Chevron arrow trên item cha */
#primary-menu > li.menu-item-has-children > a::after {
    content: ' ▾';
    font-size: .7rem;
    opacity: .7;
}

/* ── RESPONSIVE – Mobile ── */
@media (max-width: 991px) {
    .nav-toggle {
        display: flex;
    }

    #primary-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,.15);
        padding-bottom: 8px;
    }
    #primary-menu.is-open {
        display: flex;
    }

    #primary-menu > li > a {
        padding: 11px 16px;
        font-size: .9rem;
        border-bottom: 1px solid rgba(255,255,255,.08);
        white-space: normal;
    }

    /* Sub-menu mobile: hiển thị thẳng dưới */
    #primary-menu li ul.sub-menu {
        position: static;
        display: none;
        background: rgba(0,0,0,.2);
        border-radius: 0;
        box-shadow: none;
        border-top: none;
        animation: none;
        padding: 0;
    }
    #primary-menu li.is-open > ul.sub-menu {
        display: block;
    }
    #primary-menu ul.sub-menu li a {
        color: rgba(255,255,255,.85);
        padding: 9px 16px 9px 32px;
        border-bottom: 1px solid rgba(255,255,255,.05);
        font-size: .82rem;
    }
    #primary-menu ul.sub-menu li a:hover {
        background: rgba(255,255,255,.1);
        color: #FFD700;
        padding-left: 38px;
    }

    /* Toggle mở submenu trên mobile bằng click */
    #primary-menu > li.menu-item-has-children > a::after {
        float: right;
        margin-right: 4px;
    }
}

/* ── Desktop: hiện header-ad ── */

.content-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 992px) {
  .content-area {
    grid-template-columns: 2.5fr 1fr;
  }
  .header-ad {
    display: block;
  }
}

/* Articles */
.post-card {
  background: var(--color-white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  transition: transform 0.3s ease;
}

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

.post-thumbnail img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.post-content {
  padding: 20px;
}

.post-title {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 15px;
}

/* Buttons & CTAs */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-weight: 600;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  border: 1px solid var(--color-primary);
}

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

.btn-danger {
  background-color: var(--color-secondary);
  color: var(--color-white);
  border: 1px solid var(--color-secondary);
}

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

/* Sidebar Widgets */
.widget {
  background: var(--color-white);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.widget-title {
  font-size: 1.1rem;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-transform: uppercase;
}

.widget ul {
  list-style: none;
}

.widget li {
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--color-border);
  padding-bottom: 10px;
}

.widget li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Ads Blocks */
.ad-block {
  text-align: center;
  margin: 20px 0;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-light);
}

/* Footer */
.site-footer {
  background-color: #1a1a1a;
  color: #ccc;
  padding: 40px 0 20px;
  margin-top: auto;
}

.site-footer a {
  color: #eee;
}

.site-footer a:hover {
  color: var(--color-secondary);
}

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

@media (min-width: 768px) {
  .footer-widgets {
    grid-template-columns: repeat(3, 1fr);
  }
}

.site-info {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #333;
  font-size: 0.9rem;
}
