/* =========================================================================
   USORDER.VN - CUSTOM STYLES FOR HTML5 UP STORY TEMPLATE
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

body, input, select, textarea {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Ép ảnh luôn hiển thị sắc nét, không bị opacity: 0 do is-preload hoặc scrollex */
.banner .image img,
.spotlight .image img,
.gallery article .image img,
.gallery article .image {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

body.is-preload .banner .image img,
body.is-preload .spotlight .image img,
body.is-preload .gallery article .image img {
    opacity: 1 !important;
    visibility: visible !important;
}

/* =========================================================================
   RANDOM PRODUCT IMAGE INFINITE SLIDER
   ========================================================================= */
.product-slider-wrapper {
    width: 100%;
    overflow: hidden;
    padding: 1.5rem 0;
    background: rgba(15, 23, 42, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
}

.product-slider-track {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: scrollProductSlider 30s linear infinite;
}

.product-slider-wrapper:hover .product-slider-track {
    animation-play-state: paused;
}

.product-slider-item {
    width: 200px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.product-slider-item:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #38bdf8;
}

.product-slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-slider-item:hover img {
    transform: scale(1.08);
}

/* Product table thumbnail */
.prod-table-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prod-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: block;
}

.prod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.prod-thumb:hover img {
    transform: scale(1.15);
}

@keyframes scrollProductSlider {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - 8px)); }
}

/* Brand badge in banner */
.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: #38bdf8;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.brand-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Meta stats badge bar */
.meta-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 1.25rem 0 1.75rem 0;
}

.meta-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: #cbd5e1;
}

.meta-stat-item strong {
    color: #38bdf8;
    font-weight: 700;
}

.meta-stat-item.online-stat strong {
    color: #4ade80;
}

/* Category Filter Nav */
.category-nav-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 2rem 0 3rem 0;
}

.cat-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cat-nav-btn:hover {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #0f172a !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.25);
}

.cat-nav-btn .cat-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.75rem;
}

/* Category Section Blocks */
.category-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    text-align: left;
    transition: border-color 0.2s ease;
}

.category-block:hover {
    border-color: rgba(56, 189, 248, 0.3);
}

.category-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1rem;
}

.category-header-wrap h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-tag-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.category-prod-count {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Table Enhancements */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.table-wrapper table {
    margin: 0;
    width: 100%;
}

.table-wrapper table th {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #cbd5e1;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.04);
}

.table-wrapper table td {
    vertical-align: middle;
    font-size: 0.95rem;
}

.prod-name-link {
    font-weight: 600;
    color: #f1f5f9;
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.prod-name-link:hover {
    color: #38bdf8 !important;
    text-decoration: underline;
}

.price-cell {
    font-weight: 700;
    font-size: 1.05rem;
    color: #38bdf8;
    white-space: nowrap;
    text-align: right;
}

/* Condition Badges */
.cond-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.cond-badge.cond-new {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.cond-badge.cond-used {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.cond-badge.cond-other {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.photo-btn:hover {
    background: #38bdf8;
    color: #0f172a !important;
}

/* Contact Cards Grid */
.contact-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: center;
}

.contact-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
}

.contact-card:hover {
    transform: translateY(-4px);
    border-color: #38bdf8;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.contact-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.contact-card.zalo .contact-card-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.contact-card.hotline .contact-card-icon {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.contact-card.facebook .contact-card-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.contact-card h4 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.contact-card p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

.contact-card .btn-connect {
    margin-top: 1rem;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.08);
}

.contact-card:hover .btn-connect {
    background: #38bdf8;
    color: #0f172a;
}

/* =========================================================================
   FLOATING AI CHAT WIDGET (USORDER AI)
   ========================================================================= */

#ai-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    font-size: 14px;
}

.ai-chat-header {
    position: relative;
    padding: 14px 16px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-header strong {
    display: block;
    font-size: 15px;
    color: #38bdf8;
    margin-bottom: 2px;
}

.ai-chat-header span {
    font-size: 12px;
    color: #94a3b8;
    display: block;
}

#ai-chat-close {
    position: absolute;
    right: 14px;
    top: 14px;
    font-size: 20px;
    cursor: pointer;
    font-weight: bold;
    color: #94a3b8;
    line-height: 1;
    transition: color 0.15s ease;
}

#ai-chat-close:hover {
    color: #f8fafc;
}

.ai-chat-body {
    height: 300px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 14px;
    background: #0b1120;
}

.ai-chat-body::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

.ai-msg {
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 10px;
    line-height: 1.45;
    font-size: 13px;
    word-break: break-word;
}

.ai-msg-bot {
    background: #1e293b;
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #f1f5f9;
    border-bottom-left-radius: 3px;
}

.ai-msg-user {
    background: rgba(14, 165, 233, 0.25);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #e0f2fe;
    margin-left: 24px;
    text-align: right;
    border-bottom-right-radius: 3px;
}

.ai-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #111827;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-form input {
    flex: 1;
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    color: #f8fafc;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
    height: auto;
}

.ai-chat-form input:focus {
    border-color: #38bdf8;
}

.ai-chat-form button {
    background: #38bdf8;
    color: #0f172a;
    border: none;
    border-radius: 999px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    height: auto;
    line-height: 38px;
    transition: background 0.15s ease;
}

.ai-chat-form button:hover {
    background: #0ea5e9;
}

/* Floating Toggle Button */
#ai-chat-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #22c55e);
    border: none;
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ai-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6);
}

/* Footer Admin & Online counter */
.footer-meta {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #64748b;
}

.footer-meta a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.footer-meta a:hover {
    color: #94a3b8;
    text-decoration: underline;
}

.footer-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}
