/*
 * CSS Variables mặc định (fallback).
 * --rv-primary, --rv-secondary, --rv-bg-vip, --rv-border-vip
 * sẽ được ghi đè bởi Admin Settings qua functions.php (wp_add_inline_style).
 */
:root {
    --rv-primary: #198754;
    --rv-primary-hover: #0d6832;
    --rv-primary-light: #3eaf76;
    --rv-primary-rgb: 25, 135, 84;
    --rv-secondary: #ffc107;
    --rv-secondary-hover: #e8ac00;
    --rv-bg-vip: rgba(var(--rv-primary-rgb), 0.08);
    --rv-border-vip: rgba(var(--rv-primary-rgb), 0.25);
    --rv-text-dark: #212529;
    --rv-text-muted: #6c757d;
}

body {
    background-color: #f8f9fa;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--rv-text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

footer {
    margin-top: auto !important;
}

/* Rounded and smooth styles */
.btn-primary-green {
    background-color: var(--rv-primary);
    color: #fff;
    border: none;
    transition: all 0.3s ease;
}
.btn-primary-green:hover {
    background-color: var(--rv-primary-hover);
    color: #fff;
    transform: translateY(-1px);
}

.card-listing {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.card-listing:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: #ccc;
}

/* VIP Highlight */
.card-listing-vip {
    background-color: var(--rv-bg-vip);
    border: 1px solid var(--rv-border-vip);
}
.card-listing-vip:hover {
    border-color: var(--rv-primary);
}

/* Circle category items */
.cat-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--rv-text-dark);
    transition: transform 0.2s ease;
}
.cat-circle-item:hover {
    transform: scale(1.05);
    color: var(--rv-primary);
}
.cat-circle-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rv-primary);
    font-size: 28px;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.1);
    transition: all 0.2s ease;
}
.cat-circle-item:hover .cat-circle-icon {
    background: var(--rv-primary);
    color: #fff;
}
.cat-circle-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Micro animations */
.cursor-pointer {
    cursor: pointer;
}
.transition-3 {
    transition: all 0.3s ease;
}

/* ==========================================================================
   DYNAMIC STYLE OVERRIDES (Using CSS variables injected via functions.php)
   ========================================================================== */
.text-success {
    color: var(--rv-primary) !important;
}
.btn-success {
    background-color: var(--rv-primary) !important;
    border-color: var(--rv-primary) !important;
}
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background-color: var(--rv-primary-hover) !important;
    border-color: var(--rv-primary-hover) !important;
}
.btn-outline-success {
    color: var(--rv-primary) !important;
    border-color: var(--rv-primary) !important;
}
.btn-outline-success:hover, .btn-outline-success:focus, .btn-outline-success:active,
.btn-check:checked + .btn-outline-success,
.btn-check:active + .btn-outline-success {
    background-color: var(--rv-primary) !important;
    border-color: var(--rv-primary) !important;
    color: #fff !important;
}

/* Listings AJAX loading overlay */
.rv-listings-loading {
    position: relative;
    pointer-events: none;
}
.rv-listings-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    transition: all 0.3s ease;
    border-radius: 12px;
}
.rv-listings-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border: 3px solid rgba(var(--rv-primary-rgb), 0.2);
    border-top-color: var(--rv-primary);
    border-radius: 50%;
    animation: rv-spin 0.8s linear infinite;
    z-index: 51;
}

@keyframes rv-spin {
    to {
        transform: rotate(360deg);
    }
}
.border-success {
    border-color: var(--rv-primary) !important;
}
.bg-success {
    background-color: var(--rv-primary) !important;
}
.link-success {
    color: var(--rv-primary) !important;
}
.link-success:hover {
    color: var(--rv-primary-hover) !important;
}

.btn-warning {
    background-color: var(--rv-secondary) !important;
    border-color: var(--rv-secondary) !important;
    color: #ffffff !important;
}
.btn-warning:hover, .btn-warning:focus, .btn-warning:active {
    background-color: var(--rv-secondary-hover) !important;
    border-color: var(--rv-secondary-hover) !important;
    color: #ffffff !important;
}

.rv-auth-page-container .form-control:focus {
    border-color: var(--rv-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--rv-primary-rgb), 0.12) !important;
}
.rv-wallet-pkg:hover {
    border-color: var(--rv-primary) !important;
}
.rv-wallet-pkg.active {
    border-color: var(--rv-primary) !important;
    background-color: var(--rv-bg-vip) !important;
}
.rv-wallet-pkg .rv-pkg-points {
    color: var(--rv-primary) !important;
}
.rv-wallet-pkg .check-icon {
    color: var(--rv-primary) !important;
}
.rv-pagination a, .rv-pagination span {
    color: var(--rv-primary) !important;
}
.rv-pagination a:hover {
    background-color: var(--rv-bg-vip) !important;
    border-color: var(--rv-primary) !important;
    color: var(--rv-primary) !important;
}
.rv-pagination span.current {
    background-color: var(--rv-primary) !important;
    border-color: var(--rv-primary) !important;
    color: #fff !important;
}
.rv-avatar.bg-success {
    background-color: var(--rv-primary) !important;
}

/* ===== Bootstrap Pagination Override (Category page) ===== */
.pagination .page-item.active .page-link {
    background-color: var(--rv-primary) !important;
    border-color: var(--rv-primary) !important;
    color: #fff !important;
}
.pagination .page-link {
    color: var(--rv-primary);
}
.pagination .page-link:hover {
    color: var(--rv-primary-hover);
    background-color: var(--rv-bg-vip);
    border-color: var(--rv-primary);
}

/* ===== Dashicon Alignment Fix ===== */
.rv-dashboard-wrapper .dashicons,
.table .dashicons,
.small-icon {
    vertical-align: middle !important;
    line-height: 1;
}

/* ===== LIGHTBOX FOR SLIDESHOW ===== */
.rv-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show Lightbox state */
.rv-lightbox.active {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.rv-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rv-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 44px;
    line-height: 1;
    cursor: pointer;
    z-index: 1052;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 10px;
}
.rv-lightbox-close:hover {
    color: #ffffff;
    transform: scale(1.1);
}
.rv-lightbox-close:focus {
    outline: none;
}

.rv-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1100px;
    height: 80%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1051;
}

.rv-lightbox-image-container {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 20px;
}

.rv-lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Zoom/Fade-in image animation when loaded and active */
.rv-lightbox-image-container img.loaded {
    opacity: 1;
    transform: scale(1);
}

.rv-lightbox-nav {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}
.rv-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}
.rv-lightbox-nav:active {
    transform: scale(0.95);
}
.rv-lightbox-nav .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rv-lightbox-counter {
    position: absolute;
    bottom: 30px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    z-index: 1051;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 16px;
    border-radius: 20px;
    letter-spacing: 1px;
}

/* Spinner Loading */
.rv-lightbox-spinner {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--rv-primary);
    border-radius: 50%;
    animation: rv-spin 0.8s linear infinite;
    display: none;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .rv-lightbox-content {
        height: 70%;
        width: 95%;
    }
    .rv-lightbox-image-container {
        margin: 0;
    }
    .rv-lightbox-nav {
        width: 46px;
        height: 46px;
        position: absolute;
        bottom: -70px;
    }
    .rv-lightbox-prev {
        left: calc(50% - 60px);
    }
    .rv-lightbox-next {
        right: calc(50% - 60px);
    }
    .rv-lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 36px;
    }
}

/* Custom Carousel Controls for Single Listing Details Slider */
#listingImagesCarousel .carousel-control-prev,
#listingImagesCarousel .carousel-control-next {
    width: 44px;
    height: 44px;
    top: calc(50% - 22px);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.5); /* Slate 900 semi-transparent */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    opacity: 0.85;
    transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease, border-color 0.25s ease;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#listingImagesCarousel .carousel-control-prev {
    left: 20px;
}

#listingImagesCarousel .carousel-control-next {
    right: 20px;
}

#listingImagesCarousel .carousel-control-prev:hover,
#listingImagesCarousel .carousel-control-next:hover {
    background: rgba(15, 23, 42, 0.75);
    border-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
    color: #ffffff;
    transform: scale(1.08);
}

#listingImagesCarousel .carousel-control-prev:active,
#listingImagesCarousel .carousel-control-next:active {
    transform: scale(0.95);
}

#listingImagesCarousel .carousel-control-prev .dashicons,
#listingImagesCarousel .carousel-control-next .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   SUPPORT TICKET SYSTEM & CHAT BUBBLES
   ========================================================================== */
.rv-support-wrapper .nav-pills .nav-link {
    background-color: #f1f5f9;
    color: #475569;
    transition: all 0.3s ease;
}
.rv-support-wrapper .nav-pills .nav-link.active {
    background-color: var(--rv-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(var(--rv-primary-rgb), 0.2);
}
.rv-support-wrapper .table th {
    font-weight: 600;
    font-size: 14px;
    color: #475569;
}
.rv-support-wrapper .table td {
    padding: 1rem 0.75rem;
    font-size: 14.5px;
}
.hover-text-success:hover {
    color: var(--rv-primary) !important;
}

/* Chat bubble styling */
.rv-ticket-chat-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background-color: #f8fafc;
    border-radius: 1rem;
    border: 1px dashed #cbd5e1;
    max-height: 600px;
    overflow-y: auto;
}
.rv-chat-bubble-container {
    display: flex;
    flex-direction: column;
}
.shadow-sm-hover {
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.shadow-sm-hover:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-1px);
}
.rounded-start-4 {
    border-top-left-radius: 1rem !important;
    border-bottom-left-radius: 1rem !important;
}
.rounded-end-4 {
    border-top-right-radius: 1rem !important;
    border-bottom-right-radius: 1rem !important;
}
.rounded-bottom-4 {
    border-bottom-left-radius: 1rem !important;
    border-bottom-right-radius: 1rem !important;
}

/* Scrollbar styling for chat container */
.rv-ticket-chat-thread::-webkit-scrollbar {
    width: 6px;
}
.rv-ticket-chat-thread::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.rv-ticket-chat-thread::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.rv-ticket-chat-thread::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Style for wp_editor on frontend */
.rv-wp-editor-wrapper .wp-editor-container {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}
.rv-wp-editor-wrapper .wp-editor-tools {
    border-bottom: 1px solid #cbd5e1;
    background-color: #f8fafc;
}
.rv-wp-editor-wrapper .quicktags-toolbar {
    border-bottom: 1px solid #cbd5e1;
    background: #f1f5f9;
}
.rv-wp-editor-wrapper .wp-textarea-wrap textarea {
    border: none !important;
    padding: 10px !important;
}

