/*
Theme Name: CanhMe Coupons
Theme URI: https://canhme.vn
Author: CanhMe
Author URI: https://canhme.vn
Description: Theme WordPress chuyên về mã giảm giá tên miền, hosting, cloud email.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: canhme-coupons
*/

*,
*::before,
*::after { box-sizing: border-box; }

:root {
    --bg: #ecf1f4;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; transition: .2s ease; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 999;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 4px 22px rgba(15,23,42,.08);
}

.header-inner {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 0;
}

/* ── Logo ── */
.site-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 1.2rem;
    color: #111827;
    flex-shrink: 0;
    text-decoration: none;
    letter-spacing: -.01em;
    margin-right: 32px;
}
.site-logo:hover { opacity: .88; color: #111827; }
.site-logo svg { flex-shrink: 0; border-radius: 9px; }

/* ── Desktop nav ── */
.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.header-nav ul,
.header-nav li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-nav ul {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-nav li {
    display: inline-flex;
    align-items: center;
}

.header-nav li::marker,
.header-nav li::before {
    content: none !important;
}

.header-nav .hnav-link,
.header-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #4b5563;
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    transition: color .15s, background .15s, box-shadow .15s;
    white-space: nowrap;
    letter-spacing: .01em;
}

.header-nav .hnav-link:hover,
.header-nav a:hover {
    color: #111827;
    background: #eef2ff;
}

/* Active = màu trắng + gạch dưới */
.header-nav .hnav-link.active,
.header-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 8px 16px rgba(79,70,229,.24);
}
.header-nav .hnav-link.active::after,
.header-nav a.active::after {
    content: none;
}

/* ── Hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border: none;
    background: #eef2ff;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 9px;
    margin-left: 14px;
    width: 40px;
    height: 40px;
    transition: background .15s;
}
.hamburger:hover { background: #e0e7ff; }
.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #4338ca;
    transition: .22s ease;
    transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile drawer ── */
.header-drawer {
    display: none;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 10px 0 14px;
}
.header-drawer.open { display: block; }
.header-drawer .container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.header-drawer .hnav-link,
.header-drawer a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #374151;
    font-size: .95rem;
    font-weight: 600;
    transition: background .15s, color .15s;
}
.header-drawer .hnav-link:hover,
.header-drawer a:hover {
    background: #eef2ff;
    color: #111827;
}
.header-drawer .hnav-link.active,
.header-drawer a.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

/* ── Hero banner (chỉ title + mô tả, không stats/search) ── */
.home-hero {
    background: linear-gradient(135deg, #17145a 0%, #2d2b8f 60%, #1e3a8a 100%);
    padding: 36px 0 32px;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,.12);
}
.home-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 80% at 5% 50%, rgba(129,140,248,.18), transparent),
        radial-gradient(ellipse 40% 60% at 90% 20%, rgba(99,102,241,.14), transparent);
    pointer-events: none;
}
.home-hero__inner { position: relative; }
.home-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 900;
    color: #fff;
    letter-spacing: -.02em;
    line-height: 1.2;
}
.home-hero p {
    margin: 0;
    color: #c7d2fe;
    font-size: 1rem;
    max-width: 520px;
}

/* Content layout */
.breadcrumb { font-size: .82rem; color: #9ca3af; padding: 12px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: #9ca3af; }

.content-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    padding-top: 12px;
    padding-bottom: 48px;
}

.primary-content { min-width: 0; }

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 6px 16px rgba(15,23,42,.05);
}
.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1px solid #e9eef5;
    color: #4b5563;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 700;
    padding: 8px 14px;
}
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-count {
    display: inline-flex;
    justify-content: center;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: .72rem;
    background: rgba(0,0,0,.07);
    color: inherit;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 6px 16px rgba(15,23,42,.05);
}
.section-title {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1.2;
    color: #0f172a;
}

/* Listing cards */
.coupons-list { display: flex; flex-direction: column; gap: 16px; }

.cp-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
    display: flex;
    overflow: hidden;
}
.cp-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.cp-thumb {
    width: 380px;
    min-width: 380px;
    background: #dbeafe;
    position: relative;
}
.cp-thumb__img {
    width: 100%;
    height: 100%;
    min-height: 220px;
    object-fit: cover;
}
.cp-thumb__fallback {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cp-thumb__fallback span { font-size: 3rem; color: #fff; font-weight: 800; }
.cp-thumb__label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(17,24,39,.85);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 5px;
    padding: 4px 8px;
}
.cp-thumb__discount {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 10px;
}

.cp-body { flex: 1; padding: 18px 22px; min-width: 0; display: flex; flex-direction: column; }
.cp-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.cp-tag {
    display: inline-flex;
    align-items: center;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 9px;
}
.cp-tag--hot { background: #fef3c7; color: #92400e; }
.cp-tag--expired { background: #f1f5f9; color: #64748b; }
.cp-tag--urgent { background: #fee2e2; color: #b91c1c; }

.cp-title {
    margin: 0 0 7px;
    font-size: 2rem;
    line-height: 1.32;
    font-weight: 800;
}
.cp-title a { color: var(--text); }
.cp-title a:hover { color: var(--primary); }

.cp-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: .8rem;
}
.cp-meta__item { display: inline-flex; align-items: center; gap: 4px; }
.cp-meta__item svg { color: #9ca3af; }
.cp-meta__dot { color: #cbd5e1; }

.cp-excerpt {
    margin: 0 0 12px;
    color: #374151;
    font-size: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cp-readmore {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: .9rem;
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 14px; }
.widget {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.widget-header {
    padding: 11px 14px;
    font-size: 1.65rem;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    line-height: 1.25;
}

/* Sidebar heading highlight */
.sidebar .widget-header {
    position: relative;
    background: linear-gradient(90deg, #eef2ff 0%, #ffffff 65%);
    color: #312e81;
    letter-spacing: -.01em;
}

.sidebar .widget-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #6366f1, #4338ca);
}
.widget-body { padding: 12px 14px; }
.widget-list { display: flex; flex-direction: column; gap: 8px; }
.widget-list a {
    font-size: .9rem;
    color: #374151;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-curated-list {
    gap: 10px;
}

.sidebar-curated-list a {
    display: block;
    border: 1px solid #edf2f7;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 11px;
    transition: .18s ease;
}

.sidebar-curated-list a:hover {
    border-color: #c7d2fe;
    background: #eef2ff;
    transform: translateY(-1px);
}

.sidebar-curated-title {
    display: block;
    color: #1f2937;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.45;
}

.sidebar-curated-meta {
    display: block;
    margin-top: 4px;
    font-size: .75rem;
    color: #6b7280;
}

.sidebar-empty {
    display: block;
    color: #9ca3af;
    font-size: .85rem;
}

/* Domain price table */
.domain-price-table {
    display: flex;
    flex-direction: column;
    border: 1px solid #e6ebf2;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.domain-price-head,
.domain-price-row {
    display: grid;
    grid-template-columns: 56px 1fr 1fr 1fr;
    gap: 6px;
    align-items: center;
    padding: 8px 8px;
}

.domain-price-head {
    background: #f8fafc;
    border-bottom: 1px solid #e6ebf2;
    font-size: .74rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
}

.domain-price-row {
    font-size: .82rem;
    font-weight: 800;
    color: #1f2937;
    border-bottom: 1px solid #edf2f7;
}

.domain-price-row:last-child { border-bottom: none; }
.domain-price-row:hover { background: #f8fafc; }

.domain-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.domain-provider img,
.domain-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    object-fit: contain;
    padding: 2px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .74rem;
    font-weight: 800;
    color: #4f46e5;
    flex-shrink: 0;
}

.domain-price-value {
    text-align: center;
    font-size: .75rem;
    font-weight: 900;
    color: #4338ca;
    letter-spacing: .01em;
    padding: 1px 4px;
    border-radius: 6px;
    background: #f8faff;
    border: 1px solid #e8ecff;
}

.domain-price-value small {
    margin-left: 2px;
    font-size: .58rem;
    font-weight: 700;
    color: #6366f1;
    text-transform: uppercase;
}

/* WordPress default widgets in sidebar */
.sidebar .widget > h2,
.sidebar .widget > h3,
.sidebar .widget > .widget-title {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.35;
}

.sidebar .widget ul {
    margin: 0;
    padding: 12px 16px 14px 26px;
}

.sidebar .widget li {
    margin: 0 0 8px;
    color: #4b5563;
    font-size: .98rem;
}

.sidebar .widget li:last-child { margin-bottom: 0; }

.sidebar .widget a {
    color: #4f46e5;
    font-weight: 600;
}

.sidebar .widget a:hover { color: #4338ca; }

.sidebar .widget p,
.sidebar .widget form {
    margin: 0;
    padding: 14px 16px;
}

.sidebar .widget input[type="search"],
.sidebar .widget input[type="text"] {
    width: 100%;
    height: 40px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    font-size: .92rem;
    background: #f8fafc;
}

.sidebar .widget input[type="search"]:focus,
.sidebar .widget input[type="text"]:focus {
    border-color: #a5b4fc;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.sidebar .widget input[type="submit"],
.sidebar .widget button[type="submit"] {
    border: none;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #fff;
    height: 40px;
    border-radius: 10px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.sidebar .widget .search-form,
.sidebar .widget form[role="search"] {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Pagination */
.pagination { margin-top: 18px; }
.pagination ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; }
.pagination .page-numbers {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #475569;
    background: #fff;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Footer */
.site-footer {
    background: #0f172a;
    color: #94a3b8;
    margin-top: 46px;
    padding: 40px 0 24px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 28px;
}
.footer-col-title {
    color: #fff;
    font-size: .85rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.footer-links { display: flex; flex-direction: column; gap: 7px; }
.footer-links a { color: #94a3b8; font-size: .88rem; }
.footer-bottom {
    margin-top: 24px;
    border-top: 1px solid rgba(148,163,184,.2);
    padding-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: space-between;
    font-size: .8rem;
}

/* Copy toast */
.copy-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    opacity: 0;
    transform: translateY(12px);
    transition: .25s ease;
    z-index: 9999;
}
.copy-toast.show { opacity: 1; transform: translateY(0); }

/* Single pages basic support */
.single-coupon-hero {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
}

/* Responsive */
@media (max-width: 1100px) {
    .content-area { grid-template-columns: 1fr; }
    .cp-title { font-size: 1.9rem; }
    .cp-excerpt { font-size: 1.3rem; }
}

@media (max-width: 900px) {
    .header-nav { display: none; }
    .hamburger { display: flex; }
    .cp-card { flex-direction: column; }
    .cp-thumb { width: 100%; min-width: 100%; }
    .cp-thumb__img { min-height: 210px; }
    .cp-title { font-size: 1.45rem; }
    .cp-excerpt { font-size: 1rem; }
    .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .container { padding: 0 14px; }
    .home-hero h1 { font-size: 1.5rem; }
    .home-hero p { font-size: .9rem; }
}

/* WordPress defaults */
.alignleft { float: left; margin: 0 16px 12px 0; }
.alignright { float: right; margin: 0 0 12px 16px; }
.aligncenter { display: block; margin: 0 auto 12px; }
.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;
}
