/**
 * Yikai CMS - 前台公共样式
 */

/* ============================================================
   交互元素鼠标样式
   ============================================================ */
/* Tailwind v4 Preflight 取消了 <button> 的 cursor:pointer，统一加回来 */
button:not(:disabled),
[role="button"]:not(:disabled),
summary,
label[for],
input[type="checkbox"]:not(:disabled),
input[type="radio"]:not(:disabled),
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
input[type="reset"]:not(:disabled),
input[type="file"]:not(:disabled)::file-selector-button {
    cursor: pointer;
}
button:disabled,
[role="button"][aria-disabled="true"] {
    cursor: not-allowed;
}

/* ============================================================
   Tailwind v4 Preflight 表单修复
   ============================================================ */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="color"]),
textarea,
select {
    background-color: #fff;
}

/* ============================================================
   版块标题装饰线
   ============================================================ */
.section-title-bar {
    display: block;
    width: 50px;
    height: 4px;
    background: var(--color-primary, #3B82F6);
    border-radius: 9999px;
    margin: 0.75rem auto 0;
}
.section-title-bar-light {
    background: rgba(255,255,255,0.5);
}

/* ============================================================
   文本截断
   ============================================================ */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   导航下拉菜单
   ============================================================ */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}
.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    right: 0;
    height: 0.5rem;
}
.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1.25rem;
    color: #4b5563;
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-dropdown-menu a:hover {
    background: #f3f4f6;
    color: var(--color-primary, #3B82F6);
}

/* ============================================================
   汉堡菜单动画
   ============================================================ */
.hamburger {
    width: 24px;
    height: 20px;
    position: relative;
    cursor: pointer;
}
.hamburger span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 2px;
    left: 0;
    transition: all 0.3s ease;
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 9px; }
.hamburger span:nth-child(3) { top: 18px; }
.hamburger.active span:nth-child(1) { top: 9px; transform: rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: translateX(-10px); }
.hamburger.active span:nth-child(3) { top: 9px; transform: rotate(-45deg); }

/* ============================================================
   富文本内容样式（.prose / .content-body）
   ============================================================ */
.prose img,
.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}
.prose p,
.content-body p {
    margin: 1em 0;
    line-height: 1.8;
}
.prose h2,
.content-body h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1.5em 0 0.5em;
}
.prose h3,
.content-body h3 {
    font-size: 1.25rem;
    font-weight: bold;
    margin: 1em 0 0.5em;
}
.prose h4,
.content-body h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 1em 0 0.5em;
}
.prose ul, .prose ol,
.content-body ul, .content-body ol {
    padding-left: 1.5em;
    margin: 1em 0;
}
.prose li,
.content-body li {
    margin: 0.5em 0;
}
.prose table,
.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}
.prose th, .prose td,
.content-body th, .content-body td {
    border: 1px solid #e5e7eb;
    padding: 0.5em 1em;
}
.prose th,
.content-body th {
    background: #f9fafb;
}
.prose blockquote,
.content-body blockquote {
    border-left: 4px solid var(--color-primary, #3B82F6);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6b7280;
    font-style: italic;
}

/* ============================================================
   图片灯箱
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.lightbox-overlay.active { display: flex; }
.lightbox-content { max-width: 90vw; max-height: 90vh; position: relative; }
.lightbox-content img { max-width: 100%; max-height: 90vh; object-fit: contain; }
.lightbox-close { position: absolute; top: -40px; right: 0; color: white; font-size: 2rem; cursor: pointer; }
.lightbox-title { position: absolute; bottom: -40px; left: 0; right: 0; text-align: center; color: white; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 3rem; cursor: pointer; padding: 1rem; }
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

/* ============================================================
   时间线（发展历程）
   ============================================================ */
.timeline-container { position: relative; }

@media (max-width: 767px) {
    .timeline-item::before {
        content: '';
        position: absolute;
        left: 20px; top: 0; bottom: 0;
        width: 2px;
        background: linear-gradient(to bottom, #e5e7eb, #d1d5db);
    }
    .timeline-item::after {
        content: '';
        position: absolute;
        left: 14px; top: 50%;
        transform: translateY(-50%);
        width: 14px; height: 14px;
        background: var(--color-primary);
        border-radius: 50%;
        border: 3px solid white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .timeline-item > div:last-child {
        margin-left: 50px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
.timeline-item .group:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}
.animate-float { animation: float 3s ease-in-out infinite; }

/* ============================================================
   Banner 轮播图（静态部分，动态高度在页面内联）
   ============================================================ */
.banner-swiper .swiper-slide { position: relative; }
.banner-swiper .swiper-slide > a { display: block; width: 100%; height: 100%; }
.banner-swiper .swiper-button-prev,
.banner-swiper .swiper-button-next { color: #fff; opacity: 0; transition: opacity 0.3s; }
.banner-swiper:hover .swiper-button-prev,
.banner-swiper:hover .swiper-button-next { opacity: 1; }
.banner-swiper .swiper-pagination-bullet { background: #fff; opacity: 0.5; width: 12px; height: 12px; }
.product-item { transition: opacity 0.3s ease; }

/* ============================================================
   多级导航子菜单（flyout，hover 右侧弹出）
   ============================================================ */
.nav-dropdown-menu .nav-sub-item { position: relative; }
/* flex 布局保证子菜单文本和右侧箭头始终同一行；EN/JA 文字较长时不再被挤换行 */
.nav-dropdown-menu .nav-sub-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0.5rem 1.25rem;
    color: #4b5563;
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-dropdown-menu .nav-sub-item > a:hover { background: #f3f4f6; color: var(--color-primary, #3B82F6); }
.nav-sub-arrow { color: #9ca3af; font-weight: bold; flex-shrink: 0; }
.nav-submenu {
    position: absolute;
    /* 二级菜单顶部对齐父项目顶部，不上移 —— 之前 top:-0.5rem 会把
       submenu 顶到一级下拉之上，视觉上很怪 */
    top: 0;
    left: 100%;
    min-width: 160px;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 0.5rem 0;
    margin-left: 0.5rem;
}
.nav-submenu a { display: block; padding: 0.5rem 1.25rem; color: #4b5563; white-space: nowrap; transition: all 0.2s; }
.nav-submenu a:hover { background: #f3f4f6; color: var(--color-primary, #3B82F6); }
.nav-sub-item:hover > .nav-submenu { opacity: 1; visibility: visible; margin-left: 0; }

/* ============================================================
   组织架构图 org-chart
   说明：样式放在常驻 style.css，使内容(富文本)即使被 TinyMCE 删掉内联
   <style> 也能正常显示。内容里只需 org-chart / org-node 等结构 class。
   ============================================================ */
.org-chart { text-align: center; overflow-x: auto; padding: 10px 0; }
.org-chart ul { padding-top: 20px; position: relative; display: flex; justify-content: center; list-style: none; margin: 0; padding-left: 0; }
.org-chart ul::before { content: ""; position: absolute; top: 0; left: 50%; width: 0; height: 20px; border-left: 2px solid #cbd5e1; }
.org-chart li { position: relative; padding: 20px 5px 0; display: flex; flex-direction: column; align-items: center; }
.org-chart li::before, .org-chart li::after { content: ""; position: absolute; top: 0; width: 50%; height: 20px; border-top: 2px solid #cbd5e1; }
.org-chart li::before { left: 0; border-left: 2px solid #cbd5e1; }
.org-chart li::after { right: 0; border-right: 2px solid #cbd5e1; }
.org-chart li:first-child::before { display: none; }
.org-chart li:last-child::after { display: none; }
.org-chart li:only-child::before, .org-chart li:only-child::after { display: none; }
.org-chart li:first-child::after { border-radius: 5px 0 0 0; }
.org-chart li:last-child::before { border-radius: 0 5px 0 0; }
.org-chart .org-node { display: inline-block; padding: 10px 20px; border-radius: 8px; text-align: center; min-width: 120px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.org-chart .org-ceo { background: linear-gradient(135deg, #1e40af, #3b82f6); color: #fff; font-size: 16px; font-weight: 700; padding: 14px 28px; }
.org-chart .org-vp { background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; font-weight: 600; }
.org-chart .org-dept { background: #f1f5f9; border: 1px solid #e2e8f0; color: #334155; font-size: 14px; }
.org-chart .org-title { display: block; font-size: 11px; opacity: 0.85; margin-top: 2px; font-weight: 400; }

/* 预置配色：在 .org-chart 上加 org-style-* 修饰类即可切换（默认无修饰类=蓝色） */
/* 青绿 */
.org-chart.org-style-teal .org-ceo { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.org-chart.org-style-teal .org-vp { background: linear-gradient(135deg, #0e7490, #06b6d4); }
/* 深色商务 */
.org-chart.org-style-dark .org-ceo { background: linear-gradient(135deg, #0f172a, #334155); }
.org-chart.org-style-dark .org-vp { background: linear-gradient(135deg, #334155, #475569); }
.org-chart.org-style-dark .org-dept { background: #1e293b; color: #e2e8f0; border-color: #334155; }
/* 紫色 */
.org-chart.org-style-purple .org-ceo { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.org-chart.org-style-purple .org-vp { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
/* 橙暖 */
.org-chart.org-style-amber .org-ceo { background: linear-gradient(135deg, #b45309, #f59e0b); }
.org-chart.org-style-amber .org-vp { background: linear-gradient(135deg, #c2410c, #fb923c); }
/* 简约灰（扁平、无渐变阴影） */
.org-chart.org-style-minimal .org-ceo { background: #334155; }
.org-chart.org-style-minimal .org-vp { background: #64748b; }
.org-chart.org-style-minimal .org-dept { background: #fff; }
.org-chart.org-style-minimal .org-node { box-shadow: none; }
