﻿/*
Theme Name: APTLAW Child Theme
Theme URI: http://localhost:8081/web/
Description: Child theme for APTLAW based on ColorMag Pro and gioithieu design.
Author: APTLAW
Author URI: http://localhost:8081/web/
Template: colormag-pro
Version: 1.0.1
Text Domain: aptlaw-child
*/

/* --- Top Bar & Language Switcher --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 38px;
    background-color: #03081e; /* Dark navy matching header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1001;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
}

.top-bar-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar-left i {
    color: #818cf8; /* primary color indigo */
    margin-right: 5px;
}

.top-bar-right {
    display: flex;
    align-items: center;
}

/* Polylang Flag Customization */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher li {
    display: inline-flex;
    align-items: center;
}

.lang-switcher a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: color 0.3s, transform 0.2s;
}

.lang-switcher a:hover {
    color: #ffffff;
}

.lang-switcher li.current-lang-item a {
    color: #ffffff;
    font-weight: 600;
}

.lang-switcher img.pll-parent-img,
.lang-switcher img {
    width: 18px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.lang-divider {
    color: rgba(255, 255, 255, 0.5);
}

/* Header Position Adjustment */
.header {
    top: 38px !important;
}

/* Page content top padding adjustment to prevent hiding under header */
body {
    padding-top: 38px;
}

/* WordPress Admin Bar Compatibility */
body.admin-bar .top-bar {
    top: 32px;
}

body.admin-bar .header {
    top: 70px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .top-bar {
        top: 46px;
    }
    body.admin-bar .header {
        top: 84px !important;
    }
}

/* Navigation Dropdown Support for News */
.nav-list li {
    position: relative;
}

.nav-item-has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 9, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    min-width: 220px;
    padding: 10px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    text-align: left;
}

.dropdown-menu a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #ffffff !important;
    padding-left: 25px;
}

/* =====================================================
   MEGA MENU POSITION FIX (WordPress + top-bar offset)
   
   Strategy: Use position:fixed so mega-menu is always
   anchored to the viewport, not a positioned parent.
   
   top-bar: 38px (fixed, z-index 1001)
   header:  80px height, top: 38px (fixed, z-index 1000)
   → mega-menu top = 38 + 80 = 118px from viewport
   ===================================================== */
@media (min-width: 992px) {
    /* Switch from absolute to fixed, correct top offset */
    .mega-menu {
        position: fixed !important;
        top: 118px !important;
        left: 0 !important;
        width: 100vw !important;
        z-index: 9990 !important;
    }

    /* When WordPress admin bar is present (32px height) */
    body.admin-bar .mega-menu {
        top: 150px !important; /* 32 + 38 + 80 */
    }

    /* header and nav must allow overflow for submenus */
    .header {
        overflow: visible !important;
    }
    .nav-menu,
    .navbar-container,
    .nav-list {
        overflow: visible !important;
    }

    /* Dropdown (Tin Tức) also needs high z-index */
    .dropdown-menu {
        z-index: 9990 !important;
    }
}

/* Admin bar mobile breakpoint (46px height) */
@media screen and (max-width: 782px) {
    body.admin-bar .mega-menu {
        top: 164px !important; /* 46 + 38 + 80 */
    }
}

/* =====================================================
   COLORMAG DEFAULT TEMPLATES CONTRAST FIX
   Fix contrast for category, archive, and single posts 
   on the dark navy background (#000529).
   ===================================================== */
/* Page Title (e.g. Category Name) */
.cm-page-title span,
.cm-page-title {
    color: #ffffff !important;
}

/* Post Titles */
.cm-entry-title a {
    color: #f8fafc !important;
    transition: color 0.3s ease;
}
.cm-entry-title a:hover {
    color: #818cf8 !important; /* Indigo accent */
}

/* Post Content & Excerpts */
.cm-entry-summary p,
.cm-entry-content p,
.cm-entry-content li {
    color: rgba(255, 255, 255, 0.85) !important;
    line-height: 1.7;
}

/* Meta Data (Date, Author, Categories) */
.cm-entry-header-meta a,
.cm-below-entry-meta a,
.cm-post-date time,
.cm-author a,
.cm-post-categories a {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: color 0.3s ease;
}
.cm-entry-header-meta a:hover,
.cm-below-entry-meta a:hover,
.cm-post-categories a:hover {
    color: #818cf8 !important;
}

/* SVG Icons in Meta */
.cm-icon {
    fill: rgba(255, 255, 255, 0.85) !important;
}

/* Read More Button */
.cm-entry-button {
    background-color: transparent !important;
    color: #818cf8 !important;
    border: 1px solid #818cf8 !important;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.cm-entry-button:hover {
    background-color: #818cf8 !important;
    color: #ffffff !important;
}

/* Single Post Specific Overrides */
.single-post .cm-entry-title {
    color: #ffffff !important;
}

/* Sidebar Widgets Text Contrast (if any sidebar is used) */
.widget-title {
    color: #ffffff !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}
.widget-title span {
    background-color: #000529 !important; /* Match body bg */
}
.widget ul li a {
    color: rgba(255, 255, 255, 0.9) !important;
}
.widget ul li a:hover {
    color: #818cf8 !important;
}





/* PageSpeed SEO Contrast Fixes */
.cm-reading-time,
.cm-post-date a,
.search .cm-post-date a,
.single-post .cm-post-date a,
.cm-footer-cols .cm-reading-time,
.blog .cm-footer-cols .cm-reading-time {
    color: rgba(255, 255, 255, 0.85) !important;
}
.cm-entry-summary a,
.mzb-post-title a {
    color: #818cf8 !important;
}
.cm-entry-summary a:hover,
.mzb-post-title a:hover {
    color: #ffffff !important;
}

/* Pagination Contrast */
.nav-links .page-numbers {
    color: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}
.nav-links .page-numbers.current,
.nav-links .page-numbers:hover {
    background-color: #818cf8 !important;
    color: #ffffff !important;
    border-color: #818cf8 !important;
}

/* Typography matching live site aptlaw.vn/category/ban-tin/ */
.cm-posts .post .cm-entry-title,
.cm-posts .post .cm-entry-title a,
.cm-entry-title,
.cm-entry-title a {
    font-size: 23px !important;
    line-height: 1.4 !important;
}

.cm-entry-summary,
.cm-entry-summary p {
    font-size: 15px !important;
    line-height: 1.6 !important;
}

.cm-entry-header-meta,
.cm-below-entry-meta,
.cm-post-categories a,
.cm-post-date time,
.cm-author a,
.cm-reading-time {
    font-size: 13px !important;
}

/* Typography matching live site aptlaw.vn for single post */
.single-post .cm-entry-title,
.single-post .cm-entry-title a {
    font-size: 34px !important;
    line-height: 1.3 !important;
}

.single-post .cm-entry-summary,
.single-post .cm-entry-summary p,
.single-post .cm-entry-summary li {
    font-size: 17px !important;
    line-height: 1.7 !important;
}

.single-post .cm-entry-summary h2 { font-size: 26px !important; }
.single-post .cm-entry-summary h3 { font-size: 22px !important; }
.single-post .cm-entry-summary h4 { font-size: 19px !important; }


/* Link Contrast Fixes for Single Post Content */
.single-post .cm-entry-summary a {
    color: #818cf8 !important; /* Bright Indigo for high contrast on dark background */
    text-decoration: underline !important;
    text-underline-offset: 3px;
}
.single-post .cm-entry-summary a:hover {
    color: #a5b4fc !important; /* Lighter on hover */
}

/* Image Captions Contrast */
.single-post .cm-entry-summary figcaption,
.single-post .cm-entry-summary .wp-caption-text,
.single-post .cm-entry-summary .has-text-align-center {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Blockquote and Blue Box Links */
.single-post .cm-entry-summary blockquote a, 
.single-post .cm-entry-summary .wp-block-quote a, 
.single-post .cm-entry-summary .has-background a {
    color: #ffffff !important;
    text-decoration: underline !important;
    font-weight: 500;
}

.single-post .cm-entry-summary blockquote a:hover, 
.single-post .cm-entry-summary .wp-block-quote a:hover, 
.single-post .cm-entry-summary .has-background a:hover {
    color: #f1f5f9 !important;
}

/* Override any inline text colors that are too dark in the content */
.single-post .cm-entry-summary p span[style*="color"],
.single-post .cm-entry-summary figcaption span[style*="color"],
.single-post .cm-entry-summary .has-text-align-center span[style*="color"] {
    color: inherit !important;
}



/* Explicitly force white links in captions and blockquotes to fix contrast */
.single-post .cm-entry-summary figcaption a,
.single-post .cm-entry-summary .wp-caption-text a {
    color: #ffffff !important;
    text-decoration: underline !important;
}

.single-post .cm-entry-summary blockquote a,
.single-post .cm-entry-summary .wp-block-quote a,
.single-post .cm-entry-summary .has-background a {
    color: #ffffff !important;
    text-decoration: underline !important;
}


/* Single Post Previous / Next Navigation Contrast */
ul.default-wp-page .previous a, 
ul.default-wp-page .next a {
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none !important;
}

ul.default-wp-page .previous a:hover, 
ul.default-wp-page .next a:hover {
    color: #818cf8 !important;
}

ul.default-wp-page .previous a svg,
ul.default-wp-page .next a svg {
    fill: currentColor !important;
}

/* Mobile Top Bar Fixes */
@media screen and (max-width: 768px) {
    .top-bar-left {
        display: none !important;
    }
    .top-bar-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Clean up language switcher for mobile */
@media screen and (max-width: 768px) {
    .lang-switcher .lang-btn {
        font-size: 0 !important; /* Hide text, keep only flag */
        padding: 5px;
    }
    .lang-switcher .lang-btn img {
        margin: 0 !important;
        width: 24px !important;
        height: auto !important;
    }
    .lang-switcher .lang-divider {
        display: none !important;
    }
}
