/* Google Fonts Inter được enqueue qua functions.php (wp_enqueue_style) */

:root {
    --clr-primary: #14397B;
    --clr-primary-hover: #0D2652;
    --clr-accent: #00A6FF; /* Omoda Jaecoo Electric Blue */
    --clr-silver: #E2E8F0; /* Metallic Silver Light */
    --clr-silver-dark: #94A3B8; /* Metallic Silver Dark */
    --clr-dark: #222222;
    --clr-dark-bg: #1A1D24;
    --clr-text-main: #333333;
    --clr-text-muted: #777777;
    --clr-border: #E5E5E5;
    --clr-surface: #FFFFFF;
    --clr-bg-light: #F8F9FA;

    /* —— Brand Colors 2 dòng xe —— */
    --clr-hotline:       #d71921;   /* Đỏ đậm — OMODA brand   */
    --clr-hotline-hover: #c42800;
    --grad-hotline:      linear-gradient(135deg, #ff6b6b, #d71921);
    --grad-hotline-hover:linear-gradient(135deg, #ff4757, #c42800);
    --clr-hotline-glow:  rgba(215, 25, 33, 0.35);

    --clr-zalo:          #2563eb;   /* Xanh dương — JAECOO / Zalo */
    --clr-zalo-hover:    #1d4ed8;
    --grad-zalo:         linear-gradient(135deg, #60a5fa, #2563eb);
    --grad-zalo-hover:   linear-gradient(135deg, #3b82f6, #1d4ed8);
    --clr-zalo-glow:     rgba(37, 99, 235, 0.35);

    --font-primary: 'Inter', sans-serif;
    --wrap-max: 1400px;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-pill: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--clr-text-main);
    background: var(--clr-surface);
    line-height: 1.5;
}

/* SMART IMAGE HANDLING - Anti-Crop Philosophy */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain; /* Đảm bảo không bao giờ bị cắt mất nội dung */
    display: block;
}
/* Ngoại lệ: logo header không bị reset height */
.logo img {
    height: 60px;
    width: auto;
    max-width: 260px;
    max-height: none;
    object-fit: contain;
}

a { color: var(--clr-text-main); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--clr-primary); }
ul { list-style: none; }

/* LAYOUT TOKENS */
.container {
    width: 100%;
    max-width: var(--wrap-max);
    margin: 0 auto;
    padding: 0 15px;
}
.section-padding { padding: 40px 0; }
.bg-light { background: var(--clr-bg-light); }

/* GLOBAL UI PILLS */
.btn-red {
    background: var(--clr-primary);
    color: #fff;
    padding: 12px 24px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: var(--radius-md);
    font-size: 13px;
    border: none; cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(20, 57, 123, 0.2);
}
.btn-red i { margin-right: 8px; }
.btn-red:hover { 
    background: var(--clr-primary-hover); 
    color: #fff; 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 57, 123, 0.3);
}

/* —— Nút Hotline (dò cam OMODA) —— */
.btn-hotline {
    background: var(--grad-hotline) !important;
    color: #fff !important;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px var(--clr-hotline-glow);
}
.btn-hotline:hover {
    background: var(--grad-hotline-hover) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--clr-hotline-glow);
}

/* —— Nút Zalo (xanh dương JAECOO) —— */
.btn-zalo {
    background: var(--grad-zalo) !important;
    color: #fff !important;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px var(--clr-zalo-glow);
}
.btn-zalo:hover {
    background: var(--grad-zalo-hover) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--clr-zalo-glow);
}
.btn-zalo img, .btn-hotline img { flex-shrink: 0; }

/* —— Class tiện lợi cho button CTA đôi (Hotline + Zalo nằm cạnh nhau) —— */
.cta-dual-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* —— CTA Big Buttons (dùng trong trang bảng giá, single-car...) —— */
.btn-cta-big {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
}
.btn-cta-call {
    background: var(--grad-hotline) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px var(--clr-hotline-glow);
}
.btn-cta-call:hover {
    background: var(--grad-hotline-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--clr-hotline-glow);
}
.btn-cta-zalo {
    background: var(--grad-zalo) !important;
    color: #fff !important;
    box-shadow: 0 4px 15px var(--clr-zalo-glow);
}
.btn-cta-zalo:hover {
    background: var(--grad-zalo-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--clr-zalo-glow);
}

.section-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}
.section-title-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, var(--clr-border) 0%, var(--clr-primary) 50%, var(--clr-border) 100%);
    z-index: 1;
}
.section-title {
    font-size: 24px;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    padding-bottom: 12px;
    position: relative;
    z-index: 2;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
    border-radius: 3px;
}

.product-tabs { display: flex; gap: 10px; flex-wrap: wrap; z-index: 2; position: relative;}
.product-tabs a {
    font-size: 14px; font-weight: 600; text-transform: uppercase;
    padding: 10px 15px; border-radius: 0; background: transparent; color: var(--clr-text-main);
    transition: all 0.3s ease; border: none; position: relative;
}
.product-tabs a:hover { color: var(--clr-primary); }
.product-tabs a.active { background: transparent; color: var(--clr-primary); box-shadow: none; font-weight: 700; }
.product-tabs a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00c6ff 0%, #0072ff 33%, #9d50bb 66%, #ed213a 100%);
    border-radius: 3px;
}

.car-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols-ds, 4), minmax(0, 1fr));
    gap: 20px;
}
.three-cols { 
    display: flex; 
    flex-wrap: wrap;
    gap: 30px; 
}
.three-cols > div {
    flex: 1;
    min-width: 300px;
}
.split-wrap { display: flex; gap: 30px; margin-top: 20px; }
.split-left { flex: 1; }
.split-right { flex: 1; }

.split-60-40 > .split-left { flex: 0 0 60%; }
.split-65-35 > .split-left { flex: 0 0 65%; }
.split-75-25 > .split-left { flex: 0 0 75%; }
.split-60-40 > .split-right, .split-65-35 > .split-right, .split-75-25 > .split-right { flex: 1; }

@media (max-width: 991px) {
    .car-grid { grid-template-columns: repeat(var(--cols-tb, 2), minmax(0, 1fr)); }
    .three-cols { grid-template-columns: 1fr; }
    .split-wrap { flex-direction: column; }
    .main-nav { display: none; }
}
@media (max-width: 575px) {
    .car-grid { grid-template-columns: repeat(var(--cols-mb, 1), minmax(0, 1fr)); }
}
.main-nav ul { display: flex; gap: 25px; }
.main-nav ul li a { font-weight: 700; font-size: 13px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; transition: color 0.3s; }
.main-nav ul li a i { color: var(--clr-primary); font-size: 14px; transition: color 0.3s; }
.main-nav ul li a:hover { color: var(--clr-accent); }
.main-nav ul li a:hover i { color: var(--clr-accent); }

/* TOP BAR STYLING */
.top-bar {
    background: #ffffff;
    color: var(--clr-dark);
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--clr-border);
}
.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar-left span { margin-right: 15px; }
.top-bar-right a { margin-left: 10px; color: var(--clr-dark); transition: color 0.3s; }
.top-bar-right a:hover { color: var(--clr-accent); }

/* MAIN HEADER */
.site-header {
    background: #ffffff;
}

/* HOME GRID SLIDERS - overflow clipping quan trọng */
.news-swiper, .delivery-swiper { padding-bottom: 35px; overflow: hidden; min-height: 0 !important; }
.testimonials-swiper { padding: 10px 10px 40px 10px; min-height: 0 !important; overflow: hidden; }
.news-swiper .swiper-pagination, .delivery-swiper .swiper-pagination { bottom: 0; }
.testimonials-swiper .swiper-pagination { bottom: 5px; }
.delivery-swiper .swiper-wrapper, .testimonials-swiper .swiper-wrapper { height: auto !important; min-height: 0 !important; }
.delivery-swiper .swiper-slide, .testimonials-swiper .swiper-slide { height: auto !important; min-height: 0 !important; }
/* Ảnh thumbnail TIN TỨC không được vượt kích thước */
.news-item-mini img {
    width: 100px;
    height: 70px;
    max-width: 100px;
    object-fit: contain !important;
    background: #f0f0f0;
    border-radius: 4px;
    flex-shrink: 0;
}

.swiper-pagination-bullet {
    width: 20px;
    height: 4px;
    border-radius: 2px;
    background: #ccc;
    opacity: 0.6;
    transition: all 0.3s ease;
}
.swiper-pagination-bullet-active {
    width: 40px;
    opacity: 1;
    background: var(--clr-primary) !important;
}

.delivery-slide-item a { color: var(--clr-dark); display: block; transition: 0.2s; }
.delivery-slide-item a:hover { color: var(--clr-primary); }
.delivery-slide-item .img-wrap {
    overflow: hidden;
    border-radius: 4px;
    width: 100%;
    line-height: 0;
    aspect-ratio: 16/9;
    margin-bottom: 12px;
}
.delivery-slide-item img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain !important; /* Đảm bảo hiển thị trọn vẹn tấm hình, không bị cắt */
    background: #f0f0f0; /* Thêm nền nhẹ để lấp đầy khoảng trống nếu ảnh không đúng tỷ lệ */
    display: block;
    transition: transform 0.3s ease;
}
.delivery-slide-item:hover img { transform: scale(1.05); }

@keyframes ripple {
    to { transform: scale(30); opacity: 0; }
}

/* BRAND STYLING - OMODA & JAECOO */
.brand-omoda  { color: #C0392B; font-weight: 700; }          /* Đỏ OMODA  */
.brand-jaecoo { color: #14397B; font-weight: 700; }          /* Xanh JAECOO */
.brand-hybrid { color: #27AE60; font-weight: 700; }          /* Xanh Hybrid */
.brand-red    { color: var(--clr-primary); font-weight: 700; } /* Legacy fallback */

/* Phần bên trái ảnh tin tức - không co giãn */
.news-item-mini a { flex-shrink: 0; overflow: hidden; display: block; border-radius: 4px; }

.premium-card { border-radius: 40px 0 40px 0 !important; overflow: hidden; transition: 0.3s; }

/* FORM VALIDATION & STATUS */
.input-status-wrapper { position: relative; width: 100%; display: block; }
.field-status-icon { 
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%); 
    font-size: 14px; transition: 0.3s; opacity: 0; pointer-events: none; z-index: 5;
}
.field-status-icon.is-error { opacity: 1 !important; color: #dc3545; }
.field-status-icon.is-success { opacity: 1 !important; color: #28a745; }

.dieptv-form .form-group { position: relative; margin-bottom: 20px; }
.dieptv-form .field-error-msg { 
    font-size: 11px; color: #dc3545; margin-top: 5px; font-weight: 600; 
    display: none; align-items: center; gap: 5px; 
}

.dieptv-form input.is-invalid, 
.dieptv-form select.is-invalid {
    border-color: #dc3545 !important;
    background-color: #fff8f8 !important;
}

.dieptv-form .premium-input, 
.dieptv-form .form-control {
    width: 100%;
    transition: 0.3s;
    border: 1px solid #ddd;
    padding-right: 35px !important; /* Reserve space for icon */
}
.dieptv-form .premium-input:focus, 
.dieptv-form .form-control:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(0,52,120,0.1);
    outline: none;
}

@media (max-width: 768px) {
    .dieptv-form .form-control,
    .dieptv-form .premium-input {
        font-size: 12.5px !important;
        height: auto !important;
        padding: 8px 6px !important;
    }
    .dieptv-form select.form-control {
        padding-right: 18px !important;
    }
    .dieptv-form label {
        font-size: 9.5px !important;
        margin-bottom: 4px !important;
        letter-spacing: 0.2px !important;
    }
}

/* SMART IMAGE HANDLING - Global Anti-Crop Rules for Articles & Widgets */
.entry-content img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Related articles and delivered vehicle widgets thumbnails */
.wp-post-image,
.attachment-thumbnail {
    object-fit: contain !important;
}

/* MOBILE RESPONSIVE: 2 Columns Per Row for Related Cars Segment */
@media (max-width: 768px) {
    .related-car-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 5px;
    }
    
    .related-car-grid .car-card {
        padding: 8px !important;
    }
    
    .related-car-grid .car-title {
        font-size: 13px !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }
    
    .related-car-grid .car-specs-bar {
        display: none !important; /* Hide spec bar to prevent clutter on small screens */
    }
    
    .related-car-grid .car-badge {
        top: 8px !important;
        left: 8px !important;
        font-size: 8px !important;
        padding: 2px 6px !important;
    }
    
    .related-car-grid .car-versions {
        margin-bottom: 8px !important;
        padding-top: 8px !important;
        gap: 4px !important;
    }
    
    .related-car-grid .version-row {
        font-size: 10px !important;
    }
    
    .related-car-grid .v-price {
        font-size: 10px !important;
    }

    .related-car-grid .car-actions {
        flex-direction: column !important; /* Stack action buttons vertically */
        gap: 6px !important;
        padding-top: 8px !important;
    }
    
    .related-car-grid .btn-card-primary,
    .related-car-grid .btn-card-outline {
        width: 100% !important;
        padding: 8px 4px !important;
        font-size: 9.5px !important;
        height: auto !important;
        line-height: 1.2 !important;
    }
    
    .related-car-grid .btn-card-hotline {
        display: none !important; /* Hide extra phone icon as agent hotline is prominently displayed above */
    }
}

/* MOBILE RESPONSIVE: Agent info header layout (Avatar on the right, Quote on the left, same row) */
@media (max-width: 768px) {
    .agent-info-header {
        flex-direction: row-reverse !important;
        gap: 15px !important;
        align-items: flex-start !important;
    }
    
    .agent-info-header > div:first-child {
        flex-shrink: 0 !important;
    }
    
    .agent-info-header img {
        width: 90px !important;
        height: 90px !important;
        border-width: 3px !important;
    }
    
    .agent-info-header div[title="Đang trực tuyến"] {
        width: 16px !important;
        height: 16px !important;
        bottom: 5px !important;
        right: 5px !important;
        border-width: 2px !important;
    }
    
    .agent-info-header h2 {
        font-size: 20px !important;
    }
    
    .agent-info-header div:last-child > div:nth-child(2) {
        font-size: 11px !important;
    }
    
    .agent-info-header p {
        font-size: 12px !important;
        line-height: 1.4 !important;
        margin-top: 8px !important;
    }
}

/* MOBILE RESPONSIVE: Section Title and Wrap styling (Fluid adjustment to prevent overflow & wrapping) */
@media (max-width: 768px) {
    .section-title-wrap {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        border-bottom: none !important;
        margin-bottom: 20px !important;
    }
    
    .section-title {
        font-size: 18px !important; /* Scale down title safely on mobile */
        width: 100% !important;
        border-bottom: 3px solid var(--clr-primary) !important;
        padding-bottom: 8px !important;
        line-height: 1.3 !important;
    }
    
    .section-subtitle {
        font-size: 11px !important;
        margin-top: 4px !important;
    }
    
    .view-all {
        font-size: 11.5px !important;
        margin-top: 2px !important;
    }
}

/* MOBILE RESPONSIVE: Loan Calculator Year Selector Padding adjustment */
@media (max-width: 768px) {
    .loan-calc-widget .year-selector {
        padding: 5px !important;
        font-size: 11px !important; /* Slightly scale font to fit nicely on mobile screens */
        text-align: center !important;
    }
}

/* MOBILE FIRST: Display the Loan Calculator first and Quote Form second on mobile screens */
@media (max-width: 991px) {
    .loan-quote-wrap {
        flex-direction: column-reverse !important;
    }
}

/* MOBILE RESPONSIVE: Stacking loan inputs vertically to make range slider larger & easier to touch */
@media (max-width: 768px) {
    .loan-flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .loan-flex-row > div:last-child {
        width: 100% !important;
    }
    
    .loan-flex-row label {
        display: none !important;
    }
    
    /* Force 2 fields per row on mobile with small gap */
    .quote-form-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px 8px !important;
    }
    
    /* Styling placeholders and paddings to fit and look highly aesthetic on mobile */
    .dieptv-form .form-control::placeholder {
        font-size: 11.5px !important;
        opacity: 0.65 !important;
    }
    
    .quote-form-widget {
        padding: 15px !important;
    }

    #home-calc-loan-amount {
        background: rgba(255, 255, 255, 0.05) !important;
        color: #00A6FF !important;
        border-color: #00A6FF !important;
        text-align: center !important;
        font-size: 15px !important;
        font-weight: 800 !important;
    }
}

/* Make all container on homepage 86% width on Desktop only */
@media (min-width: 992px) {
    body.home {
        --wrap-max: 86%;
    }
}
