/* Storefront base styles, extracted from layouts/app.blade.php so browsers
   cache them instead of re-downloading ~25KB with every page. Theme colour
   variables stay inline in the layout because they are generated per dealer. */

/* Base Reset & Typography */
html {
    scroll-behavior: smooth;
}

* {
    font-family: 'Manrope', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, var(--bg-pattern-1, rgba(99, 102, 241, 0.05)) 0px, transparent 50%),
        radial-gradient(at 100% 0%, var(--bg-pattern-2, rgba(168, 85, 247, 0.05)) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Navbar Enhancements */
.navbar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.1);
    z-index: 99999 !important;
}

.bg-primary {
    background: var(--nav-bg) !important;
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand img {
    filter: drop-shadow(0 0 8px var(--logo-glow, rgba(99, 102, 241, 0.5)));
}

.nav-link {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease;
}

.nav-link:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}


/* Balance Display - The Premium Chip */
.balance-display {
    background: var(--accent-gradient);
    border-radius: 9999px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    box-shadow: 0 10px 15px -3px var(--balance-shadow, rgba(244, 63, 94, 0.3));
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.balance-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px var(--balance-hover-shadow, rgba(244, 63, 94, 0.4));
}

.balance-amount {
    font-size: 1rem;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.balance-timer {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 500;
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
}

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

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(180deg);
}

/* Footer Redesign */
.main-footer {
    background: var(--footer-bg);
    color: #f1f5f9;
    padding: 48px 0 24px;
    margin-top: 56px;
    position: relative;
    overflow: hidden;
}

.main-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--footer-accent, rgba(99, 102, 241, 0.3)), transparent);
}

.footer-links h5 {
    color: white;
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 18px;
    position: relative;
    letter-spacing: 0.025em;
}

.footer-links h5::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 40px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.footer-links ul li a {
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    padding: 4px 0;
}

.footer-links ul li a:hover {
    color: white;
    transform: translateX(8px);
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.social-links a {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px var(--social-hover-shadow, rgba(99, 102, 241, 0.4));
    border-color: transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .balance-display {
        min-width: auto;
        padding: 6px 10px;
        margin-right: 10px;
    }

    .balance-display .balance-amount {
        font-size: 0.9rem;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    .main-footer {
        padding: 30px 0 15px;
    }

    .footer-links {
        margin-bottom: 30px;
    }

    .footer-links h5 {
        margin-bottom: 15px;
    }
}

/* Floating Action Button */
.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    overflow: hidden;
    padding: 0;
}

.floating-btn:hover {
    transform: scale(1.1) translateY(-5px);
    filter: drop-shadow(0 8px 20px rgba(0, 104, 255, 0.4));
}

.floating-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Pulse animation for balance update */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.balance-pulse {
    animation: pulse 0.5s ease-in-out;
}

/* Premium Badge Styles - Small Pill */
.premium-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: none;
    background: var(--badge-color, #e11d48);
    border-radius: 6px;
    padding: 2px 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    animation: badge-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* HOT */
.badge-hot {
    --badge-color: var(--badge-hot, #f43f5e);
}

/* NEW */
.badge-new {
    --badge-color: var(--badge-new, #10b981);
}

/* POPULAR */
.badge-popular {
    --badge-color: var(--badge-popular, #8b5cf6);
}

/* PROMO */
.badge-promo {
    --badge-color: var(--badge-promo, #f59e0b);
}

.premium-badge span {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: none;
    text-align: center;
    line-height: 1;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

@keyframes badge-pop-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Ensure parent cards allow overflow for the badge */
.product-card,
.game-card,
.package-card,
.provider-card {
    overflow: visible !important;
}

.balance-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    min-width: 300px;
    z-index: 2000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Popup Styles - Updated */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    backdrop-filter: blur(5px);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    position: relative;
    max-width: 550px;
    width: 90%;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.popup-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
}

/* Swipe Navigation */
.popup-swipe-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.popup-swipe-wrapper {
    display: flex;
    transition: transform 0.4s ease;
    height: 100%;
}

.popup-swipe-item {
    min-width: 100%;
    position: relative;
}

/* Swipe Indicators */
.popup-indicators {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 10;
}

.popup-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-indicator.active {
    background: #fff;
    transform: scale(1.2);
    border-color: #fff;
}

/* Navigation Arrows */
.popup-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.popup-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.popup-nav-arrow.prev {
    left: 20px;
}

.popup-nav-arrow.next {
    right: 20px;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.popup-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

/* Popup Counter */
.popup-counter {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 20;
}

/* Responsive adjustments for popup */
@media (max-width: 768px) {
    .popup-container {
        max-width: 90%;
    }

    .popup-nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .popup-nav-arrow.prev {
        left: 10px;
    }

    .popup-nav-arrow.next {
        right: 10px;
    }

    .popup-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .popup-indicators {
        bottom: 10px;
    }

    .popup-indicator {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .popup-container {
        max-width: 95%;
    }

    .popup-nav-arrow {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .popup-counter {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* Animation for popup entry */
@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-container {
    animation: popupSlideIn 0.4s ease-out;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--nav-bg);
        margin-top: 15px;
        padding: 15px 20px;
        border-radius: 15px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }

    .main-nav-items {
        display: flex;
        flex-direction: column;
        gap: 5px;
        margin-bottom: 15px;
    }


    .main-nav-items .nav-item {
        width: 100%;
    }

    .main-nav-items .nav-link {
        padding: 12px 16px !important;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
        display: flex;
        align-items: center;
        color: rgba(255, 255, 255, 0.9) !important;
    }

    .main-nav-items .nav-link:hover, .main-nav-items .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
        color: #fff !important;
    }

    .main-nav-items .nav-link i {
        width: 24px;
        font-size: 1.1rem;
        opacity: 0.8;
        margin-right: 12px !important;
        text-align: center;
    }

    .user-nav-items {
        flex-direction: column;
        gap: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding-top: 15px;
    }

    .user-nav-items .nav-item {
        width: 100%;
    }

    .balance-display {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 5px;
        padding: 12px 16px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid transparent;
        box-shadow: none;
        color: rgba(255, 255, 255, 0.9);
    }

    .balance-display:hover {
        background: rgba(255, 255, 255, 0.1);
        box-shadow: none;
        transform: none;
    }

    .balance-display .balance-amount {
        flex: 1;
        margin-left: 12px;
        align-items: flex-start;
    }

    .balance-display .balance-timer {
        margin-top: 2px;
    }

    .nav-item.dropdown .nav-link {
        padding: 12px 16px !important;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
    }
}

/* Custom Dropdown Styling */
.dropdown-menu {
    border-radius: 20px !important;
    padding: 12px !important;
    min-width: 260px !important;
    border: 1px solid var(--glass-border) !important;
    /* Dùng biến bề mặt, đừng ép trắng: !important ở đây từng đè cả chế độ tối,
       nền trắng + chữ sáng khiến menu tài khoản không đọc được. */
    background: var(--ui-surface) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
    margin-top: 15px !important;
    z-index: 100000 !important;
}

.dropdown-item {
    border-radius: 12px !important;
    padding: 10px 16px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: var(--text-main) !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-bottom: 2px;
}

.dropdown-item:hover {
    background: var(--primary-gradient) !important;
    color: white !important;
    transform: translateX(4px);
}

.dropdown-item i {
    width: 28px;
    font-size: 1.1rem;
    opacity: 0.8;
}

.dropdown-item:hover i {
    opacity: 1;
}

.dropdown-divider {
    margin: 10px 0 !important;
    opacity: 0.08 !important;
}

.user-avatar-nav {
    width: 34px;
    height: 34px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: var(--primary-color, #6366f1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.nav-link:hover .user-avatar-nav {
    transform: scale(1.1) rotate(-5deg);
}

@media (max-width: 991.98px) {
    .dropdown-menu {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 5px 0 5px 15px !important;
        margin-top: 5px !important;
    }

    .dropdown-item {
        color: rgba(255, 255, 255, 0.8) !important;
        padding: 10px 15px !important;
    }
    
    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #fff !important;
    }
}

.mobile-user-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
}

.mobile-user-initial:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: scale(1.05);
}

/* ===== Ô tìm kiếm dịch vụ (app bar) ===== */
.service-search-wrapper {
    position: relative;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.service-search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.85));
    border: 1px solid var(--glass-border, rgba(0, 0, 0, 0.08));
    box-shadow: var(--card-shadow, 0 4px 18px rgba(0, 0, 0, 0.06));
    transition: border-color .2s ease, box-shadow .2s ease;
}

.service-search-box:focus-within {
    border-color: var(--bs-primary, #6366f1);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.18);
}

.service-search-icon {
    color: var(--bs-primary, #6366f1);
    flex-shrink: 0;
}

.service-search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.95rem;
    color: inherit;
    min-width: 0;
}

.service-search-clear {
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--ui-text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
}

.service-search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 380px;
    overflow-y: auto;
    border-radius: 16px;
    background: var(--ui-surface);
    border: 1px solid var(--glass-border, rgba(0, 0, 0, 0.08));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    padding: 0.35rem;
}

.service-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ui-text);
    cursor: pointer;
}

.service-search-item:hover,
.service-search-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--ui-text);
}

.service-search-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-primary, #6366f1);
}

.service-search-item-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-search-item-type {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--bs-primary, #6366f1);
    flex-shrink: 0;
}

.service-search-empty {
    padding: 0.9rem 0.75rem;
    font-size: 0.875rem;
    color: var(--ui-text-muted);
    text-align: center;
}

/* Biến thể nằm trên thanh nav tối: nhỏ gọn, nền trong, chữ sáng. */
.navbar-search {
    flex: 1 1 220px;
    max-width: 320px;
    margin: 0 1rem;
}

.navbar-search .service-search-box {
    padding: 0.3rem 0.9rem;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.navbar-search .service-search-box:focus-within {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: none;
}

.navbar-search .service-search-input,
.navbar-search .service-search-clear {
    color: #fff;
}

.navbar-search .service-search-input::placeholder,
.navbar-search .service-search-icon {
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 991.98px) {
    /* Xuống hàng riêng, full chiều ngang — nếu để trong menu hamburger
       thì ô tìm kiếm coi như biến mất trên điện thoại. */
    .navbar-search {
        flex: 0 0 100%;
        max-width: none;
        order: 3;
        margin: 0.6rem 0 0.1rem;
    }
}

/* animate.css 4.1.1 subset: only the effects the storefront uses.
   pulse reuses the @keyframes pulse defined above. */
.animate__animated {
    animation-duration: 1s;
    animation-fill-mode: both;
}

.animate__animated.animate__infinite {
    animation-iteration-count: infinite;
}

@media (prefers-reduced-motion: reduce), print {
    .animate__animated {
        animation-duration: 1ms !important;
        transition-duration: 1ms !important;
        animation-iteration-count: 1 !important;
    }
}

.animate__pulse {
    animation-name: pulse;
    animation-timing-function: ease-in-out;
}

@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80%, to { animation-timing-function: cubic-bezier(.215, .61, .355, 1); }
    0% { opacity: 0; transform: scale3d(.3, .3, .3); }
    20% { transform: scale3d(1.1, 1.1, 1.1); }
    40% { transform: scale3d(.9, .9, .9); }
    60% { opacity: 1; transform: scale3d(1.03, 1.03, 1.03); }
    80% { transform: scale3d(.97, .97, .97); }
    to { opacity: 1; transform: scaleX(1); }
}

.animate__bounceIn {
    animation-duration: .75s;
    animation-name: bounceIn;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    to { opacity: 1; }
}

.animate__fadeIn {
    animation-name: fadeIn;
}

@keyframes fadeInUp {
    0% { opacity: 0; transform: translate3d(0, 100%, 0); }
    to { opacity: 1; transform: translateZ(0); }
}

.animate__fadeInUp {
    animation-name: fadeInUp;
}
