/*
 * Ad Card Enhancements
 * - Safety notes for buyers
 * - Report link styling
 */

/* Buyer Safety Notes Card */
.buyer-safety-notes {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
}

.buyer-safety-notes .safety-notes-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #4e342e;
}

.buyer-safety-notes .safety-notes-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.buyer-safety-notes .safety-notes-content ul li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(230, 81, 0, 0.1);
    display: flex;
    align-items: start;
    gap: 12px;
}

.buyer-safety-notes .safety-notes-content ul li:last-child {
    border-bottom: none;
}

.buyer-safety-notes .safety-notes-content ul li::before {
    content: "⚠️";
    font-size: 1.2em;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Dark mode support for safety notes */
[data-bs-theme="dark"] .buyer-safety-notes {
    background: linear-gradient(135deg, #3e2723 0%, #4e342e 100%);
}

[data-bs-theme="dark"] .buyer-safety-notes .safety-notes-content {
    color: #ffccbc;
}

[data-bs-theme="dark"] .buyer-safety-notes .safety-notes-content ul li {
    border-bottom-color: rgba(255, 138, 101, 0.2);
}

/* Buyer Safety Note Badge (old style, kept for backwards compatibility) */
.buyer-safety-note {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.buyer-safety-note:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.buyer-safety-note i {
    font-size: 0.875rem;
}

.safety-tip {
    white-space: nowrap;
}

/* Alternative color schemes for safety notes */
.buyer-safety-note.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.buyer-safety-note.success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.buyer-safety-note.info {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Report Link */
.ad-report-link {
    margin-right: auto;
}

.report-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
}

.report-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.report-btn i {
    font-size: 0.875rem;
}

/* RTL Support */
[dir="rtl"] .ad-report-link {
    margin-right: 0;
    margin-left: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .buyer-safety-note {
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .report-btn {
        font-size: 0.7rem;
    }

    .report-btn span {
        display: none;
    }

    .report-btn i {
        margin: 0;
    }
}

/* Enhanced Footer Layout */
.ad-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Tooltip for truncated safety notes */
.buyer-safety-note[data-tooltip] {
    position: relative;
    cursor: help;
}

.buyer-safety-note[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: normal;
    max-width: 200px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 5px;
    z-index: 1000;
}

.buyer-safety-note[data-tooltip]:hover::after {
    opacity: 1;
}

/* Get Quote Box Styling */
.ad-quote-box {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
    transition: all 0.3s ease;
}

.ad-quote-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(240, 147, 251, 0.4);
}

.quote-icon {
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
}

.quote-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.quote-text {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-get-quote {
    background: white;
    color: #f5576c;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.btn-get-quote:hover {
    background: #fff;
    color: #d63950;
    transform: translateX(-4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-get-quote i {
    font-size: 0.75rem;
}

/* Rating Badge Styling */
.ad-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    padding: 4px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.3);
}

.rating-stars {
    display: flex;
    gap: 2px;
}

.rating-stars i {
    font-size: 0.75rem;
    color: white;
}

.rating-value {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
}

.rating-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
}

/* Mobile Responsive for new features */
@media (max-width: 768px) {
    .ad-quote-box {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }

    .quote-icon {
        font-size: 1.25rem;
    }

    .quote-text {
        font-size: 0.75rem;
    }

    .btn-get-quote {
        align-self: center;
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .ad-rating-badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

    .rating-stars i {
        font-size: 0.65rem;
    }

    .rating-value {
        font-size: 0.75rem;
    }

    .rating-count {
        font-size: 0.65rem;
    }
}

/* Wishlist & Cart Active States */
.ad-wishlist-btn.active,
.wishlist-btn-card.active {
    color: #ff4757 !important;
}

.ad-wishlist-btn.active i,
.wishlist-btn-card.active i {
    color: #ff4757 !important;
}

.ad-cart-btn.active,
.cart-btn-card.active {
    color: #4b315e !important;
    background: rgba(75, 49, 94, 0.1);
}

.ad-cart-btn.active i,
.cart-btn-card.active i {
    color: #4b315e !important;
}

/* Placeholder image styles */
.ad-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ebf0 100%);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .ad-image-placeholder {
    background: linear-gradient(135deg, #2a2d3a 0%, #1e212b 100%);
}

.ad-image-placeholder .placeholder-logo {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.ad-image-placeholder:hover .placeholder-logo {
    opacity: 0.6;
    transform: scale(1.05);
}

[data-theme="dark"] .ad-image-placeholder .placeholder-logo {
    opacity: 0.3;
    filter: grayscale(100%) brightness(1.2);
}

/* Fallback for broken images */
.ad-image.placeholder-fallback {
    object-fit: contain !important;
    padding: 20%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ebf0 100%);
    opacity: 0.5;
}

[data-theme="dark"] .ad-image.placeholder-fallback {
    background: linear-gradient(135deg, #2a2d3a 0%, #1e212b 100%);
    filter: brightness(1.2);
}

/* Print styles */
@media print {
    .buyer-safety-note,
    .ad-report-link,
    .ad-quote-box {
        display: none;
    }
}

/* ========================================
   New Compact Card Layout Styles
   ======================================== */

/* Price section directly after title */
.ad-price-section {
    margin: 10px 0 8px 0;
}

.ad-price-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ad-price-main {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color, #6b4c7a);
}

.price-currency {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
}

.price-negotiable-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
}

.price-negotiable-inline i {
    font-size: 0.7rem;
}

/* Location & Publisher Combined Row */
.ad-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.ad-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    flex: 1;
}

.ad-location i {
    font-size: 0.9rem;
    color: var(--primary-color, #6b4c7a);
}

.publisher-info-inline {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.publisher-avatar-mini {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8ecf0;
    flex-shrink: 0;
}

/* Small inline badge circle next to avatar */
.pub-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.pub-badge i { font-size: 0.45rem; color: #fff; }
.pub-verified { background: #1877f2; }
.pub-company  { background: #ff6001; }

/* Features Row - Compact */
.ad-features-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.ad-meta-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-item i {
    font-size: 0.7rem;
}

.meta-separator {
    color: var(--text-muted, #cbd5e1);
    font-weight: 300;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(107, 76, 122, 0.1);
    color: var(--primary-color, #6b4c7a);
}

.feature-tag i {
    font-size: 0.75rem;
}

.feature-tag.cart-enabled-tag {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.feature-tag.delivery-tag {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.feature-tag.custom-field-tag {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
}

.feature-tag.custom-field-tag .cf-label {
    font-weight: 600;
    color: #475569;
}

.feature-tag.custom-field-tag .cf-sep {
    color: #94a3b8;
    margin: 0 1px;
}

.feature-tag.custom-field-tag .cf-value {
    color: #64748b;
}

/* Rating Compact at Bottom */
.ad-rating-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.rating-stars-mini {
    display: flex;
    gap: 2px;
}

.rating-stars-mini i {
    font-size: 0.75rem;
    color: #fbbf24;
}

.rating-stars-mini .far {
    color: #cbd5e1;
}

.rating-value-mini {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-left: 2px;
}

.rating-count-mini {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
}

/* Dark Mode Support */
[data-theme="dark"] .price-amount {
    color: #a78bba;
}

[data-theme="dark"] .ad-info-row {
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .publisher-avatar-mini {
    border-color: #3f3f5a;
}

[data-theme="dark"] .pub-badge {
    border-color: var(--card-bg, #1e293b);
}

[data-theme="dark"] .ad-rating-compact {
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .rating-value-mini {
    color: #e2e8f0;
}

[data-theme="dark"] .feature-tag {
    background: rgba(167, 139, 186, 0.15);
    color: #a78bba;
}

[data-theme="dark"] .feature-tag.cart-enabled-tag {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

[data-theme="dark"] .feature-tag.delivery-tag {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

[data-theme="dark"] .price-negotiable-inline {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .price-amount {
        font-size: 1.2rem;
    }

    .ad-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .publisher-info-inline {
        align-self: flex-end;
    }

    .ad-features-row {
        gap: 6px;
    }

    .feature-tag {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    .ad-meta-inline {
        font-size: 0.7rem;
    }

    .rating-stars-mini i {
        font-size: 0.7rem;
    }

    .rating-value-mini {
        font-size: 0.8rem;
    }

    .rating-count-mini {
        font-size: 0.65rem;
    }
}

/* ========================================
   Emoji Styling for Ad Descriptions
   Facebook-like Emoji Display
   ======================================== */

/* Make emojis larger and more visible like Facebook posts */
.ad-description {
    font-size: 1.05rem;
    line-height: 1.8;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'Cairo', sans-serif !important;
}

/* Emoji styling - make them larger and colorful */
.ad-description img.emoji,
.ad-description .emoji {
    height: 1.4em;
    width: 1.4em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.2em;
    display: inline-block;
}

/* CKEditor emoji output styling */
.ad-description span[style*="emoji"],
.ad-description .ck-emoji {
    font-size: 1.3em;
    line-height: 1;
    vertical-align: middle;
}

/* Paragraph spacing for better readability */
.ad-description p {
    margin-bottom: 1rem;
}

.ad-description p:last-child {
    margin-bottom: 0;
}

/* Links in description */
.ad-description a {
    color: var(--primary-color, #6b4c7a);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.ad-description a:hover {
    color: var(--accent-purple, #a78bba);
}

/* Lists in description */
.ad-description ul,
.ad-description ol {
    margin: 1rem 0;
    padding-right: 1.5rem;
}

.ad-description li {
    margin-bottom: 0.5rem;
}

/* Blockquotes */
.ad-description blockquote {
    border-right: 4px solid var(--primary-color, #6b4c7a);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    background: rgba(107, 76, 122, 0.05);
    border-radius: 8px;
    font-style: italic;
}

[data-theme="dark"] .ad-description blockquote {
    background: rgba(167, 139, 186, 0.1);
}

/* Strong and emphasis */
.ad-description strong {
    font-weight: 700;
    color: var(--text-primary);
}

.ad-description em {
    font-style: italic;
}

/* Images in description */
.ad-description img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Tables in description */
.ad-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.ad-description table td,
.ad-description table th {
    border: 1px solid var(--border-color, #dee2e6);
    padding: 0.75rem;
}

.ad-description table th {
    background: var(--bg-secondary, #f8f9fa);
    font-weight: 600;
}

[data-theme="dark"] .ad-description table th {
    background: rgba(255, 255, 255, 0.05);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ad-description {
        font-size: 0.95rem;
    }

    .ad-description img.emoji,
    .ad-description .emoji {
        height: 1.2em;
        width: 1.2em;
    }
}

/* ========================================
   Video Badge - Ad Card
   Shows video play icon for ads with video
   ======================================== */

.video-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    z-index: 5;
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-badge:hover {
    background: var(--primary-color, #6b4c7a);
    transform: scale(1.1);
}

.video-badge i {
    margin-left: 2px; /* Slight offset for play icon visual centering */
}

/* RTL support */
[dir="rtl"] .video-badge {
    left: auto;
    right: 10px;
}

[dir="rtl"] .video-badge i {
    margin-left: 0;
    margin-right: 2px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .video-badge {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
        bottom: 8px;
        left: 8px;
    }

    [dir="rtl"] .video-badge {
        left: auto;
        right: 8px;
    }
}

/* ========================================
   Optimized Video Loading - Ad Detail
   Lazy loading and performance optimizations
   ======================================== */

/* Video container for lazy loading */
.ad-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    overflow: hidden;
}

.ad-video-container video,
.ad-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video loading placeholder */
.video-loading-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    gap: 12px;
}

.video-loading-placeholder i {
    font-size: 3rem;
    color: var(--primary-color, #6b4c7a);
    animation: pulse 2s infinite;
}

.video-loading-placeholder span {
    font-size: 0.9rem;
    color: #94a3b8;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Video play overlay for click-to-play */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.3);
}

.video-play-overlay .play-btn {
    width: 70px;
    height: 70px;
    background: var(--primary-color, #6b4c7a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(107, 76, 122, 0.4);
}

.video-play-overlay:hover .play-btn {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(107, 76, 122, 0.5);
}

.video-play-overlay .play-btn i {
    margin-left: 4px; /* Visual centering for play icon */
}

[dir="rtl"] .video-play-overlay .play-btn i {
    margin-left: 0;
    margin-right: 4px;
}

/* Thumbnail image for lazy loaded videos */
.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Video feature tag in ad card */
.feature-tag.video-tag {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

[data-theme="dark"] .feature-tag.video-tag {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Mobile responsive for video */
@media (max-width: 768px) {
    .video-play-overlay .play-btn {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .video-loading-placeholder i {
        font-size: 2.5rem;
    }
}
