/* ===================================
   Font Awesome Font Display Fix
   Prevent FOIT (Flash of Invisible Text)
   Override Font Awesome's default font-display:block with swap
   =================================== */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 400;
    font-display: swap !important;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-regular-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 900;
    font-display: swap !important;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff2') format('woff2');
}
@font-face {
    font-family: 'Font Awesome 6 Brands';
    font-style: normal;
    font-weight: 400;
    font-display: swap !important;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-brands-400.woff2') format('woff2');
}

/* ===================================
   Global Styles & Reset
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0A2463;
    --secondary-color: #D4AF37;
    --dark-blue: #061845;
    --light-blue: #1E3A8A;
    --white: #FFFFFF;
    --light-gray: #F8FAFC;
    --gray: #E2E8F0;
    --dark-gray: #64748B;
    --text-dark: #1E293B;
    --text-light: #64748B;
    
    /* African/Middle Eastern geometric pattern colors */
    --pattern-ochre: #C17817;
    --pattern-terracotta: #E27D60;
    --pattern-sand: #F4E4C1;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

.text-center {
    text-align: center;
}

/* ===================================
   Page Header (Universal)
   =================================== */
.page-header {
    margin-top: 70px;
    padding: 60px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--light-blue) 100%);
    text-align: center;
}

.page-header h1 {
    color: var(--white);
    margin-bottom: 1rem;
}

.page-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    margin: 0;
}

/* ===================================
   Section Common Styles (Universal)
   =================================== */
.section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
}

.section-title p {
    color: var(--text-light);
    font-size: 1.125rem;
    margin-top: 1.5rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-light);
}

/* ===================================
   Form Styles (Universal)
   =================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary-color);
}

.form-control select,
.form-control textarea {
    resize: vertical;
    min-height: 120px;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--dark-blue);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 36, 99, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: #B8941F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* ===================================
   Header & Navigation
   =================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    height: 70px;
    line-height: 70px;
    transition: box-shadow 0.3s ease;
}

header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    will-change: transform;
}

.nav-left {
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    height: 100%;
    align-items: center;
}

.nav-right {
    flex-shrink: 0;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.logo {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-color);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 180px;
    height: 50px;
    line-height: 50px;
}

.logo a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    height: 100%;
}

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

.nav-menu {
    display: flex;
    list-style: none;
    gap: 3rem;
    align-items: center;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav-link {
    color: var(--text-dark);
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    line-height: 40px;
    min-width: 80px;
}

.nav-link:hover {
    background-color: rgba(10, 36, 99, 0.1);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.language-dropdown {
    position: relative;
    display: inline-block;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray);
    background-color: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lang-toggle i {
    font-size: 0.625rem;
    transition: transform 0.3s ease;
}

.lang-toggle.open i {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    top: 70px;
    right: 0;
    background-color: var(--white);
    border: 1px solid var(--gray);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 100px;
    display: none;
    z-index: 1100;
    overflow: hidden;
}

.lang-dropdown-menu.show {
    display: block;
}

.lang-option {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    text-align: left;
    transition: background-color 0.2s ease;
    color: var(--text-dark);
}

.lang-option:hover {
    background-color: rgba(10, 36, 99, 0.1);
    color: var(--primary-color);
}

.mobile-lang {
    display: none;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
    margin: 3px 0;
    transition: 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -5px);
}

/* ===================================
   Footer
   =================================== */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--secondary-color);
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
    display: block;
}

.footer-section a:hover {
    color: var(--secondary-color);
}

.footer-contact i {
    margin-right: 10px;
    color: var(--secondary-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-link:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ===================================
   WhatsApp Float Button
   =================================== */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: all 0.3s ease;
    cursor: pointer;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

/* ===================================
   Chat Window Styles
   =================================== */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    flex-direction: column;
    max-height: 500px;
    border: 1px solid var(--gray);
}

.chat-window.open {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: var(--white);
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    color: var(--white);
    font-size: 1rem;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.3s ease;
}

.chat-settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-settings-panel {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid var(--gray);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dark);
    cursor: pointer;
}

.chat-setting-item input[type="checkbox"] {
    cursor: pointer;
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.3s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--light-gray);
}

.chat-message {
    display: flex;
    margin-bottom: 12px;
    max-width: 85%;
}

.chat-message.customer {
    justify-content: flex-end;
}

.chat-message.admin {
    justify-content: flex-start;
}

.chat-message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.chat-message.customer .chat-message-content {
    background: #25D366;
    color: var(--white);
    border-radius: 16px 4px 16px 16px;
}

.chat-message.admin .chat-message-content {
    background: var(--white);
    color: var(--text-dark);
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-message-time {
    font-size: 0.625rem;
    color: var(--dark-gray);
    margin-top: 4px;
    text-align: right;
}

.chat-message.admin .chat-message-time {
    text-align: left;
}

.chat-input-area {
    padding: 12px 16px;
    background: var(--white);
    border-top: 1px solid var(--gray);
    border-radius: 0 0 12px 12px;
}

.chat-input-group {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--gray);
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    border-color: #25D366;
}

.chat-send-btn {
    background: #25D366;
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-send-btn:hover {
    background: #128C7E;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
    transform: none;
}

.chat-typing {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--dark-gray);
    font-size: 0.75rem;
}

/* 聊天消息发送状态 */
.chat-message-status {
    font-size: 0.625rem;
    margin-top: 2px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.chat-message-status.sending {
    color: var(--dark-gray);
}

.chat-message-status.sent {
    color: #25D366;
}

.chat-message-status.failed {
    color: #ef4444;
}

.chat-message-status i {
    font-size: 0.5rem;
}

/* 聊天按钮未读消息红点 */
.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: var(--white);
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: chat-badge-pulse 2s infinite;
}

@keyframes chat-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chat-contact-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--light-gray);
}

.chat-contact-form h5 {
    margin: 0 0 16px 0;
    color: var(--dark-gray);
    font-size: 0.9375rem;
    text-align: center;
}

.chat-form-group {
    margin-bottom: 12px;
}

.chat-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray);
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.chat-form-group input:focus {
    border-color: #25D366;
}

.chat-form-group input::placeholder {
    color: var(--gray);
}

.chat-form-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.chat-form-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.chat-form-submit:disabled {
    background: var(--gray);
    cursor: not-allowed;
    transform: none;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--dark-gray);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chat-welcome {
    text-align: center;
    padding: 20px;
    color: var(--dark-gray);
    font-size: 0.875rem;
}

.chat-welcome p {
    margin-bottom: 8px;
}

/* ===================================
   Product Card Styles (Universal)
   =================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    transition: opacity 0.3s ease;
}

.product-card {
    display: block;
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    max-height: 600px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.product-card.filter-hidden {
    opacity: 0;
    transform: scale(0.9);
    max-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.product-card:hover,
.product-card:hover *:not(.btn) {
    color: inherit;
}

.product-image {
    width: 100%;
    height: 260px;
    object-fit: cover;
    background-color: var(--gray);
}

.product-info {
    padding: 1.75rem;
}

.product-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    cursor: help;
}

.product-specs {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.product-specs span {
    display: inline-block;
    margin-right: 1rem;
}

.product-card .btn {
    width: 100%;
}

.view-all-container {
    text-align: center;
    margin-top: 3rem;
}

/* ===================================
   Responsive Design - Global
   =================================== */
@media (max-width: 968px) {
    .menu-toggle {
        display: flex;
    }

    .nav-center {
        position: relative;
    }
    
    .nav-right {
        display: none;
    }

    .mobile-lang {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background-color: var(--white);
        width: 250px;
        padding: 2rem;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        gap: 1rem;
        z-index: 2000;
        height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu .language-dropdown {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--gray);
    }

    /* Product grid responsive for tablet */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    .product-image {
        height: 220px;
    }

    .product-info {
        padding: 1.25rem;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Product grid responsive for mobile */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .product-card {
        max-height: none;
    }

    .product-image {
        height: 200px;
    }

    .product-info {
        padding: 1rem;
    }

    .product-title {
        font-size: 1.1rem;
    }

    .product-specs {
        font-size: 0.8rem;
    }

    .container {
        padding: 0 1rem;
    }

    /* 移动端聊天窗口居中适配 */
    .chat-window {
        right: 50%;
        transform: translateX(50%);
        width: calc(100% - 24px);
        max-width: 360px;
        bottom: 80px;
    }
}