/* ============================================
   Tab Navigation
   ============================================ */
.tabs-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-1);
}
.tabs-container::-webkit-scrollbar {
    display: none;
}
.tab-nav {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    white-space: nowrap;
    min-width: max-content;
}
.tab-nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-nav-btn:hover {
    background: var(--bg-2);
    color: var(--text-1);
}
.tab-nav-btn.active {
    background: var(--primary);
    color: #fff;
}
.tab-nav-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .tab-nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ============================================
   Fake Notification Popup
   ============================================ */
@keyframes notifSlideIn {
    from {
        opacity: 0;
        transform: translateX(120px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notifSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(120px);
    }
}

.floating-notif {
    position: fixed;
    right: 12px;
    top: 130px;
    z-index: 9998;
    width: 240px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    animation: notifSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    overflow: hidden;
    cursor: pointer;
}

.floating-notif.hiding {
    animation: notifSlideOut 0.3s ease-in forwards;
}

.floating-notif::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    border-radius: 14px 0 0 14px;
}

.floating-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-glow);
}

.floating-notif-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.floating-notif-body {
    flex: 1;
    min-width: 0;
}

.floating-notif-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-notif-msg {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
}

.floating-notif-amount {
    color: var(--primary);
    font-size: 12px;
}

.floating-notif-time {
    font-size: 9px;
    color: var(--text-3);
    margin-top: 1px;
}

.floating-notif-close {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 16px;
    color: var(--text-3);
    cursor: pointer;
    line-height: 1;
}

.floating-notif-close:hover {
    color: var(--text-1);
}

@media (max-width: 768px) {
    .floating-notif {
        right: 10px;
        top: 140px;
        width: calc(100vw - 20px);
        max-width: 180px;
    }
    .tabs-container {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-1);
    }
}

/* ============================================
   Floating Contact Bar
   ============================================ */
.floating-contact {
    position: fixed;
    right: 20px;
    top: 70%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.floating-item {
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
    cursor: pointer;
}

/* Pulse animation */
.floating-item::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: inherit;
    opacity: 0.4;
    animation: pulse 2s infinite;
    z-index: -1;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.2;
    }
    100% {
        transform: scale(1);
        opacity: 0.4;
    }
}

/* Different colors for each social */
.floating-item[data-social="facebook"]::before {
    background: #1877f2;
}

.floating-item[data-social="zalo"]::before {
    background: #0068ff;
}

.floating-item:hover::before {
    animation: none;
    opacity: 0;
}

.floating-item img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.floating-item:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating-item[data-social="facebook"]:hover {
    background: #1877f2;
}

.floating-item[data-social="facebook"]:hover img {
    filter: brightness(0) invert(1);
}

.floating-item[data-social="zalo"]:hover {
    background: #0068ff;
}

.floating-item[data-social="zalo"]:hover img {
    filter: brightness(0) invert(1);
}

.floating-label {
    position: absolute;
    right: 60px;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.floating-item:hover .floating-label {
    opacity: 1;
    visibility: visible;
}

/* Responsive - Mobile Contact Bottom Bar */
@media (max-width: 768px) {
    .floating-contact {
        right: 10px;
        bottom: 70px;
        transform: none;
        flex-direction: column;
        gap: 6px;
    }

    .floating-item {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .floating-item img {
        width: 22px;
        height: 22px;
    }

    .floating-label {
        display: none;
    }
}

/* ============================================
   AFFSP - Custom Styles
   ============================================ */

/* --- Shimmer Animation for Skeleton Loading --- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(226, 232, 240, 0.4) 25%,
    rgba(241, 245, 249, 0.6) 50%,
    rgba(226, 232, 240, 0.4) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.dark .shimmer {
  background: linear-gradient(
    90deg,
    rgba(30, 41, 59, 0.6) 25%,
    rgba(51, 65, 85, 0.8) 50%,
    rgba(30, 41, 59, 0.6) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(71, 85, 105, 0.6);
}

/* --- Text Selection --- */
::selection {
  background: rgba(139, 92, 246, 0.2);
  color: inherit;
}

.dark ::selection {
  background: rgba(139, 92, 246, 0.3);
}

/* --- Smooth Scroll --- */
html {
  scroll-behavior: smooth;
}

/* --- Focus Ring Customization --- */
*:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.5);
  outline-offset: 2px;
}

.dark *:focus-visible {
  outline: 2px solid rgba(139, 92, 246, 0.4);
  outline-offset: 2px;
}

/* --- Line Clamp Utilities --- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Copy Button Animation --- */
@keyframes copyPulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.copy-pulse {
  animation: copyPulse 0.2s ease-out;
}

/* --- Toast Animation --- */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

.toast-enter {
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast-exit {
  animation: toastOut 0.2s ease-in forwards;
}

/* --- QR Code Image Styling --- */
#qrAffiliate img,
#qrShort img,
#qrShortenerResult img {
  display: block;
  width: 100% !important;
  height: auto !important;
  border-radius: 8px;
}

#qrAffiliate canvas,
#qrShort canvas,
#qrShortenerResult canvas {
  border-radius: 8px;
}

/* --- Badge Styles --- */
.badge-shopee {
  background: rgba(238, 140, 52, 0.1);
  color: #ee8c34;
  border: 1px solid rgba(238, 140, 52, 0.2);
}

.badge-lazada {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-tiktok {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
  border: 1px solid rgba(236, 72, 153, 0.2);
}

.badge-auto {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-shorten {
  background: rgba(20, 184, 166, 0.1);
  color: #14b8a6;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.dark .badge-shopee {
  background: rgba(238, 140, 52, 0.15);
  color: #fb923c;
  border-color: rgba(238, 140, 52, 0.3);
}

.dark .badge-lazada {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.dark .badge-tiktok {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.3);
}

.dark .badge-auto {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

.dark .badge-shorten {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border-color: rgba(20, 184, 166, 0.3);
}

/* --- Platform Button Active States --- */
.platform-btn.active {
  transform: translateY(-2px);
}

.platform-btn.active[data-platform="auto"] {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.platform-btn.active[data-platform="shopee"] {
  background: rgba(238, 140, 52, 0.1);
  border-color: rgba(238, 140, 52, 0.5);
  box-shadow: 0 0 20px rgba(238, 140, 52, 0.1);
}

.platform-btn.active[data-platform="lazada"] {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.platform-btn.active[data-platform="tiktok"] {
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.1);
}

/* --- History Item Hover --- */
.history-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
  transform: translateX(4px);
}

/* --- Responsive adjustments --- */
@media (max-width: 640px) {
  .text-4xl {
    font-size: 2.25rem;
    line-height: 1.1;
  }

  .text-5xl {
    font-size: 2.5rem;
    line-height: 1.1;
  }

  .text-6xl {
    font-size: 3rem;
    line-height: 1.1;
  }
}

/* --- Header blur on scroll --- */
#header.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.dark #header.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* --- Backdrop filter support fallback --- */
@supports not (backdrop-filter: blur(12px)) {
  #header {
    background: rgba(255, 255, 255, 0.98) !important;
  }
  .dark #header {
    background: rgba(15, 23, 42, 0.98) !important;
  }
}

/* --- Print styles (hide interactive elements) --- */
@media print {
  #themeToggle,
  #convertBtn,
  #shortenBtn,
  #refreshHistoryBtn,
  .copy-btn,
  #tabContainer,
  #platformSelector,
  #lightbox,
  footer {
    display: none !important;
  }
}

/* Product Preview Card */
.product-preview-card {
  animation: fadeIn 0.3s ease;
}

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