.template-card .price,
.template-card .price *,
.price,
.price * {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    background: none !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

.template-content {
    display: flex !important;
    flex-direction: column !important;
}

.template-name-compact {
    order: -1 !important;
    margin-bottom: 4px !important;
    margin-top: 0 !important;
}

.content-header,
.price-row,
.price {
    order: 10 !important;
    margin-bottom: 8px !important;
}

.card-categories {
    order: 20 !important;
}

.card-footer-unified {
    order: 30 !important;
    margin-top: auto !important;
}

.creator-actions-strip {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    overflow-x: auto !important;
    padding: 12px 0 !important;
    scrollbar-width: none;
    margin-bottom: 16px;
}

.creator-actions-strip::-webkit-scrollbar {
    display: none;
}

.action-btn-circle {
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
}

.action-btn-circle svg {
    width: 24px;
    height: 24px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    box-sizing: content-box;
}

.delivery-tag {
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
    height: 24px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.delivery-tag svg {
    width: 12px !important;
    height: 12px !important;
}

/* Sidebar Menu Cleanup - Redundant horizontal header menu styles removed */

@media (min-width: 769px) {
    .navbar {
        /* Removed horizontal navbar overrides to support sidebar layout */
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    #template-grid.template-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 8px !important;
    }

    .main-layout-right .template-grid,
    .similar-templates-section .template-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .template-card .template-image {
        height: 140px !important;
    }

    .template-content {
        padding: 8px !important;
    }

    .categories-scroll {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .creator-info-min {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .creator-info-min div {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }
}

.points-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%) !important;
    color: #000 !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 5px rgba(255, 215, 0, 0.2) !important;
    margin: 0 !important;
    height: 24px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    cursor: pointer;
    text-shadow: none !important;
    -webkit-text-fill-color: #000 !important;
    position: relative !important;
    overflow: visible !important;
}

.points-badge svg {
    width: 12px !important;
    height: 12px !important;
    fill: #000 !important;
}

/* Hide tooltip by default, show on hover/click */
.points-badge-wrapper .points-tooltip {
    display: none !important;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1c;
    color: #e5e5e5 !important;
    -webkit-text-fill-color: #e5e5e5 !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    white-space: nowrap;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    height: auto !important;
    line-height: normal !important;
}

.points-badge-wrapper:hover .points-tooltip,
.points-badge-wrapper.active .points-tooltip {
    display: block !important;
}

.smart-suggestions {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.smart-suggestions h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.smart-suggestions h3 svg {
    color: var(--primary);
}

@media (min-width: 769px) {
    #reviews-panel {
        position: static !important;
        transform: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border-top: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        margin-top: 40px;
    }

    .reviews-overlay,
    .close-reviews-btn {
        display: none !important;
    }

    .reviews-panel-header {
        border-bottom: 1px solid var(--border-subtle);
        margin-bottom: 20px;
        padding: 0 0 16px 0 !important;
    }

    .reviews-content-scroll {
        padding: 0 !important;
        overflow: visible !important;
    }
}

@media (max-width: 768px) {
    .reviews-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(5px);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .reviews-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    #reviews-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        background: #18181b;
        border-radius: 20px 20px 0 0;
        z-index: 9999;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    #reviews-panel.active {
        transform: translateY(0);
    }

    .reviews-header,
    .reviews-panel-header {
        padding: 16px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .reviews-content-scroll,
    .reviews-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }
}

.review-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.review-header {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.review-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.review-meta {
    flex: 1;
}

.review-author {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.review-rating {
    font-size: 0.85rem;
    color: #fbbf24;
    margin-top: 2px;
}

.review-date {
    color: var(--text-secondary);
    margin-left: 6px;
    font-size: 0.8rem;
}

.review-text {
    color: #d1d5db;
    margin-left: 52px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.review-actions {
    margin-left: 52px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    margin: 0;
    transition: all 0.2s;
}

.action-btn:hover {
    color: white;
}

.action-btn.liked {
    color: #ef4444;
}

.replies-container {
    display: none;
    margin-left: 52px;
    margin-top: 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 16px;
}

.replies-container.visible {
    display: block !important;
}

.nested-replies {
    margin-left: 20px;
    margin-top: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.reply-item {
    margin-bottom: 16px;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reply-text {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.4;
}

.reply-form {
    display: none;
    margin-left: 52px;
    margin-top: 10px;
    background: #27272a;
    padding: 12px;
    border-radius: 8px;
}

.reply-form.active {
    display: block;
}

.reply-input {
    width: 100%;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    resize: none;
}

.reply-submit-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    margin-top: 8px;
    cursor: pointer;
}

.reply-submit-btn.cancel {
    background: transparent;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* ============================================================
   PREMIUM CHARCOAL AUTH RELOCATION (1024px Breakpoint)
   ============================================================ */

/* Navbar Container Flex Alignment */
.nav-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 2rem !important;
    /* Moved avatar slightly left from the edge */
}

#user-profile {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Charcoal Pills */
.auth-pill {
    padding: 8px 24px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    color: white !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.auth-pill:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px);
}

.auth-pill-signup {
    background: white !important;
    color: black !important;
    border: none !important;
}

.auth-pill-signup:hover {
    background: #f5f5f7 !important;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}

/* Avatar Refinement & Chevron-only Dropdown */
.top-right-auth-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    /* Slightly more visible as requested */
    padding: 4px 12px 4px 4px;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
}

.top-right-auth-wrapper:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.04);
}

.top-right-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--primary-glow);
    transition: all 0.3s ease;
}

.chevron-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    /* Larger hit area */
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.chevron-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 160px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    margin-top: 5px;
}

/* Trigger ONLY on chevron hover */
.chevron-wrapper:hover+.profile-dropdown,
.profile-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chevron-wrapper:hover .chevron-icon {
    color: white;
    transform: rotate(180deg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.dropdown-item.logout {
    color: #ff453a;
}

.dropdown-item.logout:hover {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 6px 0;
}

/* Workplace/Marketplace Hero Section Visibility (User: marketplace header is not needed) */
@media (min-width: 1024px) {

    /* Hide hero on marketplace/home if necessary to follow "no marketplace header" */
    .page-marketplace .hero-section { display: none !important; }

    /* If filters-bar is present, add some top margin to compensate for missing hero */
    .filters-bar {
        margin-top: 100px !important;
    }

    /* Sidebar hide class */
    .sidebar-desktop-hide {
        display: none !important;
    }

    /* Sidebar push fix */
    body {
        padding-top: 0 !important;
    }
}

/* Responsive Logic for Auth Container */
@media (max-width: 1023px) {
    #user-profile {
        display: none !important;
    }
}