/* ==========================================================
   base.css – Luda Instruments 公共样式
   所有页面共享的样式 (Reset, 导航, 底部, 搜索模态框等)
   各页面独有样式请放在对应的 CSS 文件中
   ========================================================== */

/* ---------- 重置与基础 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #f8fafc;
    color: #1e2b37;
    line-height: 1.6;
}

/* ---------- 容器 ---------- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px;
}

/* ---------- 头部导航 ---------- */
header {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,20,40,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 50px;
    width: auto;
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #d71920;
    margin: 0;
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.9rem;
    color: #4a6f8e;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-links a,
.dropbtn {
    text-decoration: none;
    font-weight: 500;
    color: #1e3a5f;
    font-size: 1.1rem;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
    cursor: pointer;
}

.nav-links a:hover,
.nav-links a.active,
.dropbtn:hover,
.dropbtn.active {
    border-bottom-color: #d71920;
    color: #d71920;
}

/* ---------- 下拉菜单 (产品分类) ---------- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    background-color: white;
    min-width: 220px;
    width: 250px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 10;
}

.dropdown-category {
    position: relative;
    padding: 0;
}

.dropdown-category-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    color: #1e3a5f;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
    word-break: break-word;
    line-height: 1.3;
}

.dropdown-category-title:hover {
    background-color: #f5f5f5;
    color: #d71920;
}

.dropdown-arrow {
    font-size: 1.1rem;
    color: #8ca3b9;
    margin-left: 12px;
    transition: color 0.2s;
}

.dropdown-category-title:hover .dropdown-arrow {
    color: #d71920;
}

.dropdown-sub-panel {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: white;
    min-width: 240px;
    width: 280px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 12px 0;
    z-index: 10;
}

.dropdown-sub-header {
    padding: 6px 20px 10px;
    color: #0a2647;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eaeef5;
    margin-bottom: 4px;
}

.dropdown-sub-link {
    display: block;
    padding: 8px 20px;
    color: #4a6f8e;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.dropdown-sub-link:hover {
    background-color: #f0f4f8;
    color: #d71920;
}

/* 桌面端：hover 交互 */
@media (hover: hover) {
    .dropdown-category:hover .dropdown-sub-panel {
        display: block;
    }
    .dropdown:hover .dropdown-content {
        display: block;
    }
}

/* 触摸端：通过 JS 切换子面板 */
@media (hover: none) {
    .dropdown-sub-panel.visible {
        display: block;
    }
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 40px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background-color: #d71920;
    color: white;
}

.btn-primary:hover {
    background-color: #b0141a;
}

.btn-outline {
    background: transparent;
    border-color: #d71920;
    color: #d71920;
}

.btn-outline:hover {
    background: #d71920;
    color: white;
}

.btn-secondary {
    background: white;
    color: #1e2b37;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: transparent;
    color: white;
    border-color: white;
}

/* ---------- 通用标题 ---------- */
.section-title {
    font-size: 2.4rem;
    font-weight: 600;
    color: #0a2647;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: #4a6f8e;
    max-width: 800px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
}

.divider {
    width: 100px;
    height: 4px;
    background-color: #d71920;
    margin: 20px 0;
}

/* ---------- 标准标签 ---------- */
.product-standards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.standard-badge {
    background: #ededed;
    color: #1f4973;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

.standard-badge.remaining {
    background: transparent;
    color: #1f4973;
}

/* ---------- 右侧悬浮栏 ---------- */
.floating-bar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.floating-item {
    width: 50px;
    height: 50px;
    background-color: #d71920;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s;
}

.floating-item:hover {
    background-color: #b0141a;
    transform: scale(1.1);
}

/* ---------- 语言切换器 ---------- */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1e3a5f;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
    font-family: inherit;
}

.lang-btn:hover {
    border-bottom-color: #d71920;
    color: #d71920;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 120px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 10;
}

.lang-switcher:hover .lang-dropdown {
    display: block;
}

.lang-dropdown a {
    display: block;
    padding: 8px 20px;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.lang-dropdown a:hover {
    background-color: #f5f5f5;
    color: #d71920;
}

/* RTL 调整 */
html[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

/* ---------- 搜索模态框 ---------- */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.search-modal-container {
    width: 90%;
    max-width: 700px;
    margin: 0 auto;
}

.search-modal-box {
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f8fafc;
    border-bottom: 1px solid #eaeef5;
}

.search-modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0a2647;
    margin: 0;
}

.search-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #8ca3b9;
    transition: color 0.2s;
    line-height: 1;
}

.search-modal-close:hover {
    color: #d71920;
}

.search-modal-body {
    padding: 30px 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.search-modal-body input {
    flex: 2;
    min-width: 200px;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 1px solid #d0ddee;
    border-radius: 60px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.search-modal-body input:focus {
    border-color: #d71920;
    box-shadow: 0 0 0 3px rgba(215,25,32,0.1);
}

.search-modal-body button {
    flex-shrink: 0;
    background: #d71920;
    color: white;
    border: none;
    padding: 0 28px;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-modal-body button:hover {
    background: #b0141a;
}

.search-modal-footer {
    padding: 15px 25px;
    background: #f8fafc;
    border-top: 1px solid #eaeef5;
    text-align: center;
    color: #6d8ba0;
    font-size: 0.85rem;
}

.search-lang-select {
    padding: 14px 12px;
    border: 1px solid #d0ddee;
    border-radius: 60px;
    background: white;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.search-lang-select:focus {
    border-color: #d71920;
}

/* ---------- 底部 ---------- */
footer {
    background: #0a1a2b;
    color: #aac3d4;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-brand {
    font-size: 1.2rem;
    white-space: nowrap;
    color: #aac3d4;
}

.footer-brand strong {
    color: white;
}

.footer-contacts {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.contact-person {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.person-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
    margin-bottom: 4px;
}

.contact-phone,
.contact-email {
    color: #aac3d4;
    text-decoration: none;
    transition: color 0.2s;
}

.contact-phone:hover,
.contact-email:hover {
    color: white;
}

.footer-copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #1f3a4e;
    font-size: 0.9rem;
    color: #6d8ba0;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
    color: #6d8ba0;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.breadcrumb a {
    color: #1e3a5f;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ---------- 加载 & 无结果状态 ---------- */
.loading {
    text-align: center;
    padding: 60px;
    font-size: 1.2rem;
    color: #4f6f8f;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }
}

@media (max-width: 900px) {
    .dropdown-content {
        width: 220px;
    }
    .dropdown-sub-panel {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 8px 20px;
    }
    .dropdown-sub-header {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .container {
        padding: 0 30px;
    }
    .lang-switcher {
        margin-left: 0;
    }
    .lang-dropdown {
        right: auto;
        left: 0;
    }
    .footer-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-contacts {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    .contact-person {
        align-items: center;
    }
}

@media (max-width: 640px) {
    .search-modal-body {
        flex-direction: column;
        align-items: stretch;
    }
    .search-modal-body button {
        padding: 12px;
        justify-content: center;
    }
    .search-lang-select {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .dropdown-content {
        width: 200px;
        min-width: 180px;
    }
    .dropdown-sub-panel {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 6px 16px;
    }
    .dropdown-sub-header {
        display: none;
    }
}

/* RTL: 子面板显示在左侧 */
html[dir="rtl"] .dropdown-sub-panel {
    left: auto;
    right: 100%;
}

html[dir="rtl"] .dropdown-arrow {
    margin-left: 0;
    margin-right: 12px;
}

@media (max-width: 480px) {
    .container {
        padding: 0 20px;
    }
}
