/* =====================================================
   KIM PHÚ — BRAND IDENTITY
   Primary: #D90000 (đỏ)  Accent: #FFD700 (vàng)
   ===================================================== */

:root {
    --kp-red:         #D90000;
    --kp-red-dark:    #aa0000;
    --kp-red-light:   #ff2222;
    --kp-yellow:      #FFD700;
    --kp-yellow-dark: #e6c000;
    --kp-dark:        #1a1a1a;
    --kp-gray:        #f4f4f4;

    /* Override Bootstrap primary → KP red */
    --bs-primary:           #D90000;
    --bs-primary-rgb:       217, 0, 0;
    --bs-link-color:        #D90000;
    --bs-link-hover-color:  #aa0000;
    --bs-btn-bg:            #D90000;
}

html, body {
    font-family: 'Be Vietnam Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #fafafa;
    /* Tối ưu rendering tiếng Việt */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-size: 15px;
    line-height: 1.65;
}

a { color: var(--kp-red); }
a:hover { color: var(--kp-red-dark); }

/* =====================================================
   TYPOGRAPHY — tiếng Việt
   ===================================================== */

/* Heading dùng weight nặng hơn để rõ nét với dấu thanh */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Be Vietnam Pro', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    /* Tăng line-height cho heading tiếng Việt (dấu trên/dưới cần không gian) */
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* Đảm bảo fw-black / font-weight: 900 render đúng */
.fw-black { font-weight: 900 !important; }

/* Paragraph & body */
p, li, td, th, label, input, textarea, select, button {
    font-family: 'Be Vietnam Pro', 'Helvetica Neue', Arial, sans-serif;
}

/* Tối ưu khoảng cách đọc cho đoạn văn dài */
p { line-height: 1.75; }

/* Lead text */
.lead { line-height: 1.7; font-weight: 400; }

/* Số lớn (stat, badge) */
.kp-stat-item .number {
    /* Inter fallback cho số — Be Vietnam Pro đã đẹp */
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   BOOTSTRAP OVERRIDES
   ===================================================== */

.btn-primary {
    background-color: var(--kp-red);
    border-color: var(--kp-red);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--kp-red-dark);
    border-color: var(--kp-red-dark);
    color: #fff;
}
.btn-outline-primary {
    color: var(--kp-red);
    border-color: var(--kp-red);
}
.btn-outline-primary:hover {
    background-color: var(--kp-red);
    border-color: var(--kp-red);
    color: #fff;
}
.text-primary  { color: var(--kp-red) !important; }
.bg-primary    { background-color: var(--kp-red) !important; }
.border-primary{ border-color: var(--kp-red) !important; }

/* Badge */
.badge.bg-primary { background-color: var(--kp-red) !important; }

/* =====================================================
   HEADER / NAVBAR
   ===================================================== */

.site-header {
    background: #fff;
    border-bottom: 3px solid var(--kp-red);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.brand-mark {
    display: inline-flex;
    width: 44px;
    height: 44px;
    background: var(--kp-red);
    color: var(--kp-yellow);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(217,0,0,.4);
}

/* Logo ảnh (khi admin đã upload) */
.site-logo {
    max-height: 48px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.site-logo-footer {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.site-header .nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color .15s;
}
.site-header .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--kp-red);
    transition: width .2s ease;
}
.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--kp-red);
}
.site-header .nav-link:hover::after,
.site-header .nav-link.active::after {
    width: 100%;
}

/* Mobile menu */
.site-header .navbar-collapse.show {
    border-top: 1px solid #f0f0f0;
    padding-top: .5rem;
    animation: fadeSlideDown .15s ease;
}

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

/* =====================================================
   HERO SECTION
   ===================================================== */

.kp-hero {
    background: linear-gradient(135deg, var(--kp-red) 0%, #8b0000 60%, #1a1a1a 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 520px;
    display: flex;
    align-items: center;
}

.kp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 80% at 70% 50%, rgba(255,215,0,.08) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.kp-hero-badge {
    display: inline-block;
    background: var(--kp-yellow);
    color: var(--kp-dark);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .3rem .8rem;
    border-radius: 2px;
    margin-bottom: 1rem;
}

.kp-hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    text-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.kp-hero h1 span.accent {
    color: var(--kp-yellow);
}

.kp-hero .lead {
    font-size: 1.15rem;
    opacity: .9;
    max-width: 500px;
}

.kp-hero-visual {
    position: relative;
}

/* =====================================================
   STATS STRIP
   ===================================================== */

.kp-stats {
    background: var(--kp-dark);
    color: #fff;
    padding: 2.5rem 0;
}

.kp-stat-item .number {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--kp-yellow);
    line-height: 1;
    display: block;
}

.kp-stat-item .label {
    font-size: .85rem;
    opacity: .75;
    margin-top: .25rem;
}

.kp-stat-divider {
    width: 1px;
    background: rgba(255,255,255,.15);
    align-self: stretch;
}

/* =====================================================
   SECTION TITLES
   ===================================================== */

.kp-section-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--kp-red);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: .5rem;
}
.kp-section-label::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 3px;
    background: var(--kp-red);
    border-radius: 2px;
}

.kp-section-title {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--kp-dark);
    line-height: 1.2;
}

/* =====================================================
   PRODUCT CARDS
   ===================================================== */

.site-main { min-height: 60vh; }

.product-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.12) !important;
}

/* =====================================================
   INDUSTRY CARDS
   ===================================================== */

.kp-industry-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all .2s ease;
    cursor: default;
}
.kp-industry-card:hover {
    border-color: var(--kp-red);
    box-shadow: 0 4px 20px rgba(217,0,0,.1);
    transform: translateY(-3px);
}
.kp-industry-card .icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

/* =====================================================
   PROCESS / HOW IT WORKS
   ===================================================== */

.kp-process-step {
    position: relative;
}
.kp-step-number {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--kp-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(217,0,0,.35);
    position: relative;
    z-index: 1;
}
.kp-process-connector {
    position: absolute;
    top: 28px;
    left: calc(50% + 28px);
    right: calc(-50% + 28px);
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--kp-red) 0,
        var(--kp-red) 8px,
        transparent 8px,
        transparent 16px
    );
}

/* =====================================================
   CTA SECTION
   ===================================================== */

.kp-cta {
    background: linear-gradient(135deg, var(--kp-red) 0%, var(--kp-red-dark) 100%);
    position: relative;
    overflow: hidden;
}
.kp-cta::before {
    content: 'KP';
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18rem;
    font-weight: 900;
    color: rgba(255,255,255,.04);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.btn-kp-yellow {
    background: var(--kp-yellow);
    color: var(--kp-dark);
    border: none;
    font-weight: 700;
    transition: all .15s ease;
}
.btn-kp-yellow:hover {
    background: var(--kp-yellow-dark);
    color: var(--kp-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,215,0,.4);
}

/* =====================================================
   BLOG CARDS
   ===================================================== */

.blog-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.12) !important;
}

/* =====================================================
   CMS CONTENT
   ===================================================== */

.cms-content, .blog-content {
    line-height: 1.8;
    font-size: 1rem;
    color: #333;
}
.cms-content h1,.blog-content h1,
.cms-content h2,.blog-content h2,
.cms-content h3,.blog-content h3 {
    margin-top: 1.5rem;
    margin-bottom: .75rem;
    font-weight: 700;
}
.cms-content img,.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: .5rem 0;
}
.cms-content blockquote,.blog-content blockquote {
    border-left: 4px solid var(--kp-red);
    padding-left: 1rem;
    color: #555;
    margin: 1rem 0;
}
.cms-content table,.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.cms-content th,.blog-content th,
.cms-content td,.blog-content td {
    border: 1px solid #dee2e6;
    padding: .5rem .75rem;
}
.cms-content th,.blog-content th {
    background: #f8f9fa;
    font-weight: 600;
}

/* =====================================================
   FOOTER
   ===================================================== */

.site-footer .brand-mark {
    background: rgba(255,215,0,.15);
    color: var(--kp-yellow);
}

/* =====================================================
   MISC
   ===================================================== */

.letter-spacing { letter-spacing: .08em; }

/* =====================================================
   BLAZOR ERROR UI
   Phải ẩn mặc định — Blazor JS sẽ bật lên khi có lỗi circuit thật sự.
   ===================================================== */
#blazor-error-ui {
    display: none;
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    bottom: 0;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: .875rem;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
    text-decoration: none;
    color: inherit;
}

/* Quill editor */
.quill-wrapper .ql-container { font-size: 1rem; }
.quill-wrapper .ql-editor { min-height: 250px; }

.blazor-error-boundary { background: #b32121; color: white; padding: 1rem; }
.blazor-error-boundary::after { content: "Đã xảy ra lỗi." }
